line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::YUI2::Loader; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
98002
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
823
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw( Template::Plugin ); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
2202
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
8042
|
use Template::Exception; |
|
2
|
|
|
|
|
4505
|
|
|
2
|
|
|
|
|
87
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Template::Plugin::YUI2::Loader - dependency management with YUI's loader util |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.02 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
68
|
use 5.006; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1085
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module aims to ease the use of YUI's loader utility by providing means to collect the names of the YUI2 components to be loaded and the code to be run once those components have been successfully loaded anywhere in a nested template structure. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# in a template A.tt : |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
... |
31
|
|
|
|
|
|
|
[% USE loader = YUI2.Loader; |
32
|
|
|
|
|
|
|
CALL loader.components( 'calendar', 'dragdrop' ).on_success( some_js_code ); |
33
|
|
|
|
|
|
|
%] |
34
|
|
|
|
|
|
|
... |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# in a template wrapper.tt : |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
... |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
... |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
[% # presumably quite late in the body insert the loader |
45
|
|
|
|
|
|
|
USE loader = YUI2.Loader; |
46
|
|
|
|
|
|
|
%] |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|