Last active
January 2, 2016 04:19
-
-
Save zmughal/8249456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package DoublePDL; | |
use strict; | |
use warnings; | |
use parent qw( PDL::Exporter ); | |
our @EXPORT_OK = qw(double_pdl); | |
our %EXPORT_TAGS = (Func=>[@EXPORT_OK], Internal => [],); | |
*double_pdl = \&PDL::double_pdl; | |
sub PDL::double_pdl { | |
my $pdl = shift; | |
$pdl * 2; | |
} | |
1; | |
__END__ | |
use PDL; | |
use DoublePDL; | |
use Test::More; | |
my $p = sequence(10); | |
ok( all($p->double_pdl == 2 * $p) ); | |
ok( all( double_pdl($p) == $p->double_pdl ) ); | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
context