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