Ask a Question related to PERL Beginners, Design and Development.
-
Ling F. Zhang #1
using subroutine from another file
Let's say thatI wroute some code long time ago:
code1.pl. In the file there is this subroutine1();
now I am writting another code code2.pl, and would
like to use that subroutine1()...how do I do it
without copy and pasting it to my code2.pl?
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
[url]http://sitebuilder.yahoo.com[/url]
Ling F. Zhang Guest
-
subroutine problem
Hi all, I have recently started to learn perl. After reading Randal Schwartz’s Learning perl, I decided to give my first program a whirl. Upon... -
Subroutine interaction
Hi all, the following structure does not work as intended: sub read_index { my $gedicht_path = shift; my (%author_indexlines,... -
Who called subroutine.
Hi, a basic question how do I know who called my subroutine ? It could be main, it could be another subroutine. Is setting a return value on a... -
how to trace a subroutine?
I have a subroutine "foo" in a file "my.pl". I invoke it by: require "my.pl"; &foo; This has worked fine for a while. Now I try to make... -
Adding encryption subroutine to file upload script
I use a Perl file upload script (Powup) but I need to encrypt the files once they reach the server (or before, if there's a way to do that, but they... -
Rob Hanson #2
RE: using subroutine from another file
Try this...
require 'code1.pl';
call_your_sub();
This will also execute the code in code1.pl (if there is anything outside of
a sub block), which may not be what you want.
Rob
-----Original Message-----
From: Ling F. Zhang [mailto:lingfengz@yahoo.com]
Sent: Monday, September 08, 2003 8:33 PM
To: [email]beginners@perl.org[/email]
Subject: using subroutine from another file
Let's say thatI wroute some code long time ago:
code1.pl. In the file there is this subroutine1();
now I am writting another code code2.pl, and would
like to use that subroutine1()...how do I do it
without copy and pasting it to my code2.pl?
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
[url]http://sitebuilder.yahoo.com[/url]
--
To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
For additional commands, e-mail: [email]beginners-help@perl.org[/email]
Rob Hanson Guest
-
Marco Antonio Manzo #3
Re: using subroutine from another file
Greetings:
Well what you wanan do it's export a function from another class.
You can do it using 2 ways, standard way (using EXPORTER) or
using Object Oriented Programming in your style.
learn.perl.org has the Beginning perl book online, check the OO
chapter and the modules one.
Good luck!
On 17:33 Mon 08 Sep , Ling F. Zhang wrote:--> Let's say thatI wroute some code long time ago:
> code1.pl. In the file there is this subroutine1();
>
> now I am writting another code code2.pl, and would
> like to use that subroutine1()...how do I do it
> without copy and pasting it to my code2.pl?
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> [url]http://sitebuilder.yahoo.com[/url]
>
> --
> To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
> For additional commands, e-mail: [email]beginners-help@perl.org[/email]
Marco Antonio Manzo Bañuelos
[email]amnesiac@unix-power.net[/email]
[url]http://www.unix-power.net[/url]
PGP key 1024D/50C2FDFE 2002-12-20
fingerprint F90D 93B1 021F 1D35 E57A 9E7F BEEE CE06 50C2 FDFE
Marco Antonio Manzo Guest



Reply With Quote

