Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#356 overload::Method() does not return coderef for stringification

critical
open
nobody
None
5
2014-07-04
2014-07-04
Zakariyya Mughal
No

This may be a Perl bug. I'm not sure why it is happening:

use Test::More;
use PDL;
my $pdl = sequence(3,3);
ok( overload::Method($pdl, '""'), 'piddle stringifies');
done_testing;

The test fails because overload::Method() returns undef. This is not the
case with any of the other PDL overloaded operators nor do other objects that
stringify exhibit the same behaviour.

Discussion

  • As discussed in #pdl, the overload for stringification in PDL/Core.pm is listed as

    "\"\""  =>  \&PDL::Core::string   );
    

    PDL::Core::string is just an alias to PDL::string. Changing the overload to

    "\"\""  =>  \&PDL::string   );
    

    fixes the reported bug.