On Friday, Nov 14, 2003, at 07:19 US/Pacific, angie ahl wrote: [..]
I changed my code so the variables aren't references;
sub EventList { my ($class, %arg) = @_; # load of code here return ([EMAIL PROTECTED], $startdate, $enddate); }
And then called it like so:
my @tempres = $event->EventList(skip=>0, max=>10); my $EventList = @tempres[0]; my @EventList = @{$EventList};
my $startdate = @tempres[1]; my $enddate = @tempres[2];
Angie
What folks need to remember is that perl is a list muncher and it really is the only 'interface' into and out of functions/methods - hence all calls will be of the form
my @got_back = $obj->method_foo(@arglist);
but that would also allow one to 'put them in list context' in the form
my ($list_ref, $startdate, $enddate) = $obj->EventList(\%args);
note I have shifted to the idea of having your sub in the form
sub EventList { my ($class, $arg_hash_ref) = @_; # load of code here return ([EMAIL PROTECTED], $startdate, $enddate); }
Since one doesn't need to pass the whole Hash, merely a reference to it.
Folks need to feel safe about referencing and dereferencing. Since that $arg_has_ref will look like a hash with
while ( my ($k,$v) = each %$arg_hash_ref) {...}
or one can access a key in it with
my $val = $arg_hash_ref->{'ThatKey'};
and of course the re-refing of the array would be
foreach my $event (@$list_ref) { #deal with the event here }
HTH.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]