in reply to Adding properties to a blessed file handle reference
You can do this with inside-out objects. See the File::Marker example in my YAPC::NA 2006 talk.
Class::InsideOut makes this even easier.
package My::File::Class; use base 'IO::File'; use Class::InsideOut qw/public id register/; public some_property => my %some_property; sub new { my $class = shift; my $self = IO::File->new( @_ ); register( bless $self, $class ); return $self; } 1;
Use like this:
use My::File::Class; my $obj = My::File::Class->new( "filename.txt" ); $obj->some_property("foo");
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|