| 1 |
NAME |
| 2 |
CGI::Application::Plugin::ViewCode - View the source of the running |
| 3 |
application |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
In your CGI::Application based class |
| 7 |
|
| 8 |
use CGI::Application::Plugin::ViewCode; |
| 9 |
|
| 10 |
Then you can view your module's source (or pod) as it's running by |
| 11 |
changing the url |
| 12 |
|
| 13 |
?rm=view_code |
| 14 |
?rm=view_code#215 |
| 15 |
?rm=view_code&pod=0&line_no=0 |
| 16 |
?rm=view_code&module=CGI-Application |
| 17 |
|
| 18 |
?rm=view_pod |
| 19 |
?rm=view_pod&module=CGI-Application |
| 20 |
|
| 21 |
INTERFACE |
| 22 |
This plugin works by adding extra run modes (named `view_code' and ` |
| 23 |
view_pod ') to the application. By calling this run mode you can see the |
| 24 |
source or POD of the running module (by default) or you can specify |
| 25 |
which module you would like to view (see SECURITY). |
| 26 |
|
| 27 |
view_code |
| 28 |
|
| 29 |
This extra run mode will accept the following arguments in the query |
| 30 |
string: |
| 31 |
|
| 32 |
module |
| 33 |
The name of the module to view. By default it is the module |
| 34 |
currently being run. Also, since colons (':') aren't simply typed |
| 35 |
into URL's, you can just substitute '-' for '::'. |
| 36 |
|
| 37 |
?rm=view_code?module=My-Base-Class |
| 38 |
|
| 39 |
highlight |
| 40 |
Boolean indicates whether syntax highlighting (using |
| 41 |
Syntax::Highlight::Perl::Improved) is `on' or `off'. By default it |
| 42 |
is `on'. |
| 43 |
|
| 44 |
line_no |
| 45 |
Boolean indicates whether the viewing of line numbers is `on' or |
| 46 |
`off'. By default it is `on'. It `line_no' is on, you can also |
| 47 |
specify which line number you want to see by adding an anchor to the |
| 48 |
link: |
| 49 |
|
| 50 |
?rm=view_code#215 |
| 51 |
|
| 52 |
This will take you immediately to line 215 of the current |
| 53 |
application module. |
| 54 |
|
| 55 |
pod Boolean indicates whether POD is seen or not. By default it is |
| 56 |
seen>. |
| 57 |
|
| 58 |
view_pod |
| 59 |
|
| 60 |
This extra run mode will accept the following arguments in the query |
| 61 |
string: |
| 62 |
|
| 63 |
module |
| 64 |
The name of the module to view. By default it is the module |
| 65 |
currently being run. Also, since colons (':') aren't simply typed |
| 66 |
into URL's, you can just substitute '-' for '::'. |
| 67 |
|
| 68 |
?rm=view_pod?module=My-Base-Class |
| 69 |
|
| 70 |
AS A POPUP WINDOW |
| 71 |
This plugin can be used in conjunction with |
| 72 |
CGI::Application::Plugin::DevPopup. If we detect that |
| 73 |
CGI::Application::Plugin::DevPopup is running and turned on, we will |
| 74 |
create a sub-report that includes the highlighted source code. |
| 75 |
|
| 76 |
So you can simply do the following: |
| 77 |
|
| 78 |
BEGIN { $ENV{CAP_DEVPOPUP_EXEC} = 1; } # turn it on for real |
| 79 |
use CGI::Application::Plugin::DevPopup; |
| 80 |
use CGI::Application::Plugin::ViewCode; |
| 81 |
|
| 82 |
Befault, this report will be the same thing produced by `view_code'. If |
| 83 |
you want this report to include the `view_pod' report, simply set the |
| 84 |
the `$ENV{CAP_VIEWCODE_POPUP_POD}' to true. You can also turn off the |
| 85 |
`view_code' report but setting `$ENV{CAP_VIEWCODE_POPUP_CODE}' to false. |
| 86 |
|
| 87 |
# have the POD report, but not the code in the dev popup window |
| 88 |
BEGIN { |
| 89 |
$ENV{CAP_DEVPOPUP_EXEC} = 1; # turn it on for real |
| 90 |
$ENV{CAP_VIEWCODE_POPUP_POD} = 1; # turn on POD report |
| 91 |
$ENV{CAP_VIEWCODE_POPUP_CODE} = 0; # turn off code report |
| 92 |
} |
| 93 |
use CGI::Application::Plugin::DevPopup; |
| 94 |
use CGI::Application::Plugin::ViewCode; |
| 95 |
|
| 96 |
SECURITY |
| 97 |
This plugin is designed to be used for development only. Please do not |
| 98 |
use it in a production system as it will allow anyone to see the source |
| 99 |
code for any loaded module. Consider yourself warned. |
| 100 |
|
| 101 |
AUTHOR |
| 102 |
Michael Peters, `<[email protected]>' |
| 103 |
|
| 104 |
BUGS |
| 105 |
Please report any bugs or feature requests to |
| 106 |
`[email protected]', or through the web |
| 107 |
interface at |
| 108 |
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-Vi |
| 109 |
ewCode. I will be notified, and then you'll automatically be notified of |
| 110 |
progress on your bug as I make changes. |
| 111 |
|
| 112 |
ACKNOWLEDGEMENTS |
| 113 |
COPYRIGHT & LICENSE |
| 114 |
Copyright 2005 Michael Peters, All Rights Reserved. |
| 115 |
|
| 116 |
This program is free software; you can redistribute it and/or modify it |
| 117 |
under the same terms as Perl itself. |
| 118 |
|