CGI-Application-Plugin-AnyCGI

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/AnyCGI.pm  view on Meta::CPAN

    }
    
}   # --- end sub new ---


#-------------------------------------------------------------------
#                  + + + + + PRIVATE + + + + + 
#-------------------------------------------------------------------

=pod

=head1 DEBUGGING

This module provides some internal debugging. Any debug messages go to 
STDOUT, so beware of enabling debugging when running in a web 
environment. (This will end up with "Internal Server Error"s in most
cases.)

There are two ways to enable the debug mode:

=over 4

=item In the module

Find line

    $CGI::Application::Plugin::AnyCGI::DEBUG = 0;

and set it to any "true" value. ("1", "TRUE", ... )

=item From outside the module

Add this line B<before> calling C<new>:

    $CGI::Application::Plugin::AnyCGI::DEBUG = 1;

=back

=cut

#-------------------------------------------------------------------
# METHOD:     _debug
# + author:   Bianka Martinovic
# + reviewed: 07-11-14 Bianka Martinovic
# + purpose:  print out formatted _debug messages
#-------------------------------------------------------------------
sub _debug {
    my $self = shift;
    my $msg  = shift;
    
    my $dump;
    if ( @_ ) {
        if ( scalar ( @_ ) % 2 == 2 ) {
            %{ $dump } = ( @_ );
        }
        else {
            $dump = \@_;
        }
    }
    
    my ( $package, $line, $sub ) = (caller())[0,2,3];
    my ( $callerpackage, $callerline, $callersub ) 
        = (caller(1))[0,2,3]; 
    
    $sub ||= '-';
    
    print "\n",
          join( ' | ', $package, $line, $sub ),
          "\n\tcaller: ",
          join( ' | ', $callerpackage, $callerline, $callersub ),
          "\n\t$msg",
          "\n\n";
    
    #if ( $dump ) {
    #    print $self->_dump( $dump );
    #}
    
    return;
}   # --- end sub _debug ---

#-------------------------------------------------------------------
# METHOD:     AUTOLOAD
# + author:   Bianka Martinovic
# + reviewed: Bianka Martinovic
# + purpose:  autoloading methods missing in the current CGI module 
#             by using CGI.pm
#-------------------------------------------------------------------
sub AUTOLOAD {
    my $self = shift;
    my ($method) = $AUTOLOAD =~ /^.*::(.*)$/;
    return if ( $method =~ /^DESTROY$/ );
    no strict 'refs';
    eval "use CGI qw/$method/";
    &$method(@_);
}   # --- end sub AUTOLOAD ---

1;

__END__


=pod

=head1 PREREQUISITES

None.

While this plugin is made for use with 
L<CGI::Application|CGI::Application>, it should also work without it,
so you should be able to use it with any other application you wish to
be "CGI.pm independent".


=head1 AUTHOR

Bianka Martinovic, C< <<mab at cpan.org>> >

=head1 BUGS

Please report any bugs or feature requests to
C<bug-cgi-application-plugin-anycgi at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-AnyCGI>.
I will be notified, and then you'll automatically be notified of progress on



( run in 2.269 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )