That's a more stylish version of the hack I'm using now, but it doesn't
solve the problem of function overloads not working, which totally buggers
having dynamically generated wizard pages because I can't override
Has{Next,Prev}Page.
--Matt
Robin Berjon <robin.berjon@xxxxxxxxx>
Sent by: wxperl-users-admin@xxxxxxxxxxxxxxxxxxxxx
12/15/2003 11:55
To: Matthew Gabeler-Lee/PH/Novartis@PH
cc: wxperl-users@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [wxperl-users] Problem with Wx::Wizard
matthew.gabeler-lee@xxxxxxxxxxxxxxxxxxx wrote:
> I'm trying to derive a class from Wx::Wizard in order to have dymanic
page
> generation, and I'm having to resort to some horrible hacks, because the
> reference that Wx::Wizard->new returns is a SCALAR, not a HASH like just
> about any other object. Is there a good reason for this, or is it just
an
> oversight? Can it easily be fixed?
Does something like this work for you?
package Wx::Wizard;
use Scalar::Util qw(refaddr);
use overload '{}' => \&toHash;
our %OBJ;
sub toHash {
my $id = refaddr shift;
unless (exists $OBJ{ $id }) {
$OBJ{ $id } = {};
}
return $OBJ{ $id };
}
sub DESTROY {
delete $OBJ{ refaddr shift };
}
--
Robin Berjon
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|