in reply to use fields;
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use fields;
by nite_man (Deacon) on Nov 23, 2004 at 08:05 UTC | |
by Corion (Patriarch) on Nov 23, 2004 at 08:12 UTC | |
by nite_man (Deacon) on Nov 23, 2004 at 08:28 UTC | |
by Corion (Patriarch) on Nov 23, 2004 at 08:31 UTC | |
by ysth (Canon) on Nov 23, 2004 at 08:46 UTC |