Skip to content

Instantly share code, notes, and snippets.

@zmughal
Last active January 2, 2016 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmughal/8249456 to your computer and use it in GitHub Desktop.
Save zmughal/8249456 to your computer and use it in GitHub Desktop.
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;
@zmughal
Copy link
Author

zmughal commented Jan 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment