I am new to cgi-app (titanium) and am hoping someone can give me some help
on runmode Controller routines.  I don't like the idea of having all of my
controller runmode code in the base module. I will have dozens of runmodes.
I would like to be able to separate my runmodes into logical modules, but I
am not sure how to get that to work.

 

This works: 

# dashboard runmode in MyApp.pm

MyApp.pl:

#!/usr/local/bin/perl

use strict;

use lib 'lib';

use MyApp;

 

my $webapp = ReliaWeb->new();

$webapp->run();

 

lib/MyApp.pm:

                package MyApp.pm;

                use base 'Titanium';

                use CGI::Application::Plugin::ActionDispatch;

 

                sub setup {

                                my ($self) = @_;

                                return;

                }

                sub display_dashboard : Path('dashboard/') {

                                return
qq{<html><body>Dashboard</body></html>};        #Testing runmode

                }

 

##############################################################

 

Here is what I want to do instead but does not work this way: 

# (dashboard runmode in its own module)

 

MyApp.pl: [no change]

 

lib/MyApp.pm:

                package MyApp.pm;

                use base 'Titanium';

                use MyApp::Admin::Dashboard;

                

                sub setup {

                                my ($self) = @_;

                                return;

                }

 

lib/MyApp/Admin/Dashboard.pm:

                package Dashboard:

                use base 'MyApp';

                use CGI::Application::Plugin::ActionDispatch;

 

                sub display_dashboard : Path('dashboard/') {

                                return
qq{<html><body>Dashboard</body></html>};        #Testing runmode

                }

#############################################################

 

Thanks in advance for any guidance you can provide.

Victor


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to