JQuery::Taconite - an Ajax interface


JQuery documentation Contained in the JQuery distribution.

Index


Code Index:

NAME

Top

JQuery::Taconite - an Ajax interface

VERSION

Top

Version 1.00

SYNOPSIS

Top

Taconite installs the taconite javascript and doesn't do much else

    use JQuery;
    use JQuery::Taconite;

    $jquery = new JQuery(...) ; 
    JQuery::Taconite->new(addToJQuery => $jquery) ; 
    JQuery::Form->new(id => 'myForm', addToJQuery => $jquery) ; 




If used without a form:

    $jquery = new JQuery(...) ; 
    JQuery::Taconite->new(id => 'ex6', remoteProgram => '/cgi-bin/program_to_run.pl', rm => 'reply', addToJQuery => $jquery); 




FUNCTIONS

Top

new

Instantiate the object

debug

Set to 1 to enable debugging. You can see the results in Firebug.

AUTHOR

Top

Peter Gordon, <peter at pg-consultants.com>

BUGS

Top

Please report any bugs or feature requests to bug-jquery-taconite at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JQuery. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc JQuery

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/JQuery

* CPAN Ratings

http://cpanratings.perl.org/d/JQuery

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=JQuery

* Search CPAN

http://search.cpan.org/dist/JQuery

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


JQuery documentation Contained in the JQuery distribution.
package JQuery::Taconite;

our $VERSION = '1.00';

use warnings;
use strict;

sub new { 
    my $this = shift;
    my $class = ref($this) || $this;
    my $my ;
    %{$my->{param}} = @_ ; 
#    die "No id defined for Taconite" unless $my->{param}{id} =~ /\S/ ; 
#    die "No remote program defined for Taconite" unless $my->{param}{remoteProgram} =~ /\S/ ; 

    bless $my, $class;

    if ($my->{param}{css}) { 
	push @{$my->{css}},$my->{param}{css} ; 
    } 

    $my->{param}{debug} = 0 unless defined $my->{param}{debug} ; 
    $my->add_to_jquery ; 
    return $my ;
}

sub add_to_jquery { 
    my $my = shift ; 
    my $jquery = $my->{param}{addToJQuery} ; 
    if (defined $jquery) { 
	$jquery->add($my) ; 
    } 
} 

sub id {
    my $my = shift ;
    return $my->{param}{id} ; 
}


sub packages_needed { 
    my $my = shift ;
    return ('taconite/jquery.taconite.js') ; 
} 


sub get_jquery_code { 
    my $my = shift ; 
    my $id = $my->id ; 
    my $remoteProgram = $my->{param}{remoteProgram} ; 
    return '' unless $id =~ /\S/ ; 
    my $runMode = '' ; 
    if (defined $my->{param}{rm}) { 
	$runMode = qq[rm: "$my->{param}{rm}", ] ; 
    }
    
    my $function =<<'EOD';
DEBUG
$('#ID').click(function() { 
    $.post("PROGRAM_TO_RUN", { RUNMODE ts: new Date().getTime()} ); 
    });
EOD
    if ( $my->{param}{debug} ) { 
	$function =~ s!DEBUG!$.taconite.debug = true;! ;
    } else { 
	$function =~ s!DEBUG!! ;
    } 
    $function =~ s/ID/$id/ ; 
    $function =~ s/PROGRAM_TO_RUN/$remoteProgram/ ; 
    $function =~ s/RUNMODE/$runMode/ ; 
    return $function ; 
}
1;

1; # End of JQuery::Taconite