Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Printer CPAN distribution.

Report information
The Basics
Id: 82643
Status: resolved
Priority: 0/
Queue: Data-Printer

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

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



Subject: all methods not listed
Date: Fri, 11 Jan 2013 17:15:42 -0600
To: bugs-data-printer [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
here's the dump of collection list, it's not showing methods like contains and next, but I can call them Ticket::Posts { Parents Collection::List public methods (12) : add, add_all, clear, DESTROY, first, get, iterator, meta, new, set, size, to_array private methods (0) internals: { _ [ [0] Gator::Ticket::Post ] } } use Moose; extends 'Class'; with 'Role::Collection'; sub contains { my ( $self, $obj ) = @_; my $res = $self->first( sub { $_->equals( $obj ) } ) ? 1 : 0; return $res; } sub next { my $self = shift; state $iter = $self->iterator; my $next = $iter->(); return $next; } has _ => ( isa => 'ArrayRef[Object]', traits => ['Array'], is => 'bare', clearer => 'clear', handles => { get => 'get', set => 'set', size => 'count', add => 'push', add_all => 'push', iterator => [ natatime => 1 ], first => 'first', to_array => 'elements', }, ); __PACKAGE__->meta->make_immutable; 1; -- Caleb Cushing http://xenoterracide.com
Hi Caleb, could you help me reproduce this, please? I wasn't able to compile the source you pasted, I can only assume "Class" and "Role::Collection" are mockups to some other data. I tried changing it to this: -----------8<------------ package Ticket::Posts; use 5.10.0; use Moose; sub contains { my ( $self, $obj ) = @_; my $res = $self->first( sub { $_->equals( $obj ) } ) ? 1 : 0; return $res; } sub next { my $self = shift; state $iter = $self->iterator; my $next = $iter->(); return $next; } has _ => ( isa => 'ArrayRef[Object]', traits => ['Array'], is => 'bare', clearer => 'clear', handles => { get => 'get', set => 'set', size => 'count', add => 'push', add_all => 'push', iterator => [ natatime => 1 ], first => 'first', to_array => 'elements', }, ); __PACKAGE__->meta->make_immutable; 1; package main; my $obj = Ticket::Posts->new; use DDP; p $obj; ----------->8------------ And here's what I get: Ticket::Posts { Parents Moose::Object public methods (14) : add, add_all, clear, contains, DESTROY, first, get, iterator, meta, new, next, set, size, to_array private methods (0) internals: {} } As you can see, "contains" and "next" are there, so I can only imagine I'm doing something wrong to reproduce it. Finally, it might be worth noticing Data::Printer defaults to only showing your object's direct methods. Inherited methods are displayed only if you set class => { inherited => 'all' } (you can also use 'public' or 'private' to only see inherited public/private methods, but the default is 'none'). Hope this helps. Please let me know if there's a way to reproduce the issue you're facing. Thanks!
Subject: Re: [rt.cpan.org #82643] all methods not listed
Date: Wed, 16 Jan 2013 07:36:34 -0600
To: bug-Data-Printer [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
On Tue, Jan 15, 2013 at 6:28 PM, Breno G. de Oliveira via RT <bug-Data-Printer@rt.cpan.org> wrote: Show quoted text
> Hope this helps. Please let me know if there's a way to reproduce the > issue you're facing.
I think it's because they're inherited, iirc, it's simply surprising behavior because that means the delegated handles subroutines are not considered inherited even though they technically are. -- Caleb Cushing http://xenoterracide.com
On Wed Jan 16 08:36:44 2013, XENO wrote: Show quoted text
> > I think it's because they're inherited, iirc, it's simply surprising > behavior because that means the delegated handles subroutines are not > considered inherited even though they technically are. >
I see. Well, there are several ways in Perl to import subroutines into your namespace, but Perl hardly keeps a record of how they got there, which makes it hard for a dumper to know during runtime (unless it has some sort of source filter or call stack analyzer). If you're used to dumping objects with inheritance or roles, it might be wise to set Data::Printer with the class => { inherited => 'all' } property set in your .dataprinter file (or at least 'public'). Based on your latest input, I'm going to mark this ticket as solved. If you feel there's anything else we can do to assess your issue, patches are welcome :) Cheers! garu