Matt S Trout wrote:
use base qw/ Catalyst::Model /;

sub new {
    my $self  = shift->next::method(@_);
    my $class = ref($self);
    my ( $c, $args ) = @_;
    $self->{'.mymodel'} = ExternalModule->new(
        Catalyst::Utils::merge_hashes( $args, $self->config )
    );
    return $self;
}

sub ACCEPT_CONTEXT {
    return shift->{'.mymodel'};
}

or is this only recommended if you need to make the context available in the external module?

No, that's just plain silly. Could I have a list of the models that do that
so I can track down the authors and slap them, please?

http://search.cpan.org/search?query=catalyst%3A%3Amodel+accept_context

brings up most of them, but there are a few more like Net::Amazon.

sub new {
  my ($class, $c, $args) = @_;
  return ExternalModule->new(
    Catalyst::Utils::merge_hashes( $args, $class->config )
  );
}

Thanks, I'll give that a try.

--
Jamie Neil | <[EMAIL PROTECTED]> | 0870 7777 454
Versado I.T. Services Ltd. | http://versado.net/ | 0845 450 1254

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to