Steve Fink writes:
> My code for doing what I thought Exporter did is:
>
> sub import {
> my $p = caller(1);
> *{"${p}::E"} = \%{"${p}::E"};
> }
>
> but that doesn't run afoul of use strict 'refs'. Can you point me to the
> passage in Exporter.pm that uses this?
It does run afoul of use strict 'refs'. That's the kind of thing that
the Exporter does.
Symbolic references are used for dynamic function generation:
foreach my $func (qw(red green blue)) {
*$func = sub { "<FONT COLOR=$func>@_</FONT>" }
}
Also lazy function generation (similar thing but from within an
AUTOLOAD).
Class::Struct does it to mechanically create the subroutines for a
class.
Any object code that gets a class name (package) as an argument and
uses it to inspect variables in the package does it.
(off the top of my head)
Nat