FAQ
Hi all,

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, env vars, HTTP headers and so on).

For example:

my $jdc = new JavaScript::DebugConsole( %args );
$js_code_to_put_in_html_page = $jdc->debugConsole(
content => $content,
title => $title',
auto_open => 1 );
$link_to_open_popup = $jdc->link;

(There are also other methods and properties).

Of course before coding, I've searched similar modules over CPAN with no
significant results.
So, I'm considering to put it on CPAN. It will be useful? It is a good name?
Maybe CGI::JavaScript::DebugConsole, JavaScript::Popup*, JavaScript::*, [...]
sounds better?

Any suggestions and/or criticisms are welcome.

Thanks in advance.

by

- Enrico

Search Discussions

  • Jason scott gessner at May 5, 2004 at 2:31 pm
    HTTP::Recorder has a console feature that you may want to check out as
    well. I know that Linda hasn't made it a separate module, but the two
    of you may have an interesting possibility to combine features.

    -jason scott gessner
    jason@multiply.org
    On May 5, 2004, at 9:23 AM, Enrico Sorcinelli wrote:

    Hi all,

    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, env vars, HTTP headers and so on).

    For example:

    my $jdc = new JavaScript::DebugConsole( %args );
    $js_code_to_put_in_html_page = $jdc->debugConsole(
    content => $content,
    title => $title',
    auto_open => 1 );
    $link_to_open_popup = $jdc->link;

    (There are also other methods and properties).

    Of course before coding, I've searched similar modules over CPAN with
    no
    significant results.
    So, I'm considering to put it on CPAN. It will be useful? It is a good
    name?
    Maybe CGI::JavaScript::DebugConsole, JavaScript::Popup*,
    JavaScript::*, [...]
    sounds better?

    Any suggestions and/or criticisms are welcome.

    Thanks in advance.

    by

    - Enrico
  • Enrico Sorcinelli at May 10, 2004 at 4:21 pm

    On Wed, 5 May 2004 09:30:10 -0500 jason scott gessner wrote: Hi Jason,
    HTTP::Recorder has a console feature that you may want to check out as
    well. I know that Linda hasn't made it a separate module, but the two
    of you may have an interesting possibility to combine features.
    Thanks for the notice.

    I will look closely last HTTP::Recorder developer release asap even if it seems
    that his simple popup function is too tied to HTTP::Recorder.

    by

    - Enrico
  • Enrico Sorcinelli at May 10, 2004 at 4:28 pm
    On Thu, 6 May 2004 11:59:45 +1200 wrote:
    Hi Sam,
    On Wed, May 05, 2004 at 04:23:41PM +0200, Enrico Sorcinelli wrote:

    For example:
    my $jdc = new JavaScript::DebugConsole( %args );
    $js_code_to_put_in_html_page = $jdc->debugConsole(
    content => $content,
    title => $title',
    auto_open => 1 );
    $link_to_open_popup = $jdc->link;
    Sounds like a good name to me.

    Make sure you include a Template::Plugin::JS::DebugConsole;

    package Template::Plugin::JS::DebugConsole;
    use JavaScript::DebugConsole;
    use base qw(Template::Plugin);
    use Carp qw(croak);
    sub new {
    my $class = shift;
    my $context = shift;

    bless { dc => new JavaScript::DebugConsole( @_ ) },
    $class
    }
    our $AUTOLOAD;
    sub AUTOLOAD {
    my $self = shift;
    $AUTOLOAD =~ /([^:]*)$/;
    if (my $sub = $self->{dc}->can($1)) {
    unshift @_, $self;
    goto $sub;
    } else {
    croak "unknown method $1";
    }
    }
    1;

    Assuming that 5 minute module works, the usage would be something
    like:

    [% USE cons = JS::DebugConsole %]
    <html>
    <body>
    [% cons.debugConsole( "title", "Some Title" ) %]
    <p>Click <a href="[% cons.link %]">here</a> to open the
    console!</p>
    </body>
    </html>

    And that would be pretty handy.
    Since using Template::Plugin::Class, the following 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>

    seems to be equivalent to your, I wouldn't add another module... :-)

    However I'll add a paragraph in the docs about class usage with TT2.

    Many thanks for your suggestion.

    by

    - Enrico

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodule-authors @
categoriesperl
postedMay 5, '04 at 2:24p
activeMay 10, '04 at 4:28p
posts4
users2
websitecpan.org...

People

Translate

site design / logo © 2021 Grokbase