1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
package Resource::Pack::jQuery;
use Moose;
use Resource::Pack;
extends 'Resource::Pack::Resource';
=head1 NAME
Resource::Pack::jQuery - Resource::Pack resource for the jQuery Javascript library
=head1 SYNOPSIS
my $resource = Resource::Pack::jQuery->new(
install_to => '/var/www/js',
version => '1.4.2',
);
$resource->install;
=head1 DESCRIPTION
This provides the jQuery library as a L<Resource::Pack> resource.
=cut
=head1 ATTRIBUTES
=cut
=head2 version
The desired jQuery version. Required, if C<use_bundled> is false.
=cut
has version => (
is => 'ro',
isa => 'Str',
);
=head2 minified
Whether or not the Javascript should be minified. Defaults to true.
=cut
has minified => (
is => 'ro',
isa => 'Bool',
default => 1,
);
=head2 use_bundled
If true, uses the bundled copy of jquery-1.4.2.min.js that is shipped with
this dist (and ignores the other attributes). Otherwise, uses the values of
C<version> and C<minified> to download a copy of the library from
L<http://code.jquery.com/>.
=cut
has use_bundled => (
is => 'ro',
isa => 'Bool',
default => 0,
);
has '+name' => (default => 'jquery');
sub _jquery_url {
my $self = shift;
return 'http://code.jquery.com/jquery-'
. $self->version
. ($self->minified ? '.min' : '')
. '.js';
}
sub BUILD {
my $self = shift;
if (!defined($self->version) && !$self->use_bundled) {
confess "version must be specified if use_bundled is false";
}
resource $self => as {
install_from(Path::Class::Dir->new(__FILE__)->parent);
if ($self->use_bundled) {
file js => 'jquery-1.4.2.min.js';
}
else {
url js => $self->_jquery_url;
}
};
}
__PACKAGE__->meta->make_immutable;
no Moose;
no Resource::Pack;
=head1 BUGS
No known bugs.
Please report any bugs through RT: email
C<bug-resource-pack-jquery at rt.cpan.org>, or browse to
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Resource-Pack-jQuery>.
=head1 SEE ALSO
L<Resource::Pack>
L<http://jquery.com/>
=head1 SUPPORT
You can find this documentation for this module with the perldoc command.
perldoc Resource::Pack::jQuery
You can also look for information at:
=over 4
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Resource-Pack-jQuery>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Resource-Pack-jQuery>
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Resource-Pack-jQuery>
=item * Search CPAN
L<http://search.cpan.org/dist/Resource-Pack-jQuery>
=back
=head1 AUTHOR
Jesse Luehrs <doy at tozt dot net>
John Resig is the author of jQuery
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.
The bundled copy of jQuery is copyright (c) 2010 The jQuery Project.
It is licensed under either the MIT license or the GPLv2.
=cut
1;
|