| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Lightbox; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# Required inclusions. |
|
5
|
|
|
|
|
|
|
############################################################################### |
|
6
|
2
|
|
|
2
|
|
55247
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
220
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
34
|
|
|
|
2
|
|
|
|
|
56
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
182
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use File::Spec; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
114
|
|
|
10
|
2
|
|
|
2
|
|
2032
|
use File::Copy qw(copy); |
|
|
2
|
|
|
|
|
16183
|
|
|
|
2
|
|
|
|
|
173
|
|
|
11
|
2
|
|
|
2
|
|
15
|
use File::Path qw(mkpath); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
118
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use File::Find qw(find); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
153
|
|
|
13
|
2
|
|
|
2
|
|
12
|
use File::Basename qw(basename dirname); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
172
|
|
|
14
|
2
|
|
|
2
|
|
1786
|
use Alien::scriptaculous; |
|
|
2
|
|
|
|
|
4968
|
|
|
|
2
|
|
|
|
|
1153
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
############################################################################### |
|
17
|
|
|
|
|
|
|
# Version number |
|
18
|
|
|
|
|
|
|
############################################################################### |
|
19
|
|
|
|
|
|
|
our $LIGHTBOX_VERSION = '2.03.3'; |
|
20
|
|
|
|
|
|
|
our $VERSION = '2.03.3.3'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
############################################################################### |
|
23
|
|
|
|
|
|
|
# Subroutine: version() |
|
24
|
|
|
|
|
|
|
############################################################################### |
|
25
|
|
|
|
|
|
|
# Returns the Lightbox version number. |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# Not to be confused with the 'Alien::Lightbox' version number (which is the |
|
28
|
|
|
|
|
|
|
# version number of the Perl wrapper). |
|
29
|
|
|
|
|
|
|
############################################################################### |
|
30
|
|
|
|
|
|
|
sub version { |
|
31
|
0
|
|
|
0
|
1
|
0
|
return $LIGHTBOX_VERSION; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
############################################################################### |
|
35
|
|
|
|
|
|
|
# Subroutine: path() |
|
36
|
|
|
|
|
|
|
############################################################################### |
|
37
|
|
|
|
|
|
|
# Returns the path to the available copy of Lightbox. |
|
38
|
|
|
|
|
|
|
############################################################################### |
|
39
|
|
|
|
|
|
|
sub path { |
|
40
|
3
|
|
|
3
|
1
|
10
|
my $base = $INC{'Alien/Lightbox.pm'}; |
|
41
|
3
|
|
|
|
|
18
|
$base =~ s{\.pm$}{}; |
|
42
|
3
|
|
|
|
|
8
|
return $base; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
############################################################################### |
|
46
|
|
|
|
|
|
|
# Subroutine: to_blib() |
|
47
|
|
|
|
|
|
|
############################################################################### |
|
48
|
|
|
|
|
|
|
# Returns a hash containing paths to the source files to be copied, and their |
|
49
|
|
|
|
|
|
|
# relative destinations. |
|
50
|
|
|
|
|
|
|
############################################################################### |
|
51
|
|
|
|
|
|
|
sub to_blib { |
|
52
|
3
|
|
|
3
|
1
|
8
|
my $class = shift; |
|
53
|
3
|
|
|
|
|
12
|
my $path = $class->path(); |
|
54
|
3
|
|
|
|
|
7
|
my %blib; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# JS/CSS files |
|
57
|
3
|
|
|
|
|
8
|
my @files = qw(js/lightbox.js css/lightbox.css); |
|
58
|
3
|
|
|
|
|
10
|
foreach my $file (@files) { |
|
59
|
6
|
|
|
|
|
71
|
my $src = File::Spec->catfile( $path, $file ); |
|
60
|
6
|
|
|
|
|
178
|
$blib{$src} = basename($file); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# images |
|
64
|
3
|
|
|
|
|
18
|
my $imagedir = File::Spec->catdir( $path, 'images' ); |
|
65
|
|
|
|
|
|
|
File::Find::find( |
|
66
|
|
|
|
|
|
|
sub { |
|
67
|
33
|
100
|
|
33
|
|
628
|
-f $_ && do { |
|
68
|
30
|
|
|
|
|
38
|
my $dstdir = $File::Find::dir; |
|
69
|
30
|
|
|
|
|
151
|
$dstdir =~ s{^$imagedir/?}{}; |
|
70
|
30
|
|
|
|
|
986
|
$blib{$File::Find::name} = File::Spec->catfile('lightbox', $dstdir, $_); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
}, |
|
73
|
3
|
|
|
|
|
768
|
$imagedir |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# return list of files to install |
|
77
|
3
|
|
|
|
|
46
|
return %blib; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
############################################################################### |
|
81
|
|
|
|
|
|
|
# Subroutine: files() |
|
82
|
|
|
|
|
|
|
############################################################################### |
|
83
|
|
|
|
|
|
|
# Returns the list of files that are installed by Alien::Lightbox. |
|
84
|
|
|
|
|
|
|
############################################################################### |
|
85
|
|
|
|
|
|
|
sub files { |
|
86
|
1
|
|
|
1
|
1
|
13
|
my $class = shift; |
|
87
|
1
|
|
|
|
|
5
|
my %blib = $class->to_blib(); |
|
88
|
1
|
|
|
|
|
16
|
return sort values %blib; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
############################################################################### |
|
92
|
|
|
|
|
|
|
# Subroutine: install($destdir) |
|
93
|
|
|
|
|
|
|
# Parameters: $destdir - Destination directory |
|
94
|
|
|
|
|
|
|
############################################################################### |
|
95
|
|
|
|
|
|
|
# Installs the Lightbox into the given '$destdir'. Throws a fatal exception on |
|
96
|
|
|
|
|
|
|
# errors. |
|
97
|
|
|
|
|
|
|
############################################################################### |
|
98
|
|
|
|
|
|
|
sub install { |
|
99
|
2
|
|
|
2
|
1
|
6325
|
my ($class, $destdir) = @_; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# install scriptaculous |
|
102
|
2
|
|
|
|
|
17
|
Alien::scriptaculous->install( $destdir ); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# install our files |
|
105
|
2
|
|
|
|
|
17124
|
my %blib = $class->to_blib(); |
|
106
|
2
|
|
|
|
|
14
|
while (my ($srcfile, $dest) = each %blib) { |
|
107
|
|
|
|
|
|
|
# get full path to destination file |
|
108
|
24
|
|
|
|
|
6959
|
my $destfile = File::Spec->catfile( $destdir, $dest ); |
|
109
|
|
|
|
|
|
|
# create any required install directories |
|
110
|
24
|
|
|
|
|
607
|
my $instdir = dirname( $destfile ); |
|
111
|
24
|
100
|
|
|
|
333
|
if (!-d $instdir) { |
|
112
|
1
|
50
|
|
|
|
126
|
mkpath( $instdir ) || croak "can't create '$instdir'; $!"; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
# install the file |
|
115
|
24
|
50
|
|
|
|
60
|
copy( $srcfile, $destfile ) || croak "can't copy '$srcfile' to '$instdir'; $!"; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 NAME |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Alien::Lightbox - installing and finding Lightbox JS |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
use Alien::Lightbox; |
|
128
|
|
|
|
|
|
|
... |
|
129
|
|
|
|
|
|
|
$version = Alien::Lightbox->version(); |
|
130
|
|
|
|
|
|
|
$path = Alien::Lightbox->path(); |
|
131
|
|
|
|
|
|
|
... |
|
132
|
|
|
|
|
|
|
Alien::Lightbox->install( $my_destination_directory ); |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Please see L for the manifesto of the Alien namespace. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 METHODS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=over |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item version() |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Returns the Lightbox version number. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Not to be confused with the C version number (which is the |
|
147
|
|
|
|
|
|
|
version number of the Perl wrapper). |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item path() |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns the path to the available copy of Lightbox. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item to_blib() |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns a hash containing paths to the source files to be copied, and their |
|
156
|
|
|
|
|
|
|
relative destinations. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item files() |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Returns the list of files that are installed by Alien::Lightbox. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item install($destdir) |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Installs the Lightbox into the given C<$destdir>. Throws a fatal exception |
|
165
|
|
|
|
|
|
|
on errors. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=back |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 AUTHOR |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Graham TerMarsch (cpan@howlingfrog.com) |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 LICENSE |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Copyright (C) 2007, Graham TerMarsch. All rights reserved. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
http://www.huddletogether.com/projects/lightbox2/, |
|
182
|
|
|
|
|
|
|
L, |
|
183
|
|
|
|
|
|
|
L. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |