Ask a Question related to PERL Modules, Design and Development.
-
Wild Pete #1
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 changes in foo by updating the code in
my.pl, and the changes are not taking place?
&foo just keeps doing the old code. What I
suspect is that there is a "foo" subroutine
somewhere else in the include path that had
the old code, but I can't find it. Is there a
way to trace where perl got the foo subroutine?
Any other suggestions on tracking this down?
TIA, Peter
Wild Pete Guest
-
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... -
undefined subroutine
I'm doing a php to pl migration and having a little trouble. Help appreciated! Undefined subroutine &main::fopen called at... -
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 as a new Task
Hello, how can I start a soubroutine as a new task. The main script should run on until the end is reached. But the subroutine should run in... -
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... -
Terrence Brannon #2
Re: how to trace a subroutine?
Wild Pete wrote:
it's bad form, but why not give a full path to my.pl?> 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 changes in foo by updating the code in
> my.pl, and the changes are not taking place?
> &foo just keeps doing the old code. What I
> suspect is that there is a "foo" subroutine
> somewhere else in the include path that had
> the old code, but I can't find it. Is there a
> way to trace where perl got the foo subroutine?
> Any other suggestions on tracking this down?
>
that way you know which one it is loading.
or from perldoc perlrun
([url]http://www.perldoc.com/perl5.8.0/pod/perlrun.html[/url])
trace each line of your program as it runs:
# Bourne shell syntax
$ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
> TIA, PeterTerrence Brannon Guest
-
Eric J. Roode #3
Re: how to trace a subroutine?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[email]peter@for-wild.org[/email] (Wild Pete) wrote in
news:e4b0fcf8.0312010715.5e507c9d@posting.google.c om:
Are you modifying my.pl while the main script is still running? Because> 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 changes in foo by updating the code in
> my.pl, and the changes are not taking place?
> &foo just keeps doing the old code. What I
> suspect is that there is a "foo" subroutine
> somewhere else in the include path that had
> the old code, but I can't find it. Is there a
> way to trace where perl got the foo subroutine?
> Any other suggestions on tracking this down?
'require' won't load the file a second time once it has been loaded
(unless you play some really ugly games with perl's loading mechanism).
Also, FYI, it's generally bad style to invoke a subroutine with an
ampersand unless you know why you are doing so.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP8v1/2PeouIeTNHoEQKSAACeJkEuoNAMdtaes+Yk90EsJZr1h6oAoN2 p
zc0KbqDCEWuh430e+FCe+Jli
=5G76
-----END PGP SIGNATURE-----
Eric J. Roode Guest



Reply With Quote

