You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by bruce <be...@earthlink.net> on 2005/05/11 21:04:39 UTC

[users@httpd] trying to debug a mod_perl app

hi...

i hope this is the right place to turn to!!

i have mod_perl installed on an apache1.3.33/mod_perl1.29/FC3 setup.

i'm trying to track down how i can print something from a '.pm' file that's
used with an apache app that i'm testing...

my perl skill is enough to get me in trouble!!

here's the situation:

i have an application (livejournal) that uses a file, BML.pm. I'm trying to
print out information from within the file to the error_log file. I can
accomplish this via a 'print STDERR foo' in other '.bml' files that are used
by the application. the '.bml' files appear to be pretty much perl files.

the BML.pm file appears to be used by apache at startup, as when i mv the
file, apache doesn't start, so i know the file is used. 

a portion of the BML.pm file is listed below.

i've searched (am searching) google to try to get a feel for what i need to
do to be able to print something from the file to the STDERR/error_log.
right now, i'm stumped/confused!!! 

if the file is required by apache, does that imply that apache
runs/interprets the file during startup? if this is the case, doesn't this
also imply that i should be able to do an initial print/debug statement at
the beginning of the file to get something to show up in the error_log file.

or, is it possible that the file is required by apache to start, but isn't
used???

my current delimma is that i can't figure out a way to print anything from
the BML.pm file to the error_log file..

arrggghhh!!! 

thanks

-bruce
bedouglas@earthlink.net

ps. i tried to talk with a few of the guys on the livejournal forums.. not
much help!!

portion of the bml.pm listing...
#!/usr/bin/perl
#
print STDERR "bdouglas bml top....\n";

use strict;

package BML::Request;

use fields qw(
	      env blockref lang r blockflags BlockStack
	      file scratch IncludeOpen content_type clean_package package
	      filechanged scheme scheme_file IncludeStack etag location
	      most_recent_mod stop_flag want_last_modified cookies
	      );


package Apache::BML;
print STDERR "bdouglas bml nnnnnnnnnnnnn....\n";

use Apache::Constants qw(:common REDIRECT HTTP_NOT_MODIFIED);
use Apache::File ();
use Apache::URI;
use Digest::MD5;
use File::Spec;
BEGIN {
print STDERR "bdouglas bml 555555555555555555....\n";
    $Apache::BML::HAVE_ZLIB = eval "use Compress::Zlib (); 1;";
}

# set per request:
use vars qw($cur_req);
use vars qw(%CodeBlockOpts);
# scalar hashrefs of versions below, minus the domain part:
my ($SchemeData, $SchemeFlags); 

# keyed by domain:
my $ML_SCOPE;              # generally the $r->uri, auto set on each request
(unless overridden)
my (%SchemeData, %SchemeFlags); # domain -> scheme -> key -> scalars (data
has {s} blocks expanded)

# safely global:
use vars qw(%FileModTime %LookItems);  # LookItems: file -> template -> [
data, flags ]
use vars qw(%LookParent);  # file -> parent file
use vars qw(%LookChild);   # file -> child -> 1

my (%CodeBlockMade);

use vars qw($conf_pl $conf_pl_look);  # hashref, made empty before loading a
.pl conf file
my %DenyConfig;      # filename -> 1
my %FileConfig;      # filename -> hashref
my %FileLastStat;    # filename -> time we last looked at its modtime

use vars qw($base_recent_mod); 

# the request we're handling (Apache->request).  using this way
# instead of just using Apache->request because when using
# Apache::FakeRequest and non-mod_perl env, I can't seem to get/set
# the value of Apache->request
use vars qw($r);

# regexps to match open and close tokens. (but old syntax (=..=) is
deprecated)
my ($TokenOpen, $TokenClose) = ('<\?', '\?>');

tie %BML::ML, 'BML::ML';
tie %BML::COOKIE, 'BML::Cookie';

print STDERR "bdouglas 1111111111 -bml\n";

sub handler
{
       $r->log_error( "bdouglas 111111111123 -bml\n");

    my $r = shift;
    my $file;

    $Apache::BML::r = $r;

    '
    '
    '
}

.
.
.
-------------------------------------------




Re: [users@httpd] trying to debug a mod_perl app

Posted by Jim Albert <ji...@netrition.com>.
I notice your BML.pm is composed of several packages. I see at least 
BML::Request and Apache::BML and maybe some others in whatever you've 
truncated.

I guess I'd suggest tracking down where exactly your BML.pm file is used 
by either some apache configuration file or some mod_perl or cgi 
application and what packages from it are used.


bruce wrote:

> hi...
> 
> i hope this is the right place to turn to!!
> 
> i have mod_perl installed on an apache1.3.33/mod_perl1.29/FC3 setup.
> 
> i'm trying to track down how i can print something from a '.pm' file that's
> used with an apache app that i'm testing...
> 
> my perl skill is enough to get me in trouble!!
> 
> here's the situation:
> 
> i have an application (livejournal) that uses a file, BML.pm. I'm trying to
> print out information from within the file to the error_log file. I can
> accomplish this via a 'print STDERR foo' in other '.bml' files that are used
> by the application. the '.bml' files appear to be pretty much perl files.
> 
> the BML.pm file appears to be used by apache at startup, as when i mv the
> file, apache doesn't start, so i know the file is used. 
> 
> a portion of the BML.pm file is listed below.
> 
> i've searched (am searching) google to try to get a feel for what i need to
> do to be able to print something from the file to the STDERR/error_log.
> right now, i'm stumped/confused!!! 
> 
> if the file is required by apache, does that imply that apache
> runs/interprets the file during startup? if this is the case, doesn't this
> also imply that i should be able to do an initial print/debug statement at
> the beginning of the file to get something to show up in the error_log file.
> 
> or, is it possible that the file is required by apache to start, but isn't
> used???
> 
> my current delimma is that i can't figure out a way to print anything from
> the BML.pm file to the error_log file..
> 
> arrggghhh!!! 
> 
> thanks
> 
> -bruce
> bedouglas@earthlink.net
> 
> ps. i tried to talk with a few of the guys on the livejournal forums.. not
> much help!!
> 
> portion of the bml.pm listing...
> #!/usr/bin/perl
> #
> print STDERR "bdouglas bml top....\n";
> 
> use strict;
> 
> package BML::Request;
> 
> use fields qw(
> 	      env blockref lang r blockflags BlockStack
> 	      file scratch IncludeOpen content_type clean_package package
> 	      filechanged scheme scheme_file IncludeStack etag location
> 	      most_recent_mod stop_flag want_last_modified cookies
> 	      );
> 
> 
> package Apache::BML;
> print STDERR "bdouglas bml nnnnnnnnnnnnn....\n";
> 
> use Apache::Constants qw(:common REDIRECT HTTP_NOT_MODIFIED);
> use Apache::File ();
> use Apache::URI;
> use Digest::MD5;
> use File::Spec;
> BEGIN {
> print STDERR "bdouglas bml 555555555555555555....\n";
>     $Apache::BML::HAVE_ZLIB = eval "use Compress::Zlib (); 1;";
> }
> 
> # set per request:
> use vars qw($cur_req);
> use vars qw(%CodeBlockOpts);
> # scalar hashrefs of versions below, minus the domain part:
> my ($SchemeData, $SchemeFlags); 
> 
> # keyed by domain:
> my $ML_SCOPE;              # generally the $r->uri, auto set on each request
> (unless overridden)
> my (%SchemeData, %SchemeFlags); # domain -> scheme -> key -> scalars (data
> has {s} blocks expanded)
> 
> # safely global:
> use vars qw(%FileModTime %LookItems);  # LookItems: file -> template -> [
> data, flags ]
> use vars qw(%LookParent);  # file -> parent file
> use vars qw(%LookChild);   # file -> child -> 1
> 
> my (%CodeBlockMade);
> 
> use vars qw($conf_pl $conf_pl_look);  # hashref, made empty before loading a
> .pl conf file
> my %DenyConfig;      # filename -> 1
> my %FileConfig;      # filename -> hashref
> my %FileLastStat;    # filename -> time we last looked at its modtime
> 
> use vars qw($base_recent_mod); 
> 
> # the request we're handling (Apache->request).  using this way
> # instead of just using Apache->request because when using
> # Apache::FakeRequest and non-mod_perl env, I can't seem to get/set
> # the value of Apache->request
> use vars qw($r);
> 
> # regexps to match open and close tokens. (but old syntax (=..=) is
> deprecated)
> my ($TokenOpen, $TokenClose) = ('<\?', '\?>');
> 
> tie %BML::ML, 'BML::ML';
> tie %BML::COOKIE, 'BML::Cookie';
> 
> print STDERR "bdouglas 1111111111 -bml\n";
> 
> sub handler
> {
>        $r->log_error( "bdouglas 111111111123 -bml\n");
> 
>     my $r = shift;
>     my $file;
> 
>     $Apache::BML::r = $r;
> 
>     '
>     '
>     '
> }
> 
> .
> .
> .
> -------------------------------------------
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


-- 
Jim Albert


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org