Fellow Monasterians,

Am brand new to CGI::Application and have run into a problem where it is not performing a subroutine from within one of the run modes. I've stripped it down to the basics. Here's my main.

#!/usr/local/bin/perl use lib "../cgi-bin/cgiwrap/dsoft/"; use strict; use DSAdmin_test; my $dsadmin = DSAdmin_test->new(); $dsadmin->run();

And my application:

#DSAdmin package DSAdmin_test; use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use Data::Dumper; use base 'CGI::Application'; #------------------------ redirection ------------------------ sub setup { my $self = shift; $self->mode_param('rm'); $self->run_modes( 'ss' => 'save_subsrbr', ); } sub save_subsrbr { my @errors = qw(incorrect wrong); if (@errors) { errorhandler (\@errors); return "here2: " . Dumper(@errors); } } sub errorhandler { my $errors = shift; return "here1: " . Dumper($errors); } 1;

"here2" is printing but it's not going to "here1" first! When I run the subroutines as regular Perl scripts, it works fine. What am I not getting? Thanks in advance.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

In reply to CGI::Application and subroutines by bradcathey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.