Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

What is cgi-lib.pl and how do I use it?

by johnny0723 (Novice)
on Oct 28, 2005 at 21:09 UTC ( [id://503768]=perlquestion: print w/replies, xml ) Need Help??

johnny0723 has asked for the wisdom of the Perl Monks concerning the following question:

I've been asked to work on a project and I must use cgi-lib.pl for this project. I've never heard of this and never used it. Not sure what it does and how to use it in my programs. I'm pretty new to Perl and have not had formal training. Just been reading the llama book. Any help is appreciated. -John
  • Comment on What is cgi-lib.pl and how do I use it?

Replies are listed 'Best First'.
Re: What is cgi-lib.pl and how do I use it?
by friedo (Prior) on Oct 28, 2005 at 21:17 UTC
    What is cgi-lib.pl

    It's an old Perl library for writing CGI programs.

    and how do I use it?

    DON'T!

    cgi-lib.pl is horribly outdated and contains some serious security problems and is not fully compliant with the CGI spec. The best way to write CGI programs is to use the CGI module. If you must work on existing code which uses cgi-lib.pl, the CGI module has a compatibility mode that will make it pretty easy to update the existing code.

Re: What is cgi-lib.pl and how do I use it?
by kwaping (Priest) on Oct 28, 2005 at 21:16 UTC
    It's a library of subroutines that are helpful for processing CGI requests. You can find it on the cgi-lib homepage (note that the homepage is copyright 1998).

    Personally, I'd try to convince your employers to use CGI.pm instead.
Re: What is cgi-lib.pl and how do I use it?
by ww (Archbishop) on Oct 28, 2005 at 21:34 UTC

    John:

    if you are truly "required" to use cgi-lib.pl for other than for academic purposes, you should be aware that, in the words of www.cs.cf.ac.uk/Dave/PERL/node230.html "(it has) largely been superseded by cgi.pm -- a much larger object oriented cgi processing module." You can readily obtain that current standard for free from CPAN or from a vendor of windows implementations such as Active State.

    Security is one of the considerations. If an employer is requiring use of cgi-lib.pl, you should probably protect yourself and the employer by warning of the potential for problems.

    If you must use cgi-lib.pl because of academic requirements, the file itself contains useful explanatory material; simply open it with your editor. You can find much additional material on both the issues and it's use, by SEARCHing here (which turns up nodes such as cgi-lib.pl and by googling the filename. (Oddly, and perhaps owing to caffeine deficiency or the lateness of the hour, I found no pod in the copy I retain -- for no really good reason -- but generally, pods are useful resources.)

    welcome to perl and to the monastery...

Re: What is cgi-lib.pl and how do I use it?
by Zed_Lopez (Chaplain) on Oct 28, 2005 at 21:22 UTC

    cgi-lib.pl is of historical interest as the best we had before we had CGI, which has been one of the Perl core modules since Perl 5.004 in May 1997.

    Unless you have some godawful dependency on using Perl 4, it's hard to think of a reason to use cgi-lib instead of CGI.

Re: What is cgi-lib.pl and how do I use it?
by bassplayer (Monsignor) on Oct 30, 2005 at 04:56 UTC
    From personal experience, I urge you to please follow the advice of our fellow monks and convince your client that should use CGI.pm. If you cannot sway them, then turn around, run like hell and don't look back. No, seriously. :-)

    bassplayer

      Hi Everyone, thanks for the feedback. It really sounds like CGI.pm is what I should be using. However, let me provide some more details of my task, and perhaps it will make more sense. 1. Build an array of files in a directory 2. print the array of files 3. modify the print so it displays links to them 4. Modify this cgi program so it allows parameters to be passed and displayed. This is apparently where I must use cgi-lib.pl. I went to the home page of cgi-lib.pl and from the example I saw there, I figured that cgi-lib.pl is a library with a bunch of sub routines that can help me get input. Sorry for such elementary questions. I'm new to programming and perl. Is there a book besides the llama that you guys can recommend for a beginner? Thanks a bunch! John

        Is this homework? It reads like homework. We don't really like helping people with homework.

        CGI.pm will do all that you need. And probably easier than you would do it with cgi-lib.pl.

        As for a book, Beginning Perl is available online and it includes an Introduction to CGI.

        --
        <http://dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://503768]
Approved by ww
Front-paged by Roy Johnson
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-20 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found