You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ken Williams <ke...@forum.swarthmore.edu> on 2001/05/04 07:29:30 UTC
[OT] Re: mod_perl subs defined, but don't exist? SOLVED mostly
will@serensoft.com (will trillich) wrote:
> > sub search {
> > # ....
> > {
> > use CGI qw/:standard/;
> > my $form = join '',
> > map {
> > hidden(
> > -name => $_,
> > -value => $arg->{$_},
> > ) . "\n"
> > }
> > grep(
> > $arg->{$_} and ($_ ne 'd') and ($_ ne 'go')
>
>as is, the functions that follow (top-level 'sub xyz {}') get
>screwy. code disappears.
>
>replace "and" with "&&" and all is well. boggles my mind.
Well, as far as I can tell, the original code doesn't even compile
because there aren't enough arguments to grep(). That's why I couldn't
test it. I suppose changing the precedence helped things out. Perhaps
you should use the more explicit BLOCK version:
my $form = join '',
map
{
hidden(
-name => $_,
-value => $arg->{$_},
) . "\n"
}
grep
{
$arg->{$_} and ($_ ne 'd') and ($_ ne 'go')
}
keys %$arg;
>
>with 'and' *{$My::Debacle::{handler}}{CODE} doesn't exist.
That's an illusion. The truth is that with 'and' the code is checking
something completely different, or not working at all.
This is turning out to be pretty well off-topic for the mod_perl list,
so we should cease.
------------------- -------------------
Ken Williams Last Bastion of Euclidity
ken@forum.swarthmore.edu The Math Forum
Re: [OT] Re: mod_perl subs defined, but don't exist? SOLVED mostly
Posted by will trillich <wi...@serensoft.com>.
On Fri, May 04, 2001 at 12:29:30AM -0500, Ken Williams wrote:
> will@serensoft.com (will trillich) wrote:
> > > sub search {
> > > # ....
> > > {
> > > use CGI qw/:standard/;
> > > my $form = join '',
> > > map {
> > > hidden(
> > > -name => $_,
> > > -value => $arg->{$_},
> > > ) . "\n"
> > > }
> > > grep(
> > > $arg->{$_} and ($_ ne 'd') and ($_ ne 'go')
> >
> >as is, the functions that follow (top-level 'sub xyz {}') get
> >screwy. code disappears.
> >
> >replace "and" with "&&" and all is well. boggles my mind.
>
>
> Well, as far as I can tell, the original code doesn't even compile
> because there aren't enough arguments to grep(). That's why I couldn't
> test it.
grep(
$arg->{$_} and ($_ ne 'd') and ($_ ne 'go')
, keys %$arg # note the leading comma...
)
aha -- so maybe "x and y and z , pdq" has lexical precedence
where the (z,pdq) parses higher, as in
x and y and (z , pdq)
versus what i expected, which was
(x and y and z) , pdq
hmm?
--
will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!