File Coverage

blib/lib/PDL/Complex/Overloads.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 24 27 88.8


line stmt bran cond sub pod time code
1             package PDL::Complex::Overloads;
2 11     11   100 use strict;
  11         26  
  11         614  
3 11     11   72 use warnings;
  11         27  
  11         983  
4 11     11   74 use parent 'Math::Complex';
  11         25  
  11         178  
5 11     11   147370 use overload fallback => 1;
  11         31  
  11         80  
6              
7 114     114 0 468 sub cplx { bless &Math::Complex::cplx, __PACKAGE__ }
8              
9             # needed for JSON serialisation
10             sub FREEZE {
11 17     17 0 128 my ($self, $serialiser) = @_;
12 17         160 return %$self;
13             }
14             sub THAW {
15 17     17 0 61 my ($self, $serialiser, @data) = @_;
16 17         90 return bless {@data}, $self;
17             }
18              
19             =head1 NAME
20              
21             PDL::Complex::Overloads - subclass of Math::Complex with overload fallbacks
22              
23             =head1 SYNOPSIS
24              
25             require PDL::Complex::Overloads;
26             my $same = PDL::Complex::Overloads::cplx(1, 2) eq '1+2i';
27              
28             =head1 DESCRIPTION
29              
30             This is a subclass whose only purpose is to provide L's
31             overloads but with C true, mainly to allow string-comparison
32             for backwards compatibility.
33              
34             =head1 AUTHOR
35              
36             Ed J
37              
38             =head1 SEE ALSO
39              
40             L
41              
42             =cut
43              
44             1;