[DCPM] Creating a module of objects
Steve Marvell
steve at devon-it.co.uk
Wed Jan 10 16:05:30 PST 2007
Neil Williams wrote:
> 1. I'm missing an new() function and I'm not sure what should go in one
> - the objects are created during the parse, new doesn't seem to have
> anything to do.
Do you actually need an instance of this object or is it just a
library of functions.
I can envisage:
my $objections = Objections->new($xmlfile);
> 2. How do I dereference the arrays in the script calling the module? If
> I simply do: my @splits = $object_list{'Split'};
> my @transactions = $object_list{'Trans'};
> my @accounts = $object_list{'Account'};
>
> my $trans_count = @transactions;
> my $acc_count = @accounts;
> my $split_count = @splits;
>
> then each *_count == 1, whatever the incoming file contains.
Personally, I'd use array references. This will get you all in step
for Perl 6. I hardly use hashes and arrays in most contexts. I favour
the references.
I must admit, I'm still not sure what you are actually doing :)
Steve
More information about the Devoncornwall-pm
mailing list