Resolving the latest breaks with PoCo::MQ and Moose

3 views
Skip to first unread message

Squeeks

unread,
Jan 13, 2010, 11:31:09 AM1/13/10
to PoCo::MQ
In the past 11 months between the 0.26 release of PoCo::MQ and today,
Moose and Class::MOP have changed the ways that aliases and attributes
are accessed, basically just renamed a few things. This in turn has
broken PoCo::MQ, given the time between releases so great, the CPAN
testers matrix hasn't re-tested these modules as the smoke testers
have had to slow down[1].


The details
At version 0.94, Class::MOP depreciated the get_attribute_map()[2]
sub, with the changelog mentioning that get_attribute_list and
get_attribute should be used.


The dirty fix
I'm a sysadmin, as well as a programmer, and I'm also impatient.
Having a look at the internals of Class::MOP, they've only renamed the
sub[3], my quick hack simply follows that rename. I've tested this
against the test suite with 0.26, to which it has passed successfully.


The dream
I don't know jack about Moose. Ideally I'd like to get the current
code in MessageQueue/Message.pm to use get_attribute_list like it
should, but that requires going to the school of metaprogramming. My
noobish attempts in this have so far failed. If you've got a fix, you
can post the patch here, fork my repository on github, which I can
fast-import into bzr and give back to David for the next release, or,
just make the changes via bzr yourself as per David's request.


The diversion
Thanks to dramas with me trying to get Bazaar in, I've taking the leap
and fast-imported the devel.mainline into a git repository[4], not to
try and sidetrack the efforts happening on the Bazaar repo. Both the
git and bzr repo's feature the other fixture[5] that changed in Moose,
namely alias_method being renamed.


~ Squeeks


[1] http://www.mail-archive.com/cpan-teste...@perl.org/msg01550.html
[2] http://cpansearch.perl.org/src/DROLSKY/Class-MOP-0.97/Changes
[3] http://search.cpan.org/diff?from=Class-MOP-0.94&to=Class-MOP-0.97#lib/Class/MOP/Class.pm
[4] http://github.com/squeeks/POE-Component-MessageQueue/tree/moose-fixes
[5] https://rt.cpan.org/Ticket/Display.html?id=49523

David Snopek

unread,
Jan 22, 2010, 4:19:25 AM1/22/10
to PoCo::MQ

Squeeks,

