- SEE ALSO
- COPYRIGHT AND LICENSE
Padre::Plugin::Plack - PSGI/Plack plugin for Padre
# cpan install Padre::Plugin::Plack; # Then enable it via L<Padre>, The Perl IDE: # Padre > Plugins > Plugin Manager > Plack > enable
With the plugin installed, opening *.psgi files causes some special things to happen.
PSGI files are really just ordinary Perl files, so Padre does its normal Perl lexing/syntax highlighting magic on them, but the real fun starts with the Plack-specific features that appear in the per-file graphical plackup control panel that shows up.
The panel lets you run your web app in a Plack server at the click of a button, view server output, configure plackup options and launch a web browser on the appropriate port.
The great thing about Plack/PSGI is that unlike my previous plugin (Padre::Plugin::WebGUI) which was specific to a single web app (albeit a big one), this plugin can be used for any web app built in a web framework that supports Plack (Catalyst, CGI::Application, HTTP::Engine, etc..). This is the same motivating factor that excites Plack::Middleware authors.
The plugin turns on plackup’s
--reload option by default, which conveniently causes the plack server to reload every time you modify your source files in Padre. This makes for quite a nice, if somewhat minimal "Plack IDE" experience (this is version 0.01 after all).
The plugin integrates all of the Plack example "dot-psgi”"files as templates that can be used to create different types of Plack apps straight from the GUI menu.
The pre-populated list of Plack servers and the simple start/stop button makes for a nice way of exploring the Plack server ecosystem. You can use the other panel options to enter a specific port to run on, toggle auto-start mode and pass additional options to plackup (options that start with
-- are passed through to the backend server).
The output panel is similar to the output panel that Padre normally displays when you execute Perl files, except that you get one panel per .psgi file meaning that you can run multiple plack servers simultaneously and independently view their output. The appropriate panel is automatically selected when you click on the corresponding file tab, and running processes are stopped when you close the tab.
It should be really easy to turn Padre::Plugin::Plack into new plugins that involve the same basic ingredients, namely a file extension and an external command for running those files, with a per-file panel for command options and output. So I encourage anyone who has a similar plugin in mind to steal liberally from Padre::Plugin::Plack (as I did from Padre::Plugin::Catalyst - thanks garu++). Ruby Rack support comes to mind as a trivial example.
Make Padre your domain-specific IDE today :)
Blog post with screenshots: http://blog.patspam.com/2009/padrepluginplack
Declare the Padre interfaces this plugin uses
Declare ourselves as the handler for .psgi files
Create the plugin menu
Called when Padre loads
Note that the new tab may or may not exist at this point When triggered by user opening a new file (e.g. from on_app_load), tab does not exist yet Whereas, when triggered by user creating new app from template, tab exists
This method belonds in Padre::Plugin::Plack::Panel but we keep it here to speed up the dev edit-reload cycle
Gábor Szabó - גאבור סבו (SZABGAB) <email@example.com>
Big thanks to all the wonderful translators!
French - Jerome Quelin (jquelin) <firstname.lastname@example.org>
Dutch - Dirk De Nijs (ddn123456) <DIRKDN@cpan.org>
Brazilian Portuguese - Breno G. de Oliveira (GARU) <email@example.com>
Arabic - أحمد محمد زواوي Ahmad M. Zawawi (azawawi) <firstname.lastname@example.org>
Turkish - Burak Gürsoy (burak) <email@example.com>
Italian - Simone Blandino (sblandin)
Patrick Donelan <firstname.lastname@example.org>
This software is copyright (c) 2010 by Patrick Donelan.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 620:
Non-ASCII character seen before =encoding in 'plackup’s'. Assuming UTF-8