bwagner has asked for the wisdom of the Perl Monks concerning the following question:
I have a question regarding Spiffy: How do I define the constructor to take parameters?
At the moment I provide the possibility to configure an object via an init method which the client should call right after constructing the object, however, I'd prefer to allow those parameters to be passed via new.
Thank youpackage VesrRec; use strict; use warnings; use Spiffy -Base; field 'raw'; sub new() { my $self = super; } sub init { my ($raw) = @_; $self->raw($raw); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Spiffy: How to define the constructor to take parameters
by GrandFather (Saint) on Oct 28, 2007 at 19:48 UTC | |
by bwagner (Initiate) on Oct 28, 2007 at 20:59 UTC | |
by dragonchild (Archbishop) on Oct 29, 2007 at 01:36 UTC | |
by bwagner (Initiate) on Oct 29, 2007 at 07:10 UTC |