Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^4: using AUTOLOAD to access read-only data structures

by shmem (Chancellor)
on Jun 02, 2011 at 06:39 UTC ( #907758=note: print w/replies, xml ) Need Help??

in reply to Re^3: using AUTOLOAD to access read-only data structures
in thread using AUTOLOAD to access read-only data structures

Thanks, got it. Sometimes I'm slow.

update: something like that would do:

... sub import { shift; $config or $config = XMLin(shift) if @_; $XSConf::strict = shift if @_; return; # don't give $config away } .... ref $thing and $token = $thing or return bless \$thing, XS +Conf::Str; } } return $package; } package XSConf::Str; use overload '""' => \&str, fallback => 1; sub str { ${$_[0]} } our $AUTOLOAD; sub AUTOLOAD { return if $AUTOLOAD eq 'XSConf::Str::DESTROY'; my @caller = caller; die "you cannot invoke the method '$AUTOLOAD' on the string '$_[0] +'" . " at $caller[1] line $caller[2]\n" if $XSConf::strict; $_[0]; } 1;

update: added $XSConf::strict, caller and die

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://907758]
[1nickt]: Is anyone using Method::Signatures ?
[choroba]: 10 bugs in the tracker?
[1nickt]: Yes, and recommendation against using it, in the doc for Devel::Declare, on whcih it is based.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-11-24 13:17 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (349 votes). Check out past polls.