in reply to safe and $self
From the Safe docs for share(NAME, ...): Each NAME must be the name of a non-lexical variable, typically with the leading type identifier included.
Since in OO Perl the current instance of a package is referred to merely by a lexical variable declared within a subroutine, i.e., my $this = shift(@_), sharing it will not be possible. You're seeing 'uninitialized' warnings now because Safe attempts to look up $SamplePackage::self, which is uninitialized.
If you're truly desperate you could effectively make your class instance a public static member using our, and then share that reference. But that's generally a bad idea unless you're sure your instance will always be a singleton.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: safe and $self
by feanor_269 (Beadle) on Nov 26, 2002 at 23:11 UTC | |
by djantzen (Priest) on Nov 27, 2002 at 02:09 UTC | |
by tadman (Prior) on Nov 27, 2002 at 05:57 UTC | |
by feanor_269 (Beadle) on Nov 27, 2002 at 17:52 UTC |