Skip Menu |
 

This queue is for tickets about the Tangence CPAN distribution.

Report information
The Basics
Id: 97483
Status: resolved
Priority: 0/
Queue: Tangence

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

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



Subject: Tangence::Class precedence issues
Download (untitled) / with headers
text/plain 361b
Noticed this today - the checks for missing entries in %metas use 'or' instead of '||': sub for_name { my $class = shift; my ( $name ) = @_; return $metas{$name} or croak "Unknown Tangence::Class for '$name'"; } the 'or' clause will never fire due to return kicking in first: $ perl -e'(sub { return 0 or die "here" })->()' $ cheers, Tom
Download (untitled) / with headers
text/plain 217b
On Fri Jul 25 01:15:29 2014, TEAM wrote: Show quoted text
> Noticed this today - the checks for missing entries in %metas use 'or' > instead of '||':
Oops; yes. And a couple more in Tangence::Struct. Patch attached. -- Paul Evans
Subject: rt97483.patch
Download rt97483.patch
text/x-diff 1.7k
=== modified file 'lib/Tangence/Class.pm' --- lib/Tangence/Class.pm 2014-03-30 19:26:01 +0000 +++ lib/Tangence/Class.pm 2014-08-13 21:03:35 +0000 @@ -101,10 +101,16 @@ ); } + my @superclasses; + foreach ( @{ $args{superclasses} } ) { + push @superclasses, Tangence::Class->for_perlname( $_ ); + } + $self->define( - methods => \%methods, - events => \%events, - properties => \%properties, + methods => \%methods, + events => \%events, + properties => \%properties, + superclasses => \@superclasses, ); } @@ -133,7 +139,7 @@ my $class = shift; my ( $name ) = @_; - return $metas{$name} or croak "Unknown Tangence::Class for '$name'"; + return $metas{$name} || croak "Unknown Tangence::Class for '$name'"; } sub for_perlname @@ -142,7 +148,7 @@ my ( $perlname ) = @_; ( my $name = $perlname ) =~ s{::}{.}g; - return $metas{$name} or croak "Unknown Tangence::Class for '$perlname'"; + return $metas{$name} || croak "Unknown Tangence::Class for '$perlname'"; } sub superclasses === modified file 'lib/Tangence/Struct.pm' --- lib/Tangence/Struct.pm 2014-03-30 19:54:18 +0000 +++ lib/Tangence/Struct.pm 2014-08-13 21:03:35 +0000 @@ -98,7 +98,7 @@ my $class = shift; my ( $name ) = @_; - return $STRUCTS_BY_NAME{$name} or croak "Unknown Tangence::Struct for '$name'"; + return $STRUCTS_BY_NAME{$name} || croak "Unknown Tangence::Struct for '$name'"; } sub for_perlname @@ -106,7 +106,7 @@ my $class = shift; my ( $perlname ) = @_; - return $STRUCTS_BY_PERLNAME{$perlname} or croak "Unknown Tangence::Struct for '$perlname'"; + return $STRUCTS_BY_PERLNAME{$perlname} || croak "Unknown Tangence::Struct for '$perlname'"; } sub perlname
Released in 0.20 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.