%# -*- mode: html-helper; mmm-classes: mason; -*- request examiner

Mason page request examiner

This simple Mason page examines the mod_perl 2 $r object passed to every Mason page. The first object shown is the actual $r passed. In mod_perl 2 there are two 'request objects':

Please refer to the mod perl 2 documentation for further information.

<%perl> my $disp = '$r'; my $name = sprintf( "%s", $r ); $name =~ s/=.*//; my @methods = $m->comp( '.probe_methods', $name ); $m->comp( '.display', $disp, $name, @methods ); my $rr; if( $name eq 'Apache::RequestRec' ) { $disp = 'Apache::Request->new( $r );'; $rr = Apache::Request->new( $r ); } else { $disp = 'Apache->request;'; $rr = Apache->request; } $name = sprintf( "%s", $rr ); $name =~ s/=.*//; @methods = $m->comp( '.probe_methods', $name ); $m->comp( '.display', $disp, $name, @methods );
Beau E. Cox <beau@beaucox.com>
Last modified: Tue Apr 13 08:33:53 HST 2004 <%def .probe_methods> <%perl> my $name = shift; my @methods = (); my $probe_method_string = 'for my $symname( sort keys %'.$name.':: ) {'. ' local *sym = $'.$name.'::{$symname};'. ' push @methods, $symname if defined &sym;'. '};'; eval $probe_method_string; Carp::croak( "error probing methods: $@" ) if $@; return @methods; <%def .display> % my( $disp, $name, @methods ) = @_;

<% $disp %>

is a <% $name %>.

The following methods are in this interface: % push @methods, ' ' while @methods % 6; % for( my $row = 0; $row < @methods / 6; $row++ ) { % for( my $col = 0; $col < 6; $col++ ) { % } % }
<% $methods[$row+$col*@methods/6] %>