Skip to content

Commit

Permalink
avoid // where breaks Devel::Cover
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 5, 2024
1 parent 7249231 commit b3f456d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/Data/Frame.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,10 @@ method split (ColumnLike $factor) {
if ($factor->$_DOES('PDL::Factor')) {
$factor = $factor->{PDL};
}
my $uniq_values = $factor->$_call_if_can('uniq')
// [ List::AllUtils::uniq( $factor->flatten ) ];
# avoid // as breaks Devel::Cover
my $uniq_values = $factor->$_call_if_can('uniq');
$uniq_values = [ List::AllUtils::uniq( $factor->flatten ) ]
if !defined $uniq_values;

my @rslt = map {
my $indices = PDL::Primitive::which( $factor == $_ );
Expand Down Expand Up @@ -1390,7 +1392,9 @@ method _compare ($other, $mode) {
return sub {
my ( $col, $x ) = @_;
my $col_isbad = $col->isbad;
my $x_isbad = $x->$_call_if_can('isbad') // 1;
# avoid // as breaks Devel::Cover
my $x_isbad = $x->$_call_if_can('isbad');
$x_isbad = 1 if !defined $x_isbad;
my $both_bad = ( $col_isbad & $x_isbad );

my $rslt = $f->( $col, $x );
Expand Down
4 changes: 3 additions & 1 deletion lib/Data/Frame/Partial/Sugar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ use overload (
if ( $caller eq 'Method::Generate::Accessor::_Generated' ) {
return $self;
}
return ( $self->_tie_hash // $self );
my $tmp = $self->_tie_hash; # avoid // as breaks Devel::Cover
$tmp = $self if !defined $tmp;
$tmp;
},
fallback => 1
);
Expand Down

1 comment on commit b3f456d

@mohawk2
Copy link
Contributor Author

@mohawk2 mohawk2 commented on b3f456d Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works around pjcj/Devel--Cover#350

Please sign in to comment.