Skip to content

use of overload method #3

@hvds

Description

@hvds

A cpangrep shows that Datify appears to have the same issue with using the coderef returned by overload::Method that I found in Test::More.

To correctly invoke XS methods I think you will need something like:

# in is_numeric
         if ( my $method = $self->overloaded($_) ) {
-            $_ = $_->$method();
+            $_ = $_->$method(undef, undef);
         }
# in objectify
     } elsif ( my $method = $self->overloaded($object) ) {
-        $data = $self->scalarify( $object->$method() );
+        $data = $self->scalarify( $object->$method(undef, undef) );
     } elsif ( my $attrkeyvals = $object->can('_attrkeyvals') ) {

(I didn't check to see if you were calling overloaded() from other modules.)

See also Perl/perl5#19388 for the proposed doc patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions