line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Prototype::Carousel; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Required inclusions. |
5
|
|
|
|
|
|
|
############################################################################### |
6
|
2
|
|
|
2
|
|
56093
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
82
|
|
7
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
8
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
192
|
|
9
|
2
|
|
|
2
|
|
12
|
use File::Spec; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
10
|
2
|
|
|
2
|
|
1971
|
use File::Copy qw(copy); |
|
2
|
|
|
|
|
10880
|
|
|
2
|
|
|
|
|
144
|
|
11
|
2
|
|
|
2
|
|
13
|
use File::Path qw(mkpath); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
104
|
|
12
|
2
|
|
|
2
|
|
12
|
use File::Basename qw(dirname); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
145
|
|
13
|
2
|
|
|
2
|
|
1582
|
use Alien::scriptaculous; |
|
2
|
|
|
|
|
4323
|
|
|
2
|
|
|
|
|
851
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
############################################################################### |
16
|
|
|
|
|
|
|
# Version number |
17
|
|
|
|
|
|
|
############################################################################### |
18
|
|
|
|
|
|
|
our $CAROUSEL_VERSION = '0.26'; |
19
|
|
|
|
|
|
|
our $VERSION = '0.26.3'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
############################################################################### |
22
|
|
|
|
|
|
|
# Subroutine: version() |
23
|
|
|
|
|
|
|
############################################################################### |
24
|
|
|
|
|
|
|
# Return the Prototype Carousel component version number. |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# Not to be confused with the 'Alien::Prototype::Carousel' version number |
27
|
|
|
|
|
|
|
# (which is the version number of the Perl wrapper). |
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
sub version { |
30
|
0
|
|
|
0
|
1
|
0
|
return $CAROUSEL_VERSION; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
############################################################################### |
34
|
|
|
|
|
|
|
# Subroutine: path() |
35
|
|
|
|
|
|
|
############################################################################### |
36
|
|
|
|
|
|
|
# Returns the path to the available copy of the Prototype Carousel component. |
37
|
|
|
|
|
|
|
############################################################################### |
38
|
|
|
|
|
|
|
sub path { |
39
|
3
|
|
|
3
|
1
|
10
|
my $base = $INC{'Alien/Prototype/Carousel.pm'}; |
40
|
3
|
|
|
|
|
12
|
$base =~ s{\.pm}{}; |
41
|
3
|
|
|
|
|
9
|
return $base; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
############################################################################### |
45
|
|
|
|
|
|
|
# Subroutine: to_blib() |
46
|
|
|
|
|
|
|
############################################################################### |
47
|
|
|
|
|
|
|
# Returns a hash containing paths to the source files to be copied, and their |
48
|
|
|
|
|
|
|
# relative destinations. |
49
|
|
|
|
|
|
|
############################################################################### |
50
|
|
|
|
|
|
|
sub to_blib { |
51
|
3
|
|
|
3
|
1
|
5
|
my $class = shift; |
52
|
3
|
|
|
|
|
11
|
my $path = $class->path(); |
53
|
3
|
|
|
|
|
7
|
my @files = qw( carousel.js carousel.css ); |
54
|
3
|
|
|
|
|
7
|
my %blib = map { (File::Spec->catfile($path,$_) => $_) } @files; |
|
6
|
|
|
|
|
82
|
|
55
|
3
|
|
|
|
|
15
|
return %blib; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
############################################################################### |
59
|
|
|
|
|
|
|
# Subroutine: files() |
60
|
|
|
|
|
|
|
############################################################################### |
61
|
|
|
|
|
|
|
# Returns the list of files that are installed by Alien::Prototype::Carousel. |
62
|
|
|
|
|
|
|
############################################################################### |
63
|
|
|
|
|
|
|
sub files { |
64
|
1
|
|
|
1
|
1
|
12
|
my $class = shift; |
65
|
1
|
|
|
|
|
5
|
my %blib = $class->to_blib(); |
66
|
1
|
|
|
|
|
8
|
return sort values %blib; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
############################################################################### |
70
|
|
|
|
|
|
|
# Subroutine: install($destdir) |
71
|
|
|
|
|
|
|
# Parameters: $destdir - Destination directory. |
72
|
|
|
|
|
|
|
############################################################################### |
73
|
|
|
|
|
|
|
# Installs the Prototype Carousel component into the given '$destdir'. Throws |
74
|
|
|
|
|
|
|
# a fatal exception on errors. |
75
|
|
|
|
|
|
|
############################################################################### |
76
|
|
|
|
|
|
|
sub install { |
77
|
2
|
|
|
2
|
1
|
1481
|
my ($class, $destdir) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# install script.aculo.us |
80
|
2
|
|
|
|
|
15
|
Alien::scriptaculous->install( $destdir ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# install our files |
83
|
2
|
|
|
|
|
7796
|
my %blib = $class->to_blib(); |
84
|
2
|
|
|
|
|
14
|
while (my ($srcfile, $dest) = each %blib) { |
85
|
|
|
|
|
|
|
# get full path to destination file |
86
|
4
|
|
|
|
|
645
|
my $destfile = File::Spec->catfile( $destdir, $dest ); |
87
|
|
|
|
|
|
|
# create any required install directories |
88
|
4
|
|
|
|
|
116
|
my $instdir = dirname( $destfile ); |
89
|
4
|
50
|
|
|
|
68
|
if (!-d $instdir) { |
90
|
0
|
0
|
|
|
|
0
|
mkpath( $instdir ) || croak "can't create '$instdir'; $!"; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
# install the file |
93
|
4
|
50
|
|
|
|
11
|
copy( $srcfile, $destfile ) || croak "can't copy '$srcfile' to '$instdir'; $!"; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Alien::Prototype::Carousel - installing and finding Prototype Carousel component |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SYNOPSIS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
use Alien::Prototype::Carousel; |
106
|
|
|
|
|
|
|
... |
107
|
|
|
|
|
|
|
$version = Alien::Prototype::Carousel->version(); |
108
|
|
|
|
|
|
|
$path = Alien::Prototype::Carousel->path(); |
109
|
|
|
|
|
|
|
... |
110
|
|
|
|
|
|
|
Alien::Prototype::Carousel->install( $my_destination_directory ); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 DESCRIPTION |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Please see L for the manifesto of the Alien namespace. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 METHODS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=over |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item version() |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Return the Prototype Carousel component version number. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Not to be confused with the C version number |
125
|
|
|
|
|
|
|
(which is the version number of the Perl wrapper). |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item path() |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns the path to the available copy of the Prototype Carousel component. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item to_blib() |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns a hash containing paths to the source files to be copied, and their |
134
|
|
|
|
|
|
|
relative destinations. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item files() |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns the list of files that are installed by Alien::Prototype::Carousel. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item install($destdir) |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Installs the Prototype Carousel component into the given C<$destdir>. |
143
|
|
|
|
|
|
|
Throws a fatal exception on errors. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 AUTHOR |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Graham TerMarsch (cpan@howlingfrog.com) |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 LICENSE |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Copyright (C) 2007, Graham TerMarsch. All rights reserved. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 SEE ALSO |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
http://prototype-carousel.xilinus.com/, |
160
|
|
|
|
|
|
|
L, |
161
|
|
|
|
|
|
|
L. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |