blib/lib/CXC/Number/Grid/Role/PDL.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 CC 2 SCAR 10.6
CC
2
Cov
0%
_convert
6.0
include
2.0
BEGIN
2.0
CRAP 2.9
1 package CXC::Number::Grid::Role::PDL;
2  
3 # ABSTRACT: Role to return PDL objects
4  
5 use v5.28;
6 use PDL::Lite ();
7  
8 use Moo::Role;
9  
10 use experimental 'signatures';
11 use namespace::clean;
12  
13 our $VERSION = '0.12';
14  
15 sub _convert ( $self, $bignum ) {
16 require Ref::Util;
17  
18 return Ref::Util::is_plain_arrayref( $bignum )
19 ? PDL->pdl( [ map { $_->numify } $bignum->@* ] )
20 : $bignum->numify;
21 }
22  
23  
24  
25  
26  
27  
28 sub include ( $self ) {
29 return PDL->pdl( $self->_include );
30 }
31  
32 #
33 # This file is part of CXC-Number
34 #
35 # This software is Copyright (c) 2019 by Smithsonian Astrophysical Observatory.
36 #
37 # This is free software, licensed under:
38 #
39 # The GNU General Public License, Version 3, June 2007
40 #
41  
42 1;
43  
44 __END__
45  
46 =pod
47  
48 =for :stopwords Diab Jerius Smithsonian Astrophysical Observatory
49  
50 =head1 NAME
51  
52 CXC::Number::Grid::Role::PDL - Role to return PDL objects
53  
54 =head1 VERSION
55  
56 version 0.12
57  
58 =head1 SYNOPSIS
59  
60 my $obj = CXC::Number::Grid->new( edges => \@edges );
61 Moo::Role->apply_role_to_object( $obj, 'CXC::Number::Grid::Role::PDL' );
62  
63 =head1 DESCRIPTION
64  
65 A L<Moo> role providing a C<_convert> method which returns passed
66 L<Math::BigFloat> arrays as piddles and passed L<Math::BigFloat> scalars as Perl numbers.
67  
68 =head1 INTERNALS
69  
70 =for Pod::Coverage include
71  
72 =head1 SUPPORT
73  
74 =head2 Bugs
75  
76 Please report any bugs or feature requests to bug-cxc-number@rt.cpan.org or through the web interface at: L<https://rt.cpan.org/Public/Dist/Display.html?Name=CXC-Number>
77  
78 =head2 Source
79  
80 Source is available at
81  
82 https://gitlab.com/djerius/cxc-number
83  
84 and may be cloned from
85  
86 https://gitlab.com/djerius/cxc-number.git
87  
88 =head1 SEE ALSO
89  
90 Please see those modules/websites for more information related to this module.
91  
92 =over 4
93  
94 =item *
95  
96 L<CXC::Number|CXC::Number>
97  
98 =item *
99  
100 L<CXC::Number::Grid|CXC::Number::Grid>
101  
102 =back
103  
104 =head1 AUTHOR
105  
106 Diab Jerius <djerius@cpan.org>
107  
108 =head1 COPYRIGHT AND LICENSE
109  
110 This software is Copyright (c) 2019 by Smithsonian Astrophysical Observatory.
111  
112 This is free software, licensed under:
113  
114 The GNU General Public License, Version 3, June 2007
115  
116 =cut