in reply to Re: Re: Re: Finding dependancies of a script
in thread Finding dependancies of a script
Call it an indulgance :)
I call it "confusing" because, well, it confuses me. :-)
Afterall, they aren't really subs, right? You can have more than one BEGIN (et al) block without concern for redefining previous ones. And, my $arg = shift; will shift off @ARGV rather than @_ as you would expect in a sub. Heck, you can't even explicitly call it!¹ And in those ways, they differ significantly from TIE* and family.
Frankly, and maybe I shouldn't admit this, I was surprised putting sub in front even worked. I always think of BEGIN, INIT, CHECK, and END as "special blocks" in a category of their own. I think I've been led that way by the documentation which uses the term "block" to describe them.
1. And trying to opened up a real can of worms. Apparently, even
is treated as a BEGIN block. You can jump through hoops to get a sub called BEGIN if you try:
but try
Prototype mismatch? Ok, so put the prototype in...
That clears the complaint up just fine but our sub is never called. And while we are trying dumb things, take a look at this:
Blech! Blech! BLECH!
After all this, I'm inclined to think that sub BEGIN should be treated as an error if not a regular subroutine. (Of course, given the current state of affairs, we couldn't exactly start treating it as a regular subroutine now, could we? So I think it should be an error.)
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Finding dependancies of a script
by BrowserUk (Patriarch) on Jul 25, 2003 at 23:48 UTC | |
by sauoq (Abbot) on Jul 26, 2003 at 00:42 UTC |