line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This software is copyright (c) 2004 Alex Robinson. |
2
|
|
|
|
|
|
|
# It is free software and can be used under the same terms as perl, |
3
|
|
|
|
|
|
|
# i.e. either the GNU Public Licence or the Artistic License. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package MasonX::Resolver::ExtendedCompRoot; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7022
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use base qw(HTML::Mason::Resolver::File); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
943
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
57811
|
use HTML::Mason::Tools qw(read_file_ref); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
511
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# call ApacheHandler's apache_request_to_comp_path in a way |
17
|
|
|
|
|
|
|
# that doesn't cause standalone invocations to choke |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
sub apache_request_to_comp_path |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
0
|
1
|
|
return HTML::Mason::Resolver::File::ApacheHandler::apache_request_to_comp_path(@_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
# override HTML::Mason::Resolver::File's get_info |
26
|
|
|
|
|
|
|
# which this method simply replicates and adds several lines to |
27
|
|
|
|
|
|
|
# additional lines marked #ecr |
28
|
|
|
|
|
|
|
# |
29
|
|
|
|
|
|
|
sub get_info { |
30
|
0
|
|
|
0
|
1
|
|
my ($self, $path) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $specified_comp_root; #ecr |
33
|
0
|
0
|
|
|
|
|
if (index($path,'=>') != -1) { #ecr |
34
|
0
|
|
|
|
|
|
my ($comp_root,$comp_path) = split('=>',$path,2); #ecr |
35
|
0
|
|
|
|
|
|
$specified_comp_root = $comp_root; #ecr |
36
|
0
|
|
|
|
|
|
$specified_comp_root =~ s|^/||; #ecr |
37
|
0
|
|
|
|
|
|
$path = $comp_path; #ecr |
38
|
|
|
|
|
|
|
} #ecr |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
foreach my $pair ($self->comp_root_array) { |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
0
|
|
|
|
next if ($specified_comp_root and ($pair->[0] ne $specified_comp_root)); #ecr |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $srcfile = File::Spec->canonpath( File::Spec->catfile( $pair->[1], $path ) ); |
45
|
0
|
0
|
|
|
|
|
next unless -f $srcfile; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $key = $pair->[0]; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $modified = (stat _)[9]; |
50
|
0
|
0
|
|
|
|
|
my $base = $key eq 'MAIN' ? '' : "/$key"; |
51
|
0
|
0
|
|
|
|
|
$key = undef if $key eq 'MAIN'; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return |
54
|
|
|
|
|
|
|
HTML::Mason::ComponentSource->new |
55
|
|
|
|
|
|
|
( friendly_name => $srcfile, |
56
|
|
|
|
|
|
|
comp_id => "$base$path", |
57
|
|
|
|
|
|
|
last_modified => $modified, |
58
|
|
|
|
|
|
|
comp_path => $path, |
59
|
|
|
|
|
|
|
comp_class => 'HTML::Mason::Component::FileBased', |
60
|
|
|
|
|
|
|
extra => { comp_root => $key }, |
61
|
0
|
|
|
0
|
|
|
source_callback => sub { read_file_ref($srcfile) }, |
62
|
0
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if ( $path ne '/' ) |
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
# see if path corresponds to real filesystem path, a common new user mistake |
68
|
0
|
|
|
|
|
|
my $fs_path = File::Spec->catfile( split /\//, $path ); |
69
|
0
|
0
|
0
|
|
|
|
if ( defined $fs_path && -e $fs_path ) |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
|
|
|
warn "Your component path ($path) matches a real file on disk ($fs_path). Have you read about the component root in the Administrator's Manual (HTML::Mason::Admin)?"; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |