FAQ
The problem is that on creation of MyApp object in Catalyst::prepare, i get
MyApp object merged with (!!!) my config.

MyApp->new does ok until this line of code

Catalyst::CODE(0x80d2d81f8)(/usr/local/lib/perl5/site_perl/5.10.0/Catalyst.pm:1110):
1110: $meta->make_immutable(replace_constructor => 1) unless
$meta->is_immutable;

After that MyApp->new is a mix of correct object and config hash which
breaks my application :(

More details:

when executing MyApp->new the problem is at
Catalyst::Controller::BUILD
it receives $args - somewhy it is my config :-)
Then goes MooseX::Emulate::Class::Accessor::Fast::CODE which also receives
%args which is my config and merges it into MyApp object:

87: my @extra = grep { !exists($self->{$_}) } keys %args;
88: @{$self}{@extra} = @args{@extra};

What's the problem and how to fix it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090508/e3b29fae/attachment.htm

Search Discussions

  • Tomas Doran at May 8, 2009 at 5:57 pm

    Oleg Pronin wrote:
    The problem is that on creation of MyApp object in Catalyst::prepare, i
    get MyApp object merged with (!!!) my config.
    The prepare method calls:

    my $c = $class->context_class->new({});

    So I don't see where the config is coming from.
    MyApp->new does ok until this line of code

    Catalyst::CODE(0x80d2d81f8)(/usr/local/lib/perl5/site_perl/5.10.0/Catalyst.pm:1110):
    1110: $meta->make_immutable(replace_constructor => 1) unless
    $meta->is_immutable;

    After that MyApp->new is a mix of correct object and config hash which
    breaks my application :(
    Erm, calling the new method will not call this code..

    This code _creates_ the new method for you on MyApp, but it is only run
    once.
    More details:

    when executing MyApp->new the problem is at
    Catalyst::Controller::BUILD
    it receives $args - somewhy it is my config :-)
    Then goes MooseX::Emulate::Class::Accessor::Fast::CODE which also
    receives %args which is my config and merges it into MyApp object:

    87: my @extra = grep { !exists($self->{$_}) } keys %args;
    88: @{$self}{@extra} = @args{@extra};

    What's the problem and how to fix it?
    I don't know how this ever worked for you then.

    In 5.7 you get exactly the same behavior, as

    MyApp isa Catalyst, which isa Catalyst::Component.

    The new method in Catalyst::Component delegates to the new method in
    Class::Accessor::Fast, which takes any parameters passed into the new
    method, turns them into a hashref and blesses it. This is exactly the
    same behavior that you're seeing, and the code you highlighted above is
    what provides this backwards compatibility.

    You do obviously have a problem however, so I'm not just trying to brush
    you off here.

    Could you extract the feature(s) which cause your application to break
    into a minimal TestApp you can show us so that we can get down to fixing
    it, without having to wade through loads of code and/or understand the
    rest of your app?

    Cheers
    t0m

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMay 7, '09 at 11:12p
activeMay 8, '09 at 5:57p
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Tomas Doran: 1 post Oleg Pronin: 1 post

People

Translate

site design / logo © 2021 Grokbase