Hoping someone can straighten me out. I'm trying to do this the right way, so if there's a better way, I'd love to hear it.

I wrote a Model for my Catalyst app that just loads a YAML file and provides accessors and validation. I copied some code from Catalyst::Model::DBI, specifically the code for new, but I'm getting warnings about my use of NEXT.

package Clio::Model::YAML; use namespace::autoclean; use base 'Catalyst::Model'; use MRO::Compat; use Data::Dumper; use YAML::Any qw(LoadFile); use warnings; use strict; __PACKAGE__->mk_accessors('defs'); sub new { my $class = shift; my $self = $class->NEXT::new(@_); $self->{defs} = mergekeys( LoadFile "db/clio.yml" ); return $self; }

The error I get is this:

$ ./script/clio_test.pl Clio::Model::YAML uses NEXT, which is deprecated. Please see the Class +::C3::Adopt::NEXT documentation for details. NEXT used at /home/mill +er/actions/note_taker/Clio/script/../lib/Clio/Model/YAML.pm line 16

I read the documentation, and tried to follow it (hence the use MRO::Compat above). It says,

You add use MRO::Compat to the top of a package as you start converting it, and gradually replace your calls to NEXT::method() with maybe::next::method(), and calls to NEXT::ACTUAL::method() with next::method().

but when I change my code to my $self = $class->maybe::next::new(@_); I get this error:

Couldn't load class (Clio) because: Couldn't instantiate component "Clio::Model::YAML", "Can't locate object method "new" via package "maybe::next" at /home/miller/actions/note_taker/Clio/script/../lib/Clio/Model/YAML.pm line 16."Compilation failed in require at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 98.

Am I reading this wrong? How am I supposed to do this under C3? Thanks for any help you can give.

UPDATE: Solved the problem. Short version: should be literally $class->maybe::next::method(@_). See my response below for details.


print map{substr'hark, suPerJacent other l',$_,1}(11,7,6,16,5,1,15,18..23,8..10,24,17,0,12,13,3,14,2,4);

In reply to Class::C3::Adopt::NEXT warning on deprecated NEXT by bv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.