mod_perl subs defined, but DON'T EXIST? wtf?!

2001-05-02 Thread will trillich

long version--

okay, i'm confused, and this time it's not related to cookies.
it happens to be the same bloinkin' project, but this time it's
perl in general, that's got me baffled...

if have a subroutine that's 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...

here's my debug snippet, in context--

###

package My::Access;
# File: My/Access.pm

use strict;
use Apache::Constants qw(OK SERVER_ERROR);
use Apache::TicketTool;
use Apache::Log;

sub handler {
my $r = shift;

{
no strict;
# see camel book, page 282
my $x = '';
my @key = qw(
SCALAR ARRAY HASH
CODE FILEHANDLE
);  # ignore GLOB, PACKAGE, NAME
foreach my $item ( sort keys %My::Access:: ) {
my $descr = '';
foreach ( @key ) {
$descr .= \t$_\n
if defined( *{$item}{$_} );
}
$x .= $item\n$descr;
}
#$r-log-debug('My::Access::handler -- ' . join '/',grep 
*{$_}{CODE},sort keys %My::Access::);
$r-log-debug(My::Access::handler -- \n$x);
}

if ( needs_login($r) ) {

if ( logging_in($r) ) {

# currently trying to log in (user/password supplied)
$r-log-debug('My::Access::handler logging in 
(PerlHandler=checkUser())');

my $h = $r-get_handlers( 'PerlHandler' );
unshift @{$h},\checkUser ; # do checkUser first
$r-set_handlers( PerlHandler = $h );

} else {

# no ticket, no username -- so ask for login
$r-log-debug('My::Access::handler needs login 
(PerlHandler=ask_login())');

$r-set_handlers( PerlHandler = [ \ask_login ] );

}
}

return OK;
}

sub logging_in { #exists, but not as code?
...
}

sub needs_login {#exists, but not as code?
...
}

sub ask_login {  #exists, but not as code?
...
}

sub make_login {# doesn't exist at all???
...
}

sub checkUser {  #exists, but not as code?
...
}

sub make_welcome {  # doesn't exist at all???
...
}

sub need_cookies {  # doesn't exist at all???
...
}

1;

__END__


###

and here's the resulting log output, which gives my mind a
temporal inversion tachyon matrix pulse*:

###

[Thu May  3 00:09:04 2001] [notice] Apache/1.3.9 configured -- resuming normal 
operations
[Thu May  3 00:09:04 2001] [notice] suEXEC mechanism enabled (wrapper: 
/usr/lib/apache/suexec)
[Thu May  3 00:09:05 2001] [debug] /usr/local/lib/site_perl/My/Access.pm(52): [client 
208.33.90.85] My::Access::handler -- 
BEGIN
SCALAR
OK
SCALAR
CODE
SERVER_ERROR
SCALAR
CODE
ask_login
SCALAR
checkUser
SCALAR
handler
SCALAR
CODE
logging_in
SCALAR
needs_login
SCALAR

[Thu May  3 00:09:05 2001] [error] Undefined subroutine My::Access::needs_login 
called at /usr/local/lib/site_perl/My/Access.pm line 55.

where's make_login? make_welcome? need_cookies? hmm? aaugh!

if it was a non-terminated string or something of that nature 1)
the perl tokenizer would object and 2) it would then be all are
screwy from line X on downward which ain't the case (checkUser
seems to show up on the radar, and it comes after make_login,
which is nowhere to be seen).

###

*star trek speak for i have no *#$! idea what's happening here.

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?

-- 
[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!



Re: mod_perl subs defined, but DON'T EXIST? wtf?!

2001-05-02 Thread will trillich

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...

my version info is as follows, in case it's germane:

$ apache -v
Server version: Apache/1.3.9 (Unix) Debian/GNU
Server built:   Apr 30 2000 12:54:24

$ cat /etc/debian_version
2.2

$ perl -MTie::DBI -MCGI::Cookie -MMD5 -MLWP::Simple \
-MApache::File -MApache::URI -MApache \
-e 'print map {s/.pm$//;s%/%::%g;$_ = .${$_.::VERSION}.\n} sort keys 
%INC'
Apache = 1.26
Apache::Connection = 1.00
Apache::Constants = 1.09
Apache::Constants::Exports = 
Apache::File = 1.01
Apache::Server = 1.01
Apache::URI = 1.00
AutoLoader = 
CGI::Cookie = 1.20
CGI::Util = 1.2
Carp = 
DBI = 1.13
Digest::MD5 = 2.09
DynaLoader = 1.03
Exporter = 
Fcntl = 1.03
HTTP::Status = 1.26
LWP::Simple = 1.34
MD5 = 2.01
Tie::DBI = 0.91
mod_perl = 1.2103
overload = 
strict = 1.01
vars = 

-- 
[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!