CGI-Alternatives
view release on metacpan or search on metacpan
lib/CGI/Alternatives.pm view on Meta::CPAN
=head1 Dependency Management
This is a whole other topic, but given CGI.pm is no longer in the perl core
you would have to install it anyway. It would be a good idea to do this the
right way from beginning. I'm not going to cover this in detail here, there are
many many good sources of information on the web. Here are some links to get
you started:
=head2 Managing Perl Versions
=over 4
=item * L<https://github.com/tokuhirom/plenv> - plenv: Perl binary manager
=item * L<https://perlbrew.pl/> - perlbrew: Manage multiple perl installations
=back
=head2 Managing Perl Modules
=over 4
=item * L<https://metacpan.org/release/App-cpanminus> - cpanm: Fast, lightweight CPAN client
=item * L<https://metacpan.org/release/App-cpm> - cpm: Fast, parallel CPAN module installer (3x faster than cpanm)
=item * L<https://metacpan.org/release/Carton> - Carton: Perl module dependency manager (like bundler for Ruby)
=item * L<https://metacpan.org/release/local-lib> - local::lib: Use a local lib/ directory for modules
=back
Modern approach using cpanfile and cpm:
Create a cpanfile:
requires 'Dancer2', '0.400000';
requires 'Template', '2.26';
requires 'Starman', '0.4015';
Install dependencies:
# Fast parallel installation
cpm install
# Or with cpanm
cpanm --installdeps .
Lock dependencies with Carton:
carton install
carton exec plackup bin/app.psgi
=head1 TESTING
One major advantage of modern frameworks is testability. All the frameworks
mentioned support easy testing:
use Test::More;
use Plack::Test;
use HTTP::Request::Common;
my $app = MyApp->to_app;
test_psgi $app, sub {
my $cb = shift;
my $res = $cb->(GET "/example_form");
is $res->code, 200;
like $res->content, qr/Say something/;
};
done_testing;
=head1 MIGRATION STRATEGIES
=head2 Gradual Migration
You don't have to migrate everything at once:
=over 4
=item 1. Start by wrapping your CGI scripts with Mojolicious::Plugin::CGI
=item 2. Add new features using the framework's native routing
=item 3. Gradually port old scripts to framework controllers
=item 4. Extract common code into libraries
=back
=head2 Quick Wins
Start with these easy improvements:
=over 4
=item * Move to PSGI for deployment flexibility
=item * Separate HTML into templates
=item * Use a proper PSGI server instead of CGI
=item * Add proper logging with L<Log::Log4perl> or L<Log::Dispatch>
=item * Write tests for your routes
=back
=head1 ADDITIONAL RESOURCES
=over 4
=item * L<Task::Kensho> - A Glimpse at an Enlightened Perl
=item * L<https://perlmaven.com/> - Perl Maven tutorials
=item * L<https://www.perl.com/> - Perl.com articles
=item * L<https://blogs.perl.org/> - Perl community blogs
( run in 2.148 seconds using v1.01-cache-2.11-cpan-acf6aa7dc9e )