How do I overload REST::Application->new() ???

I have a module which looks something like this:

package MyApp::RESTful; use warnings; use strict; use REST::Application; use base 'REST::Application'; sub new { my $self = shift; my $args = shift; my $app = {}; $app->{'dbh'} = DBI->connect(); $app->{'cfg'} = Config::Simple->new(); $app->{'__defaultQuery'} = CGI->new(); . . . . . . bless $app, $self; return $app; } sub setup { my $self = shift; $self->resourceHooks( qr{/sd/agent/create/(.*)$} => '_AgentCreate', qr{/sd/agent/password/change/(.*)$} => '_AgentPWChange', qr{/sd/agent/logout/(.*)$} => '_AgentLogOut', qr{/sd/agent/stats/(.*)$} => '_AgentJobStats', qr{/sd/agent/authentication/(.*)$} => '_AgentAuthenticate' ); }
I'm running tests on this module which look like this:

my @REST_methods = qw( new query defaultQueryObject resourceHooks extr +aHandlerArgs getPathInfo getRealRequestMethod getRequestMethod loadRe +source getHandlerArgs callHandler getMatchText checkMatch getLastMatc +hPath getLastMatchPattern run getHeaders addRepresentation headerType + header resetHeader setRedirect setup preRun postRun defaultResourceH +andler _getHandlerFromHook makeHandlerFromRef makeHandlerFromClass be +stContentType simpleContentNegotiation scoreType getContentPrefs getA +cceptHeader _getLastRegexMatches _setLastRegexMatches ); foreach my $method ( @REST_methods ){ can_ok($myapp, $method); }
which seems to indicate that $myapp can perform all of the methods in its base class REST::Application. But for some reason, it does not seem to be running the handler specified in my setup() call. It does seem to be running both preRun() and postRun() just fine, but I'm not seeing callHandler() do its thing with my custom code identified in the call to ->resourceHooks().

I have not found much literature on this module beyond the perldoc. Are folks actually using REST::Application and if so, can anyone advise me how to make it work, please?

-- Hugh

UPDATE:

I also wrote the author asking the following:

Does REST::Application still only work with Apache 1.3, as suggested in the article here: http://perlmonks.com/?node_id=562705

Is it safe to assume that if I'm not using mod_perl, but cgi instead that I don't need:

use Apache; use Apache::Constants qw(:common); sub handler { __PACKAGE__->new(request => $r)->run(); return OK; }
if( $lal && $lol ) { $life++; }

In reply to REST::Application not finding handler by hesco

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.