in reply to There Are No Perl Scripts

You have just described the entire model that CGI::Application uses. In fact, one of the nagging design "issues" that C::A has is that every C::A child has to have1 a .cgi that looks something like:
#!perl -T use strict; use warnings; $|++; use My::CGI::Application::Child; My::CGI::Application::Child->new->run;

Also, this ends up being very similar to how Tk applications work. You have a little bit of setup, then you call MainLoop(), which does everything else for you. OO programming purists end up with something similar, but not as pretty. :-p

  1. Well, until you could use CGI::Application::Dispatch and CGI::Application::Apache to make things a little cleaner.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^2: There Are No Perl Scripts
by snowhare (Friar) on Nov 14, 2004 at 16:02 UTC

    Not that I do this myself currently, but by placing the initialization code inside your module in the 'non-subroutine' area (and using 'import' for initialization parameterization), you could strip it down to

    #!/usr/bin/perl -T use My::CGI::Application::Child ('initialization' => 'parameters');