Skip Menu |

This queue is for tickets about the Object-Pad CPAN distribution.

Report information
The Basics
Id: 131814
Status: open
Priority: 0/
Queue: Object-Pad

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

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



Subject: Object::Pad failures OS X
Hi Paul, Object::Pad installed cleanly for me: 10:36:40 $ cpanm Object::Pad --> Working on Object::Pad Fetching http://www.cpan.org/authors/id/P/PE/PEVANS/Object-Pad-0.10.tar.gz ... OK Configuring Object-Pad-0.10 ... OK Building and testing Object-Pad-0.10 ... OK Successfully installed Object-Pad-0.10 1 distribution installed Using your "Point" example from the POD, I get this: ARGH unsure how to proceed parse_subsignature at <$dX, $dY ) { Show quoted text
>
ARGH at obj.pl line 9. Removing the "move" method, I have this: #!/usr/bin/env perl use strict; use warnings; use Object::Pad; class Point { has $x = 0; has $y = 0; method describe { print "A point at ($x, $y)\n"; } } my $point = Point->new( 2, 3 ); $point->describe; And when I run it, I get "A point at (0, 0)" 10:43:44 $ perl -v This is perl 5, version 26, subversion 2 (v5.26.2) built for darwin-2level (with 1 registered patch, see perl -V for more detail) Copyright 1987-2018, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. I'm running OS X Catalina, 10.15.2. Best, Ovid
On Sun Feb 16 04:46:13 2020, OVID wrote: <snip> Show quoted text
> #!/usr/bin/env perl > > use strict; > use warnings; > use Object::Pad; > > class Point { > has $x = 0; > has $y = 0; > > method describe { > print "A point at ($x, $y)\n"; > } > } > > my $point = Point->new( 2, 3 ); > $point->describe; > > And when I run it, I get "A point at (0, 0)"
I forgot to mention that I've also tried: my $point = Point->new( x => 2, y => 3 ); my $point = Point->new({ x => 2, y => 3 }); Neither works. I still get (0,0). I was hoping to mention Object::Pad in my upcoming talk in Germany, but unless I can get it to work, I'm stuck :) Best, Ovid
On Sun Feb 16 04:46:13 2020, OVID wrote: Show quoted text
> Hi Paul, > > Object::Pad installed cleanly for me: > > 10:36:40 $ cpanm Object::Pad > --> Working on Object::Pad > Fetching http://www.cpan.org/authors/id/P/PE/PEVANS/Object-Pad- > 0.10.tar.gz ... OK > Configuring Object-Pad-0.10 ... OK > Building and testing Object-Pad-0.10 ... OK > Successfully installed Object-Pad-0.10 > 1 distribution installed > > Using your "Point" example from the POD, I get this: > > ARGH unsure how to proceed parse_subsignature at <$dX, $dY ) {
> >
> ARGH at obj.pl line 9.
That should work on 5.26 and up, it does for me (5.26.1 and 5.30.0 but not 5.24.0) Show quoted text
> Removing the "move" method, I have this: > > #!/usr/bin/env perl > > use strict; > use warnings; > use Object::Pad; > > class Point { > has $x = 0; > has $y = 0; > > method describe { > print "A point at ($x, $y)\n"; > } > } > > my $point = Point->new( 2, 3 ); > $point->describe; > > And when I run it, I get "A point at (0, 0)" >
Object::Pad currently doesn't create a default BUILD sub. I would agree it should. Leon
Yes; at present there isn't any automatic BUILD support The overall concern is that since `has` attributes are private storage, their names never clash between e.g. subclasses or mixed roles or whatever. It isn't a problem for anyone to do has $data; because it won't clash with other classes. It feels as if the $data has lexical scope - exactly as it should. The problem this poses for the constructor is that how would multiple classes which all want `data` know how to handle SomeClass->new( data => 123 ) My current attempt simply avoids the problem; you the programmer must write your BUILD method. Perhaps my SYNOPSIS code could provide one; method BUILD(%args) { $x = $args{x}; $y = $args{y}; } allowing you to then Point->new( x => 2, y => 2 ) which would make that example a little more useful; but doesn't really solve the wider question of how these things might be provided automatically. -- Paul Evans
As to the lack of signatures support, that sounds odd. The unit test t/11method-signatures.t checks that signatures work provided the perl version is 5.26 or above. cpantesters suggests these are working: http://matrix.cpantesters.org/?dist=Object-Pad%200.10;perl=5.26.0;reports=1 I'm unsure what to suggest in your case. Double-check that particular unit test will run on your perl, and compare it to the synopsis-inspired example you wrote. -- Paul Evans
On Sun Feb 16 09:07:23 2020, LEONT wrote: Show quoted text
> That should work on 5.26 and up, it does for me (5.26.1 and 5.30.0 but > not 5.24.0)
I agree: $ perl5.26.2-dbg -Mblib ./synopsis.pl [no error] $ perl5.24.4th -Mblib ./synopsis.pl syntax error at ./synopsis.pl line 7, near "method move(" Global symbol "$dX" requires explicit package name (did you forget to declare "my $dX"?) at ./synopsis.pl line 7. Global symbol "$dY" requires explicit package name (did you forget to declare "my $dY"?) at ./synopsis.pl line 7. syntax error at ./synopsis.pl line 7, at EOF Parse error at ./synopsis.pl line 7. Expected } at ./synopsis.pl line 7. -- Paul Evans