different problem, mojolyst again. I define two URLs virtually the same,
but one can pick up model code, while the other cannot.
I believe that the intent of M is to put model code into the file locations
..../mproject/lib/mproject/Model/...pm. correct? so, my project is
"Question" and my model is .../Question/lib/Question/Model/model.pm
#!/usr/bin/perl -w
use strict;
sub frommodel {
return "hello from model";
}
1;
page1 is .../Question/lib/Question/Controller/Page1.pm
#!/usr/bin/env perl
package Question::Controller::Page1;
use Mojolicious::Lite;
use Question::Model::model;
get '/page1' => sub {
my $c = shift;
my $frommodel= frommodel();
$c->render(inline => 'page 1 = everything ok');
};
1;
page2 is the same, .../Question/lib/Question/Controller/Page2.pm
#!/usr/bin/env perl
package Question::Controller::Page2;
use Mojolicious::Lite;
use Question::Model::model;
get '/page2' => sub {
my $c = shift;
my $frommodel= frommodel();
$c->render(inline => 'page 2 = everything ok');
};
1;
now the completely weird part is that /page1 works, but /page2 does not.
page2 complains that frommodel() is not defined. I obviously won't make
much progress unless I can figure out how to reliably pick up model code...
is this a bug or a feature?
regards, /iaw
PS: for completeness of example, the app itself is just
#!/usr/bin/env perl
use lib 'lib';
use lib '.';
use Mojolicious::Lite;
plugin Mojolyst => {controllers => 'Question::Controller'};
app->start();
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.