note
shmem
Thanks, got it. Sometimes I'm slow.
<p>update: something like that would do:</p>
<code>
...
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, XSConf::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;
</code>
<p>update: added <c>$XSConf::strict</c>, [doc://caller] and [doc://die]</p>
907750
907757