in reply to Possible bug in SelfLoader?

It's not a bug in the regular expression for SelfLoader - it's an undocumented requirement (which could be considered a documentation bug).

The regex used requires that the sub declaration be anchored to the left column. I personally don't see a reason to do it that way and not allow optional whitespace between the '^' and 'sub' - maybe you should open a request at http://rt.cpan.org and/or email the author?

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^2: Possible bug in SelfLoader? (no leading whitespace)
by tye (Sage) on Feb 17, 2005 at 19:52 UTC

    I'd actually keep the no-whitespace requirement considering such simple problems like:

    eval q{ sub foo1 { ... } ); print <<END; You'll need to define your method like: sub myMethod { ... } END use strict; { my $static; sub usesStatic { # Note that this routine fails if it # gets moved out of this lexical scope. return $static; } }

    It isn't perfect, but I find the no-whitespace requirement much saner.

    - tye