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