Skip Menu |

This queue is for tickets about the MooseX-Role-Matcher CPAN distribution.

Report information
The Basics
Id: 41852
Status: resolved
Priority: 0/
Queue: MooseX-Role-Matcher

People
Owner: Nobody in particular
Requestors: hanenkamp [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.01
Fixed in: (no value)



I'm working on Net::Google::PicasaWeb and am looking at using MooseX::Role::Matcher with it. However, I would like to be able to do deep matching on attributes. I.e., with a syntax something like: if ($album->match('photo.title' => qw/OSCON/)) { print $album->title, " matches.\n"; } I.e., if an attribute being matched is another Moose object that does MooseX::Role::Matcher, I would like to be able to drill into it's attributes as well. If you're interested, I can contribute a patch to Matcher.pm. If you are not, I will add a new module to CPAN called MooseX::Role::DeepMatcher. Thanks for the module. It works great for me. Cheers, Sterling
On Sun Dec 21 17:10:57 2008, HANENKAMP wrote: Show quoted text
> I'm working on Net::Google::PicasaWeb and am looking at using > MooseX::Role::Matcher with it. However, I would like to be able to do > deep matching on attributes. I.e., with a syntax something like: > > if ($album->match('photo.title' => qw/OSCON/)) { > print $album->title, " matches.\n"; > } > > I.e., if an attribute being matched is another Moose object that does > MooseX::Role::Matcher, I would like to be able to drill into it's > attributes as well. If you're interested, I can contribute a patch to > Matcher.pm. If you are not, I will add a new module to CPAN called > MooseX::Role::DeepMatcher. > > Thanks for the module. It works great for me. > > Cheers, > Sterling
Yeah, that sounds like a reasonable thing to do. As for the interface, how does using a hashref sound? Something like if ($album->match(photo => { title => qw/OSCON/ })) { print $album->title, " matches.\n"; } where the hashref contains a match specification exactly like what you would pass to the match function normally. I think that would be a bit cleaner. I'll get that written for a 0.02 release, but probably not for another week or two, since I'm currently on vacation. Thanks, Jesse
Rereading my response, I didn't mean to sound like I would be against a patch if you wanted to provide one - feel free if you're going to have more time over these next couple weeks(: Jesse
Subject: Re: [rt.cpan.org #41852]
Date: Mon, 29 Dec 2008 11:27:52 -0600
To: bug-MooseX-Role-Matcher [...] rt.cpan.org
From: "Sterling Hanenkamp" <sterling [...] hanenkamp.com>
On Mon, Dec 22, 2008 at 7:29 PM, Jesse Luehrs via RT < bug-MooseX-Role-Matcher@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=41852 > > > Rereading my response, I didn't mean to sound like I would be against a > patch if you wanted to provide one - feel free if you're going to have > more time over these next couple weeks(: > > Jesse >
Sure, since my vacation ended and I spent most of my vacation rotting my brain with my Wii, I probably won't have a chance to get back to it either, but if I do before I see a .02 release, I may try. Cheers, Sterling
MooseX::Role::Matcher-0.02 has been released with support for submatching. Hopefully this should be able to handle your requirements(: