(thread intentionally broken)

Nathan Torkington wrote:
> 
> Steve Fink writes:
> > True. Would anyone mourn @$scalar_containing_variable_name if it died?
> > I've never used it, and I'm rather glad I haven't. Perl5's -w doesn't
> > notice $x="var"; print @$x either -- it'll complain if you mention @var
> > once.
> 
> These are symbolic references.  You can forbid them with the strict
> pragma.  Yes, I'd miss them.  So would the Exporter.
> 
> > Damn, learn something new every day... perl really is incestuous with
> > its symbol table, isn't it?
> 
> Yes.  That's what makes it useful.

Ouch. I need to know more. I'm looking at what a type inference engine
for perl would look like, and these symbolic references would incur some
massive pollution. Clearly, the inferencer will at least depend on
people using strict 'refs' to prevent every $$x="bleck" from trashing
the type of every scalar variable in the program. So can someone explain
to me what the actual uses are, so I can dream up some form of manual
annotation that will limit the scope of their effects? (If the
functionality of Exporter becomes more 'core', its usage should no
longer matter.)

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?

Reply via email to