--- "Mumia W." <[EMAIL PROTECTED]> wrote:
> On 09/21/2006 07:08 PM, chen li wrote: > > Hi all, > > > > I read some sections in perltoot. In section > > Autoloaded Data Methods I see some line codes as > > following: > > > > package Person; > > use Carp; > > our $AUTOLOAD; # it's a package global > > > > my %fields = ( > > name => undef, > > age => undef, > > peers => undef, > > ); > > > > sub new { > > my $class = shift; > > my $self = { > > _permitted => \%fields, > > %fields, > > }; > > bless $self, $class; > > return $self; > > } > > > > It looks like that _permitted => \%fields and > %fields > > are redundant. [...] > > That "redundancy" allows you to use inheritance. If > you have a class > Employee, with an expanded set of fields, this > method makes it possible > to add the fields without having to modify each > method that uses them. > Where can I find more about this kind of syntax? Thanks, Li __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>