Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

wirebird (8007)

wirebird
  karen.cravensNO@SPAMgmail.com
http://www.wirebird.com/

Author of Wirebird (also known by its current version, Gamehawk), which is intended to provide separate interfaces to the same community via mailing list and webforum (among others), chiefly because culture clash is fun to watch. Someday I should submit something to CPAN.

Journal of wirebird (8007)

Sunday February 03, 2008
03:57 PM

Moosetified

[ #35565 ]
So I'm greatly delaying the next release of Wirebird.Gamehawk by making it all Mooseified. It's great fun, though it seems to be impacting performance. Might just be the configuration of the test database, though, so I'm not sweating it yet.

But one thing is puzzling me.

package Wirebird::RESTful;
use Moose;
has 'response' => {is => 'rw', isa => 'HashRef'};


And then:

package Wirebird::RESTful::Forum;
extends 'Wirebird::RESTful';


So far, so good... not much different from the BankAccount balance in the Moose Cookbook, right? Wirebird::RESTful::Forum can play with $self->response all happy and fine.

Except when a sub in the base class, Wirebird::RESTful, tries to mess with $self->response, I get:

Can't locate object method "response" via package "Wirebird::RESTful::Forum".

Mysterious. And probably just another senior moment, but this time I'm not taking any decongestants, so I'll have to find another excuse: my moose is clearly Satan.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Regarding performance, you should try making the classes immutable, it gives a serious performance boost at runtime for only slightly more of a compile time cost.

    Your example has some syntax issues. To start with, "has" doesn't take a HASH-ref of options. Also, you are missing the "use Moose" line in ::Forum, so that ...

    package Wirebird::RESTful::Forum;
    extends 'Wirebird::RESTful';

    Should be ...

    package Wirebird::RESTful::Forum;
    use Moose;
    extends 'Wirebird::RESTful';

    As for what else is going on wit

    • The "use Moose" line is in ::Forum, actually. I elided a ton of stuff, and apparently got carried away there.

      And... oh, hey, you're right. Curly braces *again.* That's it, I'm switching my tty font from Courier New to... um... let's try Lucida Console.

      Interesting, though. W::R::Forum can play with the 'has' stuff just fine, curly braces and all. That was what threw me. And I just checked (with Lucida!) and all my other has's use parens just fine. And none of them use 'extends', which was why I figured that