develooper Front page | perl.moose | Postings from March 2009

Not inlining a constructor warning

Thread Next
From:
Ovid
Date:
March 12, 2009 08:34
Subject:
Not inlining a constructor warning
Message ID:
211017.80622.qm@web65716.mail.ac4.yahoo.com

Hi all,

Question:  What's the proper way to suppress the following error from Moose::Meta::Method::Constructor when __PACKAGE->meta->make_immutable is called?

  Not inlining a constructor for PIPs::ResultSourceBase::BrandSeries since it is not inheriting the default Moose::Object constructor

(make_immutable might not even be necessary  Does this impact the role methods composed into classes which don't use Moose directly?)

Background, if needed:

We're gradually eliminating inheritance by converting subclasses to Moose roles.  Background at:

  http://use.perl.org/~Ovid/journal/38586

We're converting stuff like this:

  package PIPs::ResultSource::Promotion;
  use base qw/
    PIPs::ResultSourceBase::AuditedObject
    PIPs::ResultSourceBase::HaveIdentifiers
  /;

To stuff like this:

  package PIPs::ResultSource::Promotion;
  use base 'PIPs::ResultSourceBase::AuditedObject';

  use Moose;
  with 'PIPs::ResultSource::Role::HasIdentifiers';

(Yes, we know about 'extends', but we have a large, mission-critical app and we're taking deliberate baby steps in this large refactoring).

However, at the bottom of our code, we tried to put:

  __PACKAGE__->meta->make_immutable;

And we were getting errors:

  Can't locate object method "BUILDARGS" via package "PIPs::ResultSource::Promotion" at 
  /home/poec01/branches/broadcast_search/deps/lib/perl5/Moose/Object.pm line 16.

This was because Moose 0.61 was inlining a constructor and overwriting ours.  Upgrading to Moose 0.62 solved this, but it appears that the warning about "Not inlining a constructor" appears anyway and this makes for a very messy test suite.

With over 500 classes, we're not in a position to just switch over to the full Moose Kool-Aid (which seems like the proper fix), so is there a recommend way to handle this while we gradually refactor?

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About