You'll have to forgive me if I've done this wrong (as this is the
first time I've ever used git!) but below should be a patch of your
changes.

--- devel.mainline/lib/POE/Component/MessageQueue/Message.pm
2009-02-23 20:52:37.000000000 +0100
+++ POE-Component-MessageQueue/lib/POE/Component/MessageQueue/
Message.pm 2010-01-22 09:58:25.000000000 +0100
@@ -88,7 +88,8 @@
sub equals
{
my ($self, $other) = @_;
- foreach my $ameta (values %{__PACKAGE__->meta-
>get_attribute_map})
+ # This is a dirty hack, rewriting to use get_attribute_list
would be preferred
+ foreach my $ameta (values %{__PACKAGE__->meta-
>_attribute_map})
{
my $reader = $ameta->get_read_method;
my ($one, $two) = ($self->$reader, $other->$reader);
@@ -111,7 +112,7 @@
my $msg = $class->new(
id => $frame->headers->{'message-id'},
destination => $frame->headers->{destination},
- persistent => $frame->headers->{persistent} eq
'true',
+ persistent => $frame->headers->{persistent} ||
'true',
body => $frame->body,
);
if (!$msg->persistent and my $after = $frame->headers->
{'expire-after'})

The first part of the patch appears to be the first you are referring
to. I updated all my CPAN to get the new Moose parts and applied the
first part of the patch.

In trying to run the tests I'm getting the following frighteningly
huge Moose error:

# Error: You must supply a CODE reference to bless, not
(Moose::Meta::Class=HASH(0x2a43c08)) at /home/dsnopek/local/lib/perl5/
x86_64-linux-gnu-thread-multi/Class/MOP/Method.pm line 31
# Class::MOP::Method::wrap
('MooseX::AttributeHelpers::Meta::Method::Provided',
'Moose::Meta::Class=HASH(0x2a43c08)', 'package_name',
'POE::Component::MessageQueue::Storage::Throttled', 'name',
'meta_sent') called at /home/dsnopek/local/lib/perl5/MooseX/
AttributeHelpers/Base.pm line 192
# Class::MOP::Class:::after
('MooseX::AttributeHelpers::Counter=HASH(0x3a49850)') called at /home/
dsnopek/local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/
Wrapped.pm line 61
# Class::MOP::Method::Wrapped::__ANON__
('MooseX::AttributeHelpers::Counter=HASH(0x3a49850)') called at /home/
dsnopek/local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/
Wrapped.pm line 89
# MooseX::AttributeHelpers::Base::install_accessors
('MooseX::AttributeHelpers::Counter=HASH(0x3a49850)') called at /home/
dsnopek/local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/
Class.pm line 741
# Class::MOP::Class::__ANON__() called at /home/dsnopek/local/
lib/perl5/Try/Tiny.pm line 47
# eval {...} called at /home/dsnopek/local/lib/perl5/Try/Tiny.pm
line 39
# Try::Tiny::try('CODE(0x3a39790)', 'CODE(0x3a49d10)') called
at /home/dsnopek/local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/
MOP/Class.pm line 746
# Class::MOP::Class::add_attribute('Moose::Meta::Class=HASH
(0x3a0db48)', 'MooseX::AttributeHelpers::Counter=HASH(0x3a49850)')
called at /home/dsnopek/local/lib/perl5/Moose/Meta/Class.pm line 250
# Moose::Meta::Class::add_attribute('Moose::Meta::Class=HASH
(0x3a0db48)', 'sent', 'metaclass', 'Counter', 'definition_context',
'HASH(0x39f12e0)') called at /home/dsnopek/local/lib/perl5/Moose.pm
line 69
# Moose::has('Moose::Meta::Class=HASH(0x3a0db48)', 'sent',
'metaclass', 'Counter') called at /home/dsnopek/local/lib/perl5/Moose/
Exporter.pm line 288
# Moose::has('sent', 'metaclass', 'Counter') called at lib/POE/
Component/MessageQueue/Storage/Throttled.pm line 31
# require POE/Component/MessageQueue/Storage/Throttled.pm called
at (eval 501) line 2
# main::BEGIN() called at lib/POE/Component/MessageQueue/Storage/
Throttled.pm line 0
# eval {...} called at lib/POE/Component/MessageQueue/Storage/
Throttled.pm line 0
# eval 'package main;

I don't understand it (yet!). But I'll try to look into it more later
today, probably in the evening CEST. I'll see if I can get some Moose
cavalry to assist. Sorry for taking so long to get back to you on
this.

Regards,
David Snopek.

> [1] http://www.mail-archive.com/cpan-testers-disc...@perl.org/msg01550.html
> [2]http://cpansearch.perl.org/src/DROLSKY/Class-MOP-0.97/Changes
> [3]http://search.cpan.org/diff?from=Class-MOP-0.94&to=Class-MOP-0.97#lib...

David Snopek

unread,
Jan 22, 2010, 4:20:59 AM1/22/10
to PoCo::MQ
Ugh, Gmail mangled that patch up. Here is the same as an attachment.

2010/1/22 David Snopek <dsn...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "PoCo::MQ" group.
> To post to this group, send email to poc...@googlegroups.com.
> To unsubscribe from this group, send email to pocomq+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pocomq?hl=en.
>
>

moose-fixes.patch

David Snopek

unread,
Jan 22, 2010, 5:12:35 AM1/22/10
to PoCo::MQ
Ok, I really should be doing other things right now, but it's very
easy to get distracted! ;-)

I've hacked a bit on this problem and I have a branch that gets
through the tests basically successfully. It appears there were some
POE changes that affect us too. I added a small change for that,
although we are still getting warnings during the tests about not
using sig_child() to reap processes. I believe this is from all the
wacky fork()'ing the tests do and doesn't reflect anything that the
server does during normal operation. I'll look more into it tonight.

Also, I replaced Squeeks' changes with using get_attribute_list() and
get_attribute(), which should be the recommended approach.

Here is a bzr branch with my changes:

http://code.hackyourlife.org/bzr/dsnopek/perl_mq/devel.moose_poe_updates

Attached also is a patch against mainline.

I'd really appreciate if anyone who knows Moose better or is
up-to-date on what's going on with POE lately could review my changes
(or the rest of the branch!) and let me know if there is anything else
that needs to be done.

Happy Hacking!
David Snopek.

2010/1/22 David Snopek <dsn...@gmail.com>:

moose-poe-updates.patch

David Snopek

unread,
Jan 23, 2010, 5:23:34 AM1/23/10
to PoCo::MQ
Given my limited amount of time to hack on this, I've decided that no
news is good news. ;-) Merging changes into mainline, release
pending.

2010/1/22 David Snopek <dsn...@gmail.com>:

Naveed

unread,
Jan 23, 2010, 1:36:36 PM1/23/10
to PoCo::MQ
Thanks for everyone's hard work on this. Maybe moving this project to
github would make it easier for others to contribute. Just a
suggestion.

On Jan 23, 5:23 am, David Snopek <dsno...@gmail.com> wrote:
> Given my limited amount of time to hack on this, I've decided that no
> news is good news. ;-)  Merging changes into mainline, release
> pending.
>

> 2010/1/22 David Snopek <dsno...@gmail.com>:


>
>
>
> > Ok, I really should be doing other things right now, but it's very
> > easy to get distracted! ;-)
>
> > I've hacked a bit on this problem and I have a branch that gets
> > through the tests basically successfully.  It appears there were some
> > POE changes that affect us too.  I added a small change for that,
> > although we are still getting warnings during the tests about not
> > using sig_child() to reap processes.  I believe this is from all the
> > wacky fork()'ing the tests do and doesn't reflect anything that the
> > server does during normal operation.  I'll look more into it tonight.
>
> > Also, I replaced Squeeks' changes with using get_attribute_list() and
> > get_attribute(), which should be the recommended approach.
>
> > Here is a bzr branch with my changes:
>
> >http://code.hackyourlife.org/bzr/dsnopek/perl_mq/devel.moose_poe_updates
>
> > Attached also is a patch against mainline.
>
> > I'd really appreciate if anyone who knows Moose better or is
> > up-to-date on what's going on with POE lately could review my changes
> > (or the rest of the branch!) and let me know if there is anything else
> > that needs to be done.
>
> > Happy Hacking!
> > David Snopek.
>

> > 2010/1/22 David Snopek <dsno...@gmail.com>:


> >> Ugh, Gmail mangled that patch up.  Here is the same as an attachment.
>

> >> 2010/1/22 David Snopek <dsno...@gmail.com>:

David Snopek

unread,
Jan 24, 2010, 9:08:47 AM1/24/10
to poc...@googlegroups.com
2010/1/23 Naveed <nave...@gmail.com>:

> Thanks for everyone's hard work on this.  Maybe moving this project to
> github would make it easier for others to contribute.  Just a
> suggestion.

Thanks for the suggestion!

However, right now I think where the code is hosted is the least of
this projects problems. :-/ The main problem being that I haven't had
much time to invest in PoCo::MQ lately.

Squeeks

unread,
Jan 25, 2010, 5:33:31 AM1/25/10
to PoCo::MQ
David,
It seems a lot of CPAN developers who write POE and Moose based
modules seem to use Github, or just git in general, as demonstrated:

http://github.com/search?type=Repositories&language=perl&q=POE&repo=&langOverride=&x=12&y=20&start_value=1
http://github.com/search?type=Repositories&language=perl&q=moose&repo=&langOverride=&x=4&y=17&start_value=1

Making it easier for potentially interested people to fork/branch,
help and contribute would speed up development, fix bugs, all the good
stuff. Where you host it does kind of matter if you want help, as
you've said you're finding it hard to get spare time.

~ Squeeks


On Jan 24, 2:08 pm, David Snopek <dsno...@gmail.com> wrote:
> 2010/1/23 Naveed <navee...@gmail.com>:

> ...
>
> read more »

Reply all
Reply to author
Forward
0 new messages