Mohd Mohtashim has Published 238 Articles

First CGI Program using Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 08:01:54

419 Views

Here is a simple Perl CGI program available in file called hello.cgi. This file has been kept in /cgi-bin/ directory and it has the following content. Before running your CGI program, make sure you have change mode of file using chmod 755 hello.cgi UNIX command.#!/usr/bin/perl print "Content-type:text/html\r\r"; print ''; print ''; print 'Hello Word ... Read More

Useful DBI Functions in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 08:00:02

147 Views

Checking available_drivers@ary = DBI->available_drivers; @ary = DBI->available_drivers($quiet);Returns a list of all available drivers by searching for DBD::* modules through the directories in @INC. By default, a warning is given if some drivers are hidden by others of the same name in earlier directories. Passing a true value for $quiet will ... Read More

Using NULL Values in Perl Database Operation

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:57:00

1K+ Views

Undefined values, or undef, are used to indicate NULL values in Perl’s Database Operations. You can insert and update columns with a NULL value as you would a non-NULL value. These examples insert and update the column age with a NULL value −$sth = $dbh->prepare(qq {    INSERT INTO TEST_TABLE ... Read More

COMMIT & Rollback Operations in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:56:02

1K+ Views

COMMIT OperationCommit is the operation which gives a green signal to database to finalize the changes and after this operation no change can be reverted to its orignal position.Here is a simple example to call commit API.$dbh->commit or die $dbh->errstr;ROLLBACK OperationIf you are not satisfied with all the changes or ... Read More

Database DELETE Operation in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:54:26

840 Views

Perl DELETE operation is required when you want to delete some records from your database. Following is the procedure to delete all the records from TEST_TABLE where AGE is equal to 30. This operation will take the following steps.Preparing SQL query based on required conditions. This will be done using ... Read More

Database UPDATE Operation in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:52:37

1K+ Views

Perl UPDATE Operation on any database means to update one or more records already available in the database tables. Following is the procedure to update all the records having SEX as 'M'. Here we will increase AGE of all the males by one year. This will take three steps −Preparing ... Read More

Database READ Operation in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:51:02

728 Views

Perl READ Operation on any databasse means to fetch some useful information from the database, i.e., one or more records from one or more tables. So once our database connection is established, we are ready to make a query into this database. Following is the procedure to query all the ... Read More

Database INSERT Operation in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:48:46

2K+ Views

Perl INSERT operation is required when you want to create some records into a table. Here we are using table TEST_TABLE to create our records. So once our database connection is established, we are ready to create records into TEST_TABLE. Following is the procedure to create single record into TEST_TABLE. ... Read More

How to create Database Connection in Perl?

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:45:13

441 Views

Assuming we are going to work with MySQL database with Perl. Before connecting to a database make sure of the followings. You can take help of our MySQL tutorial in case you are not aware about how to create database and tables in MySQL database.You have created a database with ... Read More

Destructors and Garbage Collection in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 07:43:59

437 Views

If you have programmed using object oriented programming before, then you will be aware of the need to create a destructor to free the memory allocated to the object when you have finished using it. Perl does this automatically for you as soon as the object goes out of scope.In ... Read More

Advertisements