in reply to my, my, my
I'm also curious why you would return the instance and the node list. If you're trying to hide details, handing back that instances raises a flag that there's something amiss in whichever callers are using the nodes_only form. Also, it seems odd to return undef rather than an empty hash if there no divisions. Is that special case really an abnormal error?
A refactoring might look like:
Note that the 'my' count has been reduced.sub getDivisionListNodes { my($agency) = @_; return undef unless defined($agency); return new($agency)->{ts}->get_node_list('division'); } sub getDivisionNameToIdMap { my($agency) = @_; return undef unless defined($agency); my %nameToId; foreach my $node ( getDivisionListNodes($agency) ) { $nameToId{$node->value{'divname')} = $node->value('siebel_id') +; } return %nameToId; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: my, my, my
by princepawn (Parson) on Nov 14, 2002 at 19:36 UTC | |
by chromatic (Archbishop) on Nov 14, 2002 at 20:24 UTC | |
by dws (Chancellor) on Nov 14, 2002 at 19:54 UTC |