Is there a reason why you are using that weird syntax instead of the way proposed in the SYNOPSIS section of the documentation ?
package Bar; use base 'Foo'; use fields qw(baz _Bar_private); # not shared with Foo sub new { my $class = shift; my $self = fields::new($class); $self->SUPER::new(); # init base fields $self->{baz} = 10; # init own fields $self->{_Bar_private} = "this is Bar's secret"; return $self; }
Of course, doing it that way means you need to chain to the previous constructor manually, but I didn't see any chaining in your (more generic?) constructor.
In reply to Re: use fields;
by Corion
in thread use fields;
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |