Re: [OT] Re: mod_perl subs defined, but don't exist? SOLVED mostly
On Fri, May 04, 2001 at 12:29:30AM -0500, Ken Williams wrote: > [EMAIL PROTECTED] (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? -- [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain!
[OT] Re: mod_perl subs defined, but don't exist? SOLVED mostly
[EMAIL PROTECTED] (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 [EMAIL PROTECTED]The Math Forum
Re: mod_perl subs defined, but don't exist? SOLVED mostly
On Thu, May 03, 2001 at 08:52:38PM -0500, Ken Williams wrote: > I can't follow this test case. Your previous message had a test case, > but it was way too big. Can you whittle this down into the smallest > possible program that demonstrates something you don't understand, and > post that? My guess is that you'll figure out the problem in the > process, but if not, post it here. i found the culprit, but it's like finding out that a butterfly burned down your house. i still don't see how it's possible. when i distill it, of course, the problem vanishes. but see below-- > By the way, I don't think you mean $My::Debacle::handler{CODE}. If you > look closely, you'll see that it's just a regular hash entry. I think > you mean *{$My::Debacle::{handler}}{CODE}. That's the CODE component of > a symbol table entry. right. whoops. boy, that stuff gets deep, quick. > If you have "Effective Perl Programming", look on page 239. eagle book, camel book, but no "shiny ball book". yet. :) > I know this stuff is hard to spot when you've been banging your head > against it for days. For that, I recommend "Zen and the Art of > Motorcycle Maintenance". a very good read, that. > [EMAIL PROTECTED] (will trillich) wrote: > >okay, here was the problem. > > > >package My::Debacle; > > > >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. > >, keys %$arg > >) > >; > ># > >} > ># > >} > > > >sub this { # ... > >} > >sub that { # ... > >} > >sub something_else { # ... > >} > >sub whatever_the_hell { # ... > >} > >sub handler { # ... > >} with 'and' *{$My::Debacle::{handler}}{CODE} doesn't exist. i've got a similar snag in a different module, now, where defined subs are disappearing. but i can't trace it to a stray 'and' here... must be something deeper? -- [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain!
Re: mod_perl subs defined, but don't exist? SOLVED mostly
I can't follow this test case. Your previous message had a test case, but it was way too big. Can you whittle this down into the smallest possible program that demonstrates something you don't understand, and post that? My guess is that you'll figure out the problem in the process, but if not, post it here. By the way, I don't think you mean $My::Debacle::handler{CODE}. If you look closely, you'll see that it's just a regular hash entry. I think you mean *{$My::Debacle::{handler}}{CODE}. That's the CODE component of a symbol table entry. If you have "Effective Perl Programming", look on page 239. I know this stuff is hard to spot when you've been banging your head against it for days. For that, I recommend "Zen and the Art of Motorcycle Maintenance". [EMAIL PROTECTED] (will trillich) wrote: >okay, here was the problem. > >package My::Debacle; > >sub search { ># >{ >use CGI qw/:standard/; >my $form = join '', >map { >hidden( >-name => $_, >-value => $arg->{$_}, >) . "\n" >} >grep( >$arg->{$_} and ($_ ne 'd') and ($_ ne 'go') >, keys %$arg >) >; ># >} ># >} > >sub this { # ... >} >sub that { # ... >} >sub something_else { # ... >} >sub whatever_the_hell { # ... >} >sub handler { # ... >} > >can you spot the problem? > >with that, poof! $My::Debacle::handler{CODE} doesn't exist. >WHY? > >-- >[EMAIL PROTECTED] >http://sourceforge.net/projects/newbiedoc -- we need your brain! >http://www.dontUthink.com/ -- your brain needs us! > ------ Ken Williams Last Bastion of Euclidity [EMAIL PROTECTED]The Math Forum
Re: mod_perl subs defined, but don't exist? SOLVED mostly
On Thu, May 03, 2001 at 01:19:45AM -0500, will trillich wrote: > On Thu, May 03, 2001 at 12:29:53AM -0500, will trillich wrote: > > long version-- > > > > I have a subroutine that IS DEFINED, but it's not showing up as > > defined. I used the *Symbol::Table::name{CODE} method myself and > > sure enough, there's no CODE for the defined subroutine... > > [snip] > > > ANY wild-ass guesses would be appreciated. (Do i win a prize for > > the most difficulty with a simple situation? Or at least an > > honorable mention for most belligerent refusal to move on and get > > a life?) > > > > ### > > > > short version-- > > > > WTF? > > how can a defined subroutine NOT have any code in the symbol > table? grr! this is quite a puzzle... okay, here was the problem. package My::Debacle; sub search { # { use CGI qw/:standard/; my $form = join '', map { hidden( -name => $_, -value => $arg->{$_}, ) . "\n" } grep( $arg->{$_} and ($_ ne 'd') and ($_ ne 'go') , keys %$arg ) ; # } # } sub this { # ... } sub that { # ... } sub something_else { # ... } sub whatever_the_hell { # ... } sub handler { # ... } can you spot the problem? with that, poof! $My::Debacle::handler{CODE} doesn't exist. WHY? -- [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!