Vague talk is vague and not examples
You don't need to stuff everything into one file
Here are commands Stucki::Command::Ro Stucki::Command::Sham Stucki::Command::Bo, they correspond to lib/Stucki/Command/Ro.pm
package Stucki::Command::Ro ; sub run { print "Ro ro ro-sham-bo, gently down the stream\n" } 1;
They're loaded by by this module
package Stucki; use Module::Load qw/ load /; sub run { my( $shelf, $command, @rest ) = @_; my $plugin = "Stucki::Command::".$command; load $plugin; ## or dies $plugin->run( @rest ); } 1;
So from commandline you might use ./stucki ro ast some mo corn where stucki might be
#!/usr/bin/perl -- use Stucki::Frontend::CLI; Stucki::Frontend::CLI->run;
And a stucki.cgi might be
#!/usr/bin/perl -- use Stucki::Frontend::CGI; Stucki::Frontend::CGI->run;
And so on and so forth...
Some examples of organizing such an "app": Ask, P5U, CPANPLUS/ CPANPLUS::Shell::Default / CPANPLUS::Shell::Tk / CPANPLUS::Shell::Wx
App-Cme-1.002 Check or edit configuration data with Config::Model
Config-Model-2.068 Create tools to validate, migrate and edit configuration files
Config-Model-Approx-1.009 Approx configuration file editor
Config-Model-Backend-Augeas-0.118 Read and write configuration data through Augeas
Config-Model-CursesUI-1.104 Curses interface to edit config data through Config::Model
Config-Model-Itself-1.243 Model editor for Config::Model
Config-Model-LcdProc-2.042 Edit and validate LcdProc configuration file
Config-Model-OpenSsh-1.236 OpenSSH config editor
Config-Model-Tester-2.050 Test framework for Config::Model
Config-Model-TkUI-1.345 Tk GUI to edit config data through Config::Model
Config-Model-Xorg-1.106 Xorg configuration editor and validator
cpan2pkg generating native linux packages from cpan
App::CPAN2Pkg generating native linux packages from cpan
App::CPAN2Pkg::Controller controller for cpan2pkg interface
App::CPAN2Pkg::Lock Simple locking mechanism within cpan2pkg
App::CPAN2Pkg::Module poe session to drive a module packaging
App::CPAN2Pkg::Repository repository details for a given module
App::CPAN2Pkg::Types types used in the distribution
App::CPAN2Pkg::UI::Text text interface for cpan2pkg
App::CPAN2Pkg::UI::Tk main cpan2pkg window
App::CPAN2Pkg::Utils various utilities for cpan2pkg
App::CPAN2Pkg::Worker poe session to drive a module packaging
App::CPAN2Pkg::Worker::Mageia worker dedicated to Mageia distribution
App::CPAN2Pkg::Worker::RPM worker specialized in rpm distributions
math-image display some mathematical images App::MathImage math-image application module App::MathImage::Gtk2::AboutDialog App::MathImage::Wx::Main math-image wxWidgets main window App::MathImage::Tk::Main App::MathImage::Prima::Main
more examples at Re: Recommendations for adding plugin/addon capability to a program and other places
In reply to Re^2: Best way to call another perl file
by Anonymous Monk
in thread Best way to call another perl file
by derekstucki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |