~~David~~ has asked for the wisdom of the Perl Monks concerning the following question:
Maybe I have the wrong idea completely, but I was just wondering if I should choose one way or the other. The Moose tutorial says you should try to __PACKAGE__->meta->make_immutable; which my current method doesn't allow me to do...after 'file' => sub { my $self = shift; open my $FILE, "<", $self->{file}; HEADER: while ( <$FILE> ){ my ( $tag, $value ) = $_ =~ /\s*(\w+)\s(.+)/; my $accessor = lc $tag; #create an accessor for each header value has $accessor => ( is =>'ro' ); $self->{$accessor} = $value; } close $FILE; };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Creating accessors on the fly, or not...
by stvn (Monsignor) on Jun 13, 2009 at 02:19 UTC | |
by dsheroh (Monsignor) on Jun 13, 2009 at 12:16 UTC | |
by stvn (Monsignor) on Jun 13, 2009 at 18:07 UTC | |
by dsheroh (Monsignor) on Jun 14, 2009 at 10:30 UTC | |
by lodin (Hermit) on Jun 14, 2009 at 07:14 UTC | |
by stvn (Monsignor) on Jun 15, 2009 at 00:39 UTC |