We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

Four methods of calling a CGI.pm's standard method

As  a beginner to perl programming one should know the method of invoking a cGI module's method group. Basically perl has some predefined set of modules. These are stored with an extension .pm. Each module has some set of method groupings and each method grouping has some set of methods. The most basic module of perl is CGI.pm which is mainly used to create interactive web applications. But there are four different methods of invoking the cgi.pm modules's method grouping. One such method grouping is standard.

 

These four different types of invocation can be categorized into two ways:-
1) Function oriented
2) Object Oriented
 
Let us first see how to invoke the method grouping standard from a CGI module.
 
1) Fucntional Oriented Approach
 
The basic way of including the CGI modeule is
 
Use CGI;
 
But to include the standard method grouping, one should use
 
(a) Use CGI ':standard'; - This means that the standard method grouping is invoked and the methods inside the standard group can be accessed in the program
 
(b) Use CGI qw(:standard); - here qw() fucntion is used. This is called quote operatot which seperates the individual elements based on white space.
 
(c) Use CGI qw(/standard/)
 
2) Object Oriented Approach:
 
       The basic idea of using the object oriented approach is that we can use multiple cgi objects within the script.
 
Here the approach is
         Use CGI;
       my $ob = new CGI;
Now one can access the methods of the CGI module using this object $ob
 
Hope this will help for those who start with perl CGI


Related Tags:

perl, cgi.pm

Author: Satheeskumar A

top

Miscellaneous

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login