Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How do I know if I'm in a BEGIN block?

by Kirsle (Pilgrim)
on Oct 29, 2009 at 21:23 UTC ( #804052=note: print w/replies, xml ) Need Help??


in reply to How do I know if I'm in a BEGIN block?

[kirsle@damocles ~]$ cat begin.pl #!/usr/bin/perl -w use begin; BEGIN { begin::myfunc(); } print "lalala\n"; begin::myfunc(); [kirsle@damocles ~]$ cat begin.pm package begin; sub myfunc { my @caller = caller(1); print "caller info: @caller\n"; } 1; [kirsle@damocles ~]$ perl begin.pl Use of uninitialized value $caller[6] in join or string at begin.pm li +ne 5. Use of uninitialized value $caller[7] in join or string at begin.pm li +ne 5. Use of uninitialized value $caller[10] in join or string at begin.pm l +ine 5. caller info: main begin.pl 7 main::BEGIN 1 0 256 UUUUUUUUUUUU lalala caller info:

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://804052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2021-06-15 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (73 votes). Check out past polls.

    Notices?