Perl functions

  • Thread starter Deepan - M.Sc(SE) - 03MW06
  • Start date
D

Deepan - M.Sc(SE) - 03MW06

Hi all,
I am using a file abc.pl which is having a function called
get().

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 abc.pl 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?

Thanks,
Deepan
 
D

david

Hi,

You need to make a package
something like this

abc.pm
package abc;
use strict;
use warnings;

sub get {
}

and then in your script;

use abc;
..
..
..
..
abc::get(blablabla);

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,
David
 
X

xhoster

Deepan - M.Sc(SE) - 03MW06 said:
Hi all,
I am using a file abc.pl which is having a function called
get().

I am including this perl file inside a cgi script, and also i am
calling this function inside this script.

What method are you using for doing the including? Shouldn't this be
abc.pm rather than abc.pl?
Now this function residing
inside the perl file abc.pl should now look into the URL of the
calling CGI script

Why? Your CGI script is "in charge". Shouldn't it send abc.pl what it
needs, rather than expecting abc.pl 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.

Xho

--
-------------------- 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top