Mohd Mohtashim has Published 251 Articles

Using GET Methods in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 08:09:56

497 Views

Here is a simple URL which will pass two values to hello_get.cgi program using GET method.http://www.tutorialspoint.com/cgi-bin/hello_get.cgi?first_name=ZARA&last_name=ALIBelow is hello_get.cgi script to handle input given by web browser.#!/usr/bin/perl local ($buffer, @pairs, $pair, $name, $value, %FORM); # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") {    $buffer = $ENV{'QUERY_STRING'}; } # Split ... Read More

Raise a "File Download" Dialog Box using Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 08:05:20

225 Views

Sometime it is desired that you want to give option where a user will click a link and it will pop up a "File Download" dialogue box to the user instead of displaying actual content. This is very easy and will be achieved through HTTP header using Perl Script.This HTTP ... Read More

Perl CGI Environment Variables

Mohd Mohtashim

Mohd Mohtashim

Updated on 02-Dec-2019 08:04:03

2K+ Views

All the Perl CGI program will have access to the following environment variables. These variables play an important role while writing any CGI program in Perl.Sr.NoVariables Names & Description1CONTENT_TYPEThe data type of the content. Used when the client is sending attached content to the server. For example file upload, etc.2CONTENT_LENGTHThe ... Read More

First CGI Program using Perl

Mohd Mohtashim

Mohd Mohtashim

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

296 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

81 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

737 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

667 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

577 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

838 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

541 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

Advertisements