in reply to Overriding arguments in Class::Std superclass constructors
Try using Object::InsideOut. It will do just what you want:
Remember: There's always one more bug.
#!/usr/bin/perl use strict; use warnings; package My::Class; { use Object::InsideOut; my @value :Field('Accessor' => 'value'); my %init_args :InitArgs = ( 'value' => { 'Field' => \@value, 'Mandatory' => 1, }, ); } package My::Class::Sub; { use Object::InsideOut qw(My::Class); sub _preinit :PreInit { my ($self, $args) = @_; $args->{'value'} = 23; } } package main; my $obj = My::Class::Sub->new(); print($obj->value(), "\n");
Remember: There's always one more bug.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Overriding arguments in Class::Std superclass constructors
by fce2 (Sexton) on Aug 13, 2006 at 03:46 UTC |
In Section
Seekers of Perl Wisdom