line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Math::Symbolic::Custom::Base - Base class for tree tests and transformations |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Extending the Math::Symbolic::Custom class: |
11
|
|
|
|
|
|
|
package Math::Symbolic::Custom::MyTransformations; |
12
|
|
|
|
|
|
|
use Math::Symbolic::Custom::Base; |
13
|
|
|
|
|
|
|
BEGIN {*import = \&Math::Symbolic::Custom::Base::aggregate_import} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $Aggregate_Export = [qw/apply_transformation1 .../]; |
16
|
|
|
|
|
|
|
sub apply_transformation1 { |
17
|
|
|
|
|
|
|
# ... |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This is a base class for your extensions to the Math::Symbolic::Custom |
23
|
|
|
|
|
|
|
class. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
To extend the class, just use the following template for your custom class: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Math::Symbolic::Custom::MyTransformations; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Math::Symbolic::Custom::Base; |
30
|
|
|
|
|
|
|
BEGIN {*import = \&Math::Symbolic::Custom::Base::aggregate_import} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $Aggregate_Export = [...]; # exported subroutines listed here. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Now implement the subroutines. |
35
|
|
|
|
|
|
|
# Exported subroutine names must start with 'apply_', 'mod_', |
36
|
|
|
|
|
|
|
# 'is_', 'test_', 'contains_', or 'to_' |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ... |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 EXPORT |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Uses a custom exporter implementation to export certain routines from the |
45
|
|
|
|
|
|
|
invoking namespace to the Math::Symbolic::Custom namespace. |
46
|
|
|
|
|
|
|
But... Nevermind. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SUBROUTINES |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package Math::Symbolic::Custom::Base; |
53
|
|
|
|
|
|
|
|
54
|
23
|
|
|
23
|
|
674
|
use 5.006; |
|
23
|
|
|
|
|
121
|
|
|
23
|
|
|
|
|
921
|
|
55
|
23
|
|
|
23
|
|
138
|
use strict; |
|
23
|
|
|
|
|
48
|
|
|
23
|
|
|
|
|
821
|
|
56
|
23
|
|
|
23
|
|
119
|
use warnings; |
|
23
|
|
|
|
|
43
|
|
|
23
|
|
|
|
|
1544
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
our $VERSION = '0.612'; |
59
|
|
|
|
|
|
|
our $AUTOLOAD; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 aggregate_import |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
aggregate_import() is the only public subroutine defined by |
64
|
|
|
|
|
|
|
Math::Symbolic::Custom::Base and should only be called in BEGIN blocks like |
65
|
|
|
|
|
|
|
the one shown in the SYNOPSIS above. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub aggregate_import { |
70
|
69
|
|
|
69
|
1
|
162
|
my $class = shift; |
71
|
23
|
|
|
23
|
|
116
|
no strict 'refs'; |
|
23
|
|
|
|
|
50
|
|
|
23
|
|
|
|
|
2666
|
|
72
|
69
|
|
|
|
|
113
|
my $subs = ${"${class}::Aggregate_Export"}; |
|
69
|
|
|
|
|
306
|
|
73
|
69
|
|
|
|
|
183
|
foreach my $sub (@$subs) { |
74
|
368
|
|
|
|
|
429
|
*{"Math::Symbolic::Custom::$sub"} = \&{"$class\:\:$sub"}; |
|
368
|
|
|
|
|
3492
|
|
|
368
|
|
|
|
|
1154
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |