You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/01/18 09:56:37 UTC

[mp2] adding mp2method, mp2module, mp2object utils

[Looks like this suggestion was lost in the sea of messages in that long 
Apache:: terminator thread. splinning it off as a new thread]

 >> or do you think it's OK the way things are right now? The manpage
 >> suggests to use
 >> http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html to figure
 >> what needs to be loaded, but it's not so intuitive.
 >
 > MethodLookup is really sweet, but it's not intuitive that you need a
 > separate module to tell you what to load.

Not a module but a command line run. Actually, since we already have mp2bug 
and mp2doc utils. I'm thinking to make ModPerl/MethodLookup more intuitive and 
add 3 more utils: mp2method, mp2module, mp2object to perform the equivalent of:

   % perl -MApache2 -MModPerl::MethodLookup -e print_method
   % perl -MApache2 -MModPerl::MethodLookup -e print_module
   % perl -MApache2 -MModPerl::MethodLookup -e print_object

just like we have the cpan utility vs.

   % perl -MCPAN -eshell

This will make it much more accessible/useful. once you install mp2 and if you 
want to use a method server_root() but you don't know which module you need to 
load you will run:

   % mp2method server_root_relative
To use method 'server_root_relative' add:
         use Apache::ServerUtil ();

then you wonder what other methods Apache::ServerUtil loads, so you run:

   % mp2module Apache::ServerUtil

Module 'Apache::ServerUtil' contains the following XS methods:

Method                Invoked on object type
-----------------------------------------------------------------
add_config            Apache::Server
add_version_component Apache
dir_config            Apache::Server
error_log2stderr      Apache::Server
exists_config_define  Apache
get_handlers          Apache::Server
get_server_built      Apache
get_server_version    Apache
psignature            Apache::RequestRec
push_handlers         Apache::Server
server                Apache
server_root_relative  Apache
set_handlers          Apache::Server
-----------------------------------------------------------------

Finally you are interested what methods can be invoked on the object blessed 
into Apache::Filter and which modules need to be loaded in order to use them:

   % mp2object Apache::Filter

Objects of type 'Apache::Filter' can invoke the following XS methods:

Method               Module
------------------------------------------------
PRINT                Apache::Filter
TIEHANDLE            Apache::Filter
c                    Apache::Filter
ctx                  Apache::Filter
fflush               Apache::Filter
fputs                Apache::Filter
frec                 Apache::Filter
get_brigade          Apache::Filter
next                 Apache::Filter
pass_brigade         Apache::Filter
print                Apache::Filter
r                    Apache::Filter
read                 Apache::Filter
remove               Apache::Filter
remove_input_filter  Apache::Filter
remove_output_filter Apache::Filter
seen_eos             Apache::Filter
------------------------------------------------

each of these scripts is just:

   #!/usr/bin/perl
   # mp2method
   use Apache2; use ModPerl::MethodLookup; print_method(@ARGV);

   #!/usr/bin/perl
   # mp2module
   use Apache2; use ModPerl::MethodLookup; print_module(@ARGV);

   #!/usr/bin/perl
   # mp2object
   use Apache2; use ModPerl::MethodLookup; print_object(@ARGV);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org