JavaScript::DebugConsole - Perl extension to generate JavaScript popups with custom text and typical web development useful informations



NAME

JavaScript::DebugConsole - Perl extension to generate JavaScript popups with custom text and typical web development useful informations


SYNOPSIS

   use JavaScript::DebugConsole;
   my $jdc = new JavaScript::DebugConsole;
   $jdc->add('Some', 'text');
   print $jdc->debugConsole();


DESCRIPTION

I packaged some my old and simple functions inside a Perl module (I was tired to do cut&paste each time :-) ) to generate the necessary JavaScript code in order to open a popup window with custom text and typical web development useful infos (like form params, environment variables, HTTP headers and so on).


INSTALLATION

In order to install and use this package you will need Perl version 5.005 or higher.

Installation as usual:

   % perl Makefile.PL
   % make
   % make test
   % su
     Password: *******
   % make install


DEPENDENCIES

No thirdy-part modules are required.


CONSTRUCTOR


METHODS


INTEGRATING IN Template Toolkit

During initial development, Sam Vilain asked me to include also a Template::Plugin::JS::DebugConsole plugin in order to use this class in Template Toolkit environment.

Since the wrapper wouldn't have added nothing of special, I used successfully Template::Plugin::Class plugin, by avoiding to write e new one at the cost of one line only of additional code:

   [% USE c = Class('JavaScript::DebugConsole') %]
   [% jdc = c.new %]
   [% jdc.debugConsole( content => "Popup text",
                        title => "Debug title", auto_open => 0 ) %]
   <p>Click <a href="[% jdc.link %]">here</a> to open the console!</p>

Following code use CGI plugin in order to print also CGI form params:

   [% USE q = CGI %]
   [% USE c = Class('JavaScript::DebugConsole') %]
   [% jdc = c.new %]
   [% jdc.debugConsole( content => "Popup text", title => "Debug title", 
                        auto_open => 1, form => q ) %]


EXAMPLES

   #!/usr/local/bin/perl
   use JavaScript::DebugConsole;
   use CGI qw/:standard/;
   my $q = new CGI;
   print header;
   
   # create new object
   my $jdc = new JavaScript::DebugConsole;
   print $jdc->debugConsole( content => 'My debug infos', title => 'Debug Test', 
                             auto_open => 0, form => $q );
   print '<a href="' . $jdc->link . '">Open the console!</A>';


BUGS

Please submit bugs to CPAN RT system at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JavaScript-DebugConsole or by email at bug-javascript-debugconsole@rt.cpan.org

Patches are welcome and I'll update the module if any problems will be found.


VERSION

Version 0.01


SEE ALSO

perl


AUTHOR

Enrico Sorcinelli, <enrico at sorcinelli.it>


COPYRIGHT AND LICENSE

Copyright (C) 2004 by Enrico Sorcinelli

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.