On 13/12/2008, at 3:03 PM, J. Shirley wrote:

On Fri, Dec 12, 2008 at 4:01 PM, Kieren Diment <dim...@gmail.com> wrote:
That's the only place to have $c in the entire code, and you only copy over
the bits that you want:

$self = bless({ %$self,
               model_accessor => $c->model('MyModel')->whatever,
           }, ref($self));
return $self;

then in view::TT:

sub whatever {
my $self = @_;
$self->model_accessor->do_stuff;
...
}


But what if $c never exists, because you are writing a command line
application that never invokes Catalyst?


I've used this technique in a script that does:

use MyApp;
my $thing = MyApp->model->thing_from_accept_context_method ....

which is acceptable for me as my code is tightly coupled to the actual web app and accessing outside the web app is just a convenience issue, but might not be to everyone's taste.

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to