Click here to get back home

Perl functions

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Perl functions Deepan - M.Sc(SE) - 03MW06 03-06-2008
Posted by Deepan - M.Sc(SE) - 03MW06 on March 6, 2008, 8:31 am
Please log in for more thread options
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

Posted by david on March 6, 2008, 8:56 am
Please log in for more thread options
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
wrote:
> 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


Posted by Frank Seitz on March 6, 2008, 9:18 am
Please log in for more thread options
Deepan - M.Sc(SE) - 03MW06 wrote:
>
> 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?

use CGI;

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

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

Posted by xhoster on March 6, 2008, 11:13 am
Please log in for more thread options
> 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.

Similar ThreadsPosted
Math Functions in Perl November 5, 2007, 8:00 am
Automatic way to get a list of Perl functions? October 26, 2004, 1:23 pm
Adding Perl Core functions April 22, 2005, 11:57 pm
How to list all functions in a C files using Perl July 20, 2005, 1:11 pm
FAQ 8.20 How can I call my system's unique C functions from Perl? March 9, 2005, 12:03 am
FAQ 8.20 How can I call my system's unique C functions from Perl? May 27, 2005, 5:03 am
FAQ 8.20 How can I call my system's unique C functions from Perl? September 27, 2005, 4:03 am
FAQ 8.20 How can I call my system's unique C functions from Perl? October 29, 2005, 4:03 am
FAQ 8.20 How can I call my system's unique C functions from Perl? September 14, 2006, 3:03 am
FAQ 8.20 How can I call my system's unique C functions from Perl? November 26, 2006, 3:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap