line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Action::Firebug; |
2
|
2
|
|
|
2
|
|
72950
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use base qw/Catalyst::Action/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1116
|
|
6
|
2
|
|
|
2
|
|
689012
|
use NEXT; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
911
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Catalyst::Action::Firebug - Catalyst action for embedding Firebug Lite tag |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub end : ActionClass('Firebug') { |
17
|
|
|
|
|
|
|
my ($self, $c) = @_; |
18
|
|
|
|
|
|
|
$c->forward( $c->view('TT') ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# or combination with Action::RenderView |
22
|
|
|
|
|
|
|
sub render : ActionClass('RenderView') {} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub end : ActionClass('Firebug') { |
25
|
|
|
|
|
|
|
my ($self, $c) = @_; |
26
|
|
|
|
|
|
|
$c->forward('render'); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Catalyst action for Firebug Lite. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
If your app running on debug mode or $ENV{FIREBUG_DEBUG} is set, |
34
|
|
|
|
|
|
|
this action insert firebug lite tags to its output automaticaly. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 CONFIGURATION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$c->config->{firebug}{path} = '/path/to/firebug.js'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 KEYS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item path |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
URL path of firebug.js. The default value is '/js/firebug/firebug.js'. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item expand_panel |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
If it's true value, firebug panel is opened when page loading. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
And you can use FIREBUG_EXPAND env instead of this key. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SEE ALSO |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Firebug, http://getfirebug.com/ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Firebug Lite, http://getfirebug.com/lite.html |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 EXTENDED METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 execute |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub execute { |
69
|
1
|
|
|
1
|
1
|
33144
|
my $self = shift; |
70
|
1
|
|
|
|
|
3
|
my ($controller, $c) = @_; |
71
|
1
|
|
|
|
|
17
|
my $res = $self->NEXT::execute(@_); |
72
|
1
|
50
|
33
|
|
|
664
|
return $res unless $c->debug || $ENV{FIREBUG_DEBUG}; |
73
|
|
|
|
|
|
|
|
74
|
1
|
50
|
|
|
|
20
|
if ($c->res->content_type =~ /html/) { |
75
|
1
|
|
|
|
|
207
|
$c->log->debug('enable firebug lite'); |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
50
|
|
|
615
|
my $firebug = $c->uri_for( $c->config->{firebug}{path} || '/js/firebug/firebug.js' ); |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
233
|
my $body = $c->res->body; |
80
|
|
|
|
|
|
|
|
81
|
1
|
50
|
|
|
|
92
|
if ($body =~ m!<head.*?>.*?</head>!is) { |
82
|
1
|
|
|
|
|
35
|
$body =~ s!(<head.*?>(?:.*?))(</head>)!$1<script type="text/javascript" src="$firebug"></script>$2!is; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else { |
85
|
0
|
|
|
|
|
0
|
$body .= qq{<script type="text/javascript" src="$firebug"></script>}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
1
|
50
|
33
|
|
|
18
|
if ($c->config->{firebug}{expand_panel} || $ENV{FIREBUG_EXPAND}) { |
89
|
1
|
50
|
|
|
|
106
|
if ($body =~ m!<html.*?>.*?</html>!is) { |
90
|
1
|
|
|
|
|
23
|
$body =~ s!(<html.*?)>!$1 debug="true">!is; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
else { |
93
|
0
|
|
|
|
|
0
|
$body = qq{<html debug="true">$body</html>}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
7
|
$c->res->body( $body ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
92
|
$res; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Daisuke Murase <typester@cpan.org> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This program is free software; you can redistribute |
110
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
The full text of the license can be found in the |
113
|
|
|
|
|
|
|
LICENSE file included with this module. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |