Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

instantiate objects from non-Catalyst model classes with parameters

by tospo (Hermit)
on Jan 25, 2011 at 17:36 UTC ( [id://884190]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package MyApp::Model::ProblemSolver;
    use Moose;
    ...
      my ($self, $args) = @_;
      return %$args;
    }
    
  2. or download this
    override 'prepare_arguments' => sub {
      my ($self, $c) = @_; 
    ...
      my %merged_args = ( %$config_params, %$passed_in_params ); 
      return \%merged_args;
    }; # prepare_arguments
    
  3. or download this
    
    $c->stash->{problem_solver_args}{some_param} = $user_input1 if $user_i
    +nput1;
    ...
    
    my $problem_solver = $c->model('ProblemSolver');
    my $result = $problem_solver->solve_problem();
    
  4. or download this
    Model::ProblemSolver:
      args:
        database: a_database_of_solved_problems
        some_param: SOME_DEFAULT_VALUE
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://884190]
Approved by Argel
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-23 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found