in reply to Spiffy: How to define the constructor to take parameters
The following seems to be what you want:
package VesrRec; use strict; use warnings; use Spiffy -Base; field 'raw'; sub new() { my ($class, $raw) = @_; my $self = bless {}, $class; $self->raw($raw); return $self; } package main; my $rec = VesrRec->new ('This one'); print $rec->raw ();
Prints:
This one
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Spiffy: How to define the constructor to take parameters
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 |