Perl functions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,
     I am using a file which is having a function called

     I am including this perl file inside a cgi script, and also i am
calling this function inside this script. Now this function residing
inside the perl file should now look into the URL of the
calling CGI script and it should return the URL for the cgi script.

    Can any of you help me to solve this?


Re: Perl functions


You need to make a package
something like this
package abc;
use strict;
use warnings;

sub get {

and then in your script;

use abc;

I did not really understand what you want to make but maybe the module
CGI has s function which performs what you need.

Best regards,
Quoted text here. Click to load it

Re: Perl functions

Deepan - M.Sc(SE) - 03MW06 wrote:
Quoted text here. Click to load it

use CGI;

sub get {
    return CGI->new->self_url;

Dipl.-Inform. Frank Seitz; /
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Re: Perl functions

Quoted text here. Click to load it

What method are you using for doing the including?  Shouldn't this be rather than

Quoted text here. Click to load it

Why?  Your CGI script is "in charge".  Shouldn't it send what it
needs, rather than expecting to dig up what it needs on its own?  It
seems that you are aiming for the worst of both worlds--you want code
scattered over multiple files, but without having modular designs that
makes the files loosely coupled.


-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Site Timeline