Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
copy contructor
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Eric Schwartz, post: 4794249"] <snip rest of example> Ow. Stop hurting my brain like that. So assuming you wanted to store multiple bits of data, would Sick::Snake look something like: package Sick::Snake use Scalar::Util qw 'refaddr'; our @ISA = qw/Angry::Snake/; my %attr; sub set_shivering { my $snake = shift; $attr{refaddr $snake}{shivering} = shift; $snake; } sub set_sneezing { my $snake = shift; $attr{refaddr $snake}{sneezing} = shift; $snake; } sub shivering {...} sub sneezing {...} and so on? That's a very neat trick. Should I ever be forced to write OO in Perl, I will try to keep that in mind. Also, nice plug for Scalar::Util, which while not quite as nifty as List::Util, is still one of the more underappreciated modules in Perl, I think. -=Eric [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
copy contructor
Top