from the camel book: "Use of defined on aggregates (hashes and arrays) is
deprecated."
so, change
if (!defined @fields)
to
unless (@fields)
and not only be idiomatic, but exhibit the behavior you want :)
but seriously, it's a perl thing, not a mod_perl thing:
#!/usr/bin/perl
sub test {
my @array;
if (!defined @array) {
print "not defined\n";
} else {
print "defined\n";
}
push @array, "item";
}
test();
test();
results:
not defined
defined
HTH
--Geoff
> -----Original Message-----
> From: Ron Rademaker [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 07, 2000 7:44 AM
> To: lporcano
> Cc: [EMAIL PROTECTED]
> Subject: Re: Apache::Registry() and strict
>
>
> I'm not quite looking for a workaround, I already got one, I'd like to
> know why it's going wrong.
>
> Ron
>
> On Sun, 7 Nov 1999, lporcano wrote:
>
> > It looks like you are trying to determine if an array is
> empty, in that case
> > replace
> > if (!defined(@fields))
> > with
> > if (!scalar(@fields)).
> >
> > ----- Original Message -----
> > From: Ron Rademaker <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 07, 2000 5:26 AM
> > Subject: Re: Apache::Registry() and strict
> >
> >
> > > Okay, here's the part where it's going wrong:
> > >
> > > my @fields; # The variable that's causing the
> trouble, should be
> > > undefined after this declaration
> > > my $printedfields = 0;
> > >
> > > foreach my $hash_ref (@$data_ref)
> > > {
> > > if (!defined(@fields)) # Passes the second time the child gets a
> > > request, but @fields = ()
> > > {
> > > @fields = @$hash_ref;
> > > }
[snip]