File Coverage

lib/Egg/Plugin/Prototype.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Egg::Plugin::Prototype;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: Prototype.pm 337 2008-05-14 12:30:09Z lushe $
6             #
7 1     1   537 use strict;
  1         2  
  1         48  
8 1     1   8 use warnings;
  1         3  
  1         37  
9 1     1   6 use base 'Class::Data::Inheritable';
  1         3  
  1         111  
10 1     1   176811 use HTML::Prototype;
  1         59738  
  1         140  
11              
12             our $VERSION = '3.00';
13              
14             __PACKAGE__->mk_classdata('prototype');
15             eval { require HTML::Prototype::Useful; };
16              
17             if ( $@ ) {
18             __PACKAGE__->prototype( HTML::Prototype->new );
19             } else {
20             __PACKAGE__->prototype( HTML::Prototype::Useful->new );
21             }
22              
23             1;
24              
25             __END__
26              
27             =head1 NAME
28              
29             Egg::Plugin::Prototype - Plugin for Prototype
30              
31             =head1 SYNOPSIS
32              
33             # use it
34             use Egg qw/ Prototype /;
35              
36             # ...add this to your mason template...
37             <% $e->prototype->define_javascript_functions %>
38              
39             # ...and use the helper methods...
40             <div id="view"></div>
41             <textarea id="editor" cols="80" rows="24"></textarea>
42             % my $uri = $e->config->{static_uri}. 'edit/'. $e->page_title;
43             <% $e->prototype->observe_field( 'editor', $uri, { 'update' => 'view' } ) %>
44              
45             =head1 DESCRIPTION
46              
47             Some stuff to make Prototype fun.
48              
49             This plugin replaces L<Egg::Helper::Plugin::Prototype>.
50              
51             =head1 METHODS
52              
53             =head2 prototype
54              
55             Returns a ready to use L<HTML::Prototype> object.
56              
57             =head1 SEE ALSO
58              
59             L<Egg::Release>,
60             L<Egg::Helper::Plugin::Prototype>,
61             L<Catalyst::Plugin::Prototype>,
62              
63             =head1 AUTHOR
64              
65             This code is a transplant of 'Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>'
66             of the code of 'L<Catalyst::Plugin::Prototype>'.
67              
68             Therefore, the copyright of this code is assumed to be the one that belongs
69             to 'Sebastian Riedel, C<sri@oook.de>'.
70              
71             =head1 LICENSE
72              
73             This library is free software . You can redistribute it and/or modify it under
74             the same terms as perl itself.
75              
76             =cut
77