John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
It appears that the concept is to call export in the general case, and do an inline symbol assignment if all special conditions are met.if ($Verbose or $Debug or grep {/\W/ or $args and not exists $exports{$_} or @fail and $_ eq $fail[0] or (@{"$pkg\::EXPORT_OK"} and $_ eq ${"$pkg\::EXPORT_OK"}[0])} @_) { return export $pkg, $callpkg, ($args ? @_ : ()); } #local $SIG{__WARN__} = sub {require Carp; goto &Carp::carp}; local $SIG{__WARN__} = sub {require Carp; local $Carp::CarpLevel = 1; &Carp::carp}; foreach $sym (@_) { # shortcut for the common case of no type character *{"$callpkg\::$sym"} = \&{"$pkg\::$sym"}; }
But just what does that condition say? I understand setting $Verbose or $Debug, and see that the rest is inside a grep to test each argument against some conditions.
But, what is the significance of the first element of @EXPORT_OK or the first element of @fail? Basically, if one of the arguments is the first entry in @EXPORT_OK, then the general case is performed.
So what's special about the first OK item?
—John
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: What does this code do?
by jwest (Friar) on Oct 03, 2002 at 20:47 UTC | |
by John M. Dlugosz (Monsignor) on Oct 03, 2002 at 21:09 UTC | |
by jwest (Friar) on Oct 03, 2002 at 21:24 UTC | |
by John M. Dlugosz (Monsignor) on Oct 03, 2002 at 21:53 UTC | |
Re: What does this code do?
by blokhead (Monsignor) on Oct 04, 2002 at 04:54 UTC | |
Re: What does this code do?
by VSarkiss (Monsignor) on Oct 03, 2002 at 20:55 UTC | |
by John M. Dlugosz (Monsignor) on Oct 03, 2002 at 21:12 UTC | |
Re: What does this code do?
by shotgunefx (Parson) on Oct 04, 2002 at 09:31 UTC | |
by John M. Dlugosz (Monsignor) on Oct 04, 2002 at 14:58 UTC | |
by shotgunefx (Parson) on Oct 04, 2002 at 16:48 UTC |