[cgiapp] CGI::Application::Dispatch implementation

Michael Peters mpeters at plusthree.com
Fri Feb 15 18:37:19 EST 2008


Bruce McKenzie wrote:

> Thanks Michael. Any way I name it, I get a Not Found.

That's becuase you didn't follow my advice :) See below.

> I tried this:
>   #!/usr/bin/perl
>   use strict;
>   use FindBin qw($Bin);
>   use lib "$Bin/../perl_lib"; # my standard lib
>   use lib "$Bin/Modules"; # lib for this webapp
>   use CGI::Application::Dispatch;
> ...
>   my $name = CGI::Application::Dispatch->translate_module_name();

translate_module_name() can't be called by itself. It needs arguments. It's not
meant to be called in your code. The only reason it's documented is so that you
can override it if you want.

>   print ($name || "No name found"); # prints "No name found"
>   CGI::Application::Dispatch->dispatch(debug=>1) ; #Not Found
> 
> FWIW, this works as expected:
> 
>   #!/usr/bin/perl
>   use strict;
>   use FindBin qw($Bin);
>   use lib "$Bin/../perl_lib";  # my standard lib
>   use lib "$Bin/Modules"; # lib for this webapp
> 
>   use Notify;
>   Notify->new->run(); #default runmode is 'test'

So your module is called 'Notify'. If you notice in my last email I said that if
it was called 'Notify' and not 'Modules::Notify' then you didn't need a prefix.
The prefix is tacked on to the beginning of the module name.

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list