CGI::A...ewCode(3pm)
β¨ CGI::Application::Plugin::ViewCode β¨
okay bestie, so this is the manual page for CGI::Application::Plugin::ViewCode (the 3pm one, you know the vibe π
). Live look at your own running app's source code. Iconic.
πΈ NAME πΈ
CGI::Application::Plugin::ViewCode β view the source of the running application π
π¦ SYNOPSIS π¦
So in your CGI::Application based class, you drop in:
use CGI::Application::Plugin::ViewCode;
and then, bestie, you can peek at your module's source (or its pod) while it's running, just by switching up the url:
?rm=view_code
?rm=view_code#215
?rm=view_code&pod=0&line_no=0
?rm=view_code&module=CGI-Application
?rm=view_pod
?rm=view_pod&module=CGI-Application
literally so easy. no cap. π
π INTERFACE π
The way this plugin works: it just adds extra run modes β named view_code and view_pod β to your application. Call one of those run modes and boom, you're looking at the source or the POD of the running module (that's the default, ok?), or you can say exactly which module you wanna see (go read SECURITY before you get too excited π).
π view_code
This extra run mode is gonna accept these arguments in the query string:
moduleβ the name of the module you wanna view. by default it's the module that's currently being run. Also (and this is the cute part) colons (':') aren't exactly a thing you just type into URL's, so you can just substitute'-'for'::'. πΈ
?rm=view_code?module=My-Base-Class
highlightβ a boolean telling you whether syntax highlighting (usingSyntax::Highlight::Perl::Improved) is"on"or"off". by default it's"on". β¨line_noβ a boolean that says whether viewing the line numbers is"on"or"off". by default it's"on". And if"line_no"is on, you can also pick which line number you wanna see by adding an anchor to the link:
?rm=view_code#215
this one takes you immediately to line 215 of the current application module. teleportation but make it code π«
podβ a boolean that says whether POD is seen or not. by default it's seen.
π§ view_pod
This extra run mode accepts these arguments in the query string:
moduleβ the name of the module you wanna view. by default it's the module currently being run. and again, since colons (':') aren't a thing you simply type into URL's, you can just substitute'-'for'::'.
?rm=view_pod?module=My-Base-Class
π AS A POPUP WINDOW π
This plugin can be used alongside CGI::Application::Plugin::DevPopup. If we detect that CGI::Application::Plugin::DevPopup is running and turned on, we're gonna create a sub-report that includes the highlighted source code. slay.
So you can simply do this:
BEGIN { $ENV{CAP_DEVPOPUP_EXEC} = 1; } # turn it on for real
use CGI::Application::Plugin::DevPopup;
use CGI::Application::Plugin::ViewCode;
By default, that report is the same thing produced by view_code. If you want that report to also include the view_pod report, just set the $ENV{CAP_VIEWCODE_POPUP_POD} to true. You can also turn off the view_code report by setting $ENV{CAP_VIEWCODE_POPUP_CODE} to false. π«Ά
# have the POD report, but not the code in the dev popup window
BEGIN {
$ENV{CAP_DEVPOPUP_EXEC} = 1; # turn it on for real
$ENV{CAP_VIEWCODE_POPUP_POD} = 1; # turn on POD report
$ENV{CAP_VIEWCODE_POPUP_CODE} = 0; # turn off code report
}
use CGI::Application::Plugin::DevPopup;
use CGI::Application::Plugin::ViewCode;
π SECURITY π
okay so real talk, no jokes for this one.
This plugin is designed to be used for development only. Please do not use it in a production system, because it will let anyone see the source code for any loaded module. π
Consider yourself warned. ππ
β AUTHOR β
Michael Peters, "<mpeters@plusthree.com>" π
π BUGS π
Please report any bugs or feature requests to "bug-cgi-application-plugin-viewsource@rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-ViewCode>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. π
πΈ ACKNOWLEDGEMENTS πΈ
(no entries here, bestie β that's genuinely it, nothing listed π)
π COPYRIGHT & LICENSE π
Copyright 2005 Michael Peters, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole thing!! this wasCGI::A...ewCode(3pm)fromperl v5.36.0, dated2022-10-14. go forth and view your code, king ππ β¨
π¦ where this page comes from
- ubuntu noble: libcgi-application-plugin-viewcode-perl 1.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcgi-application-plugin-viewcode-perl 1.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcgi-application-plugin-viewcode-perl 1.02-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms