File: Base.pm

package info (click to toggle)
libmath-symbolic-perl 0.613-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,268 kB
  • sloc: perl: 12,638; makefile: 9
file content (106 lines) | stat: -rw-r--r-- 2,577 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

=encoding utf8

=head1 NAME

Math::Symbolic::Custom::Base - Base class for tree tests and transformations

=head1 SYNOPSIS

  # Extending the Math::Symbolic::Custom class:
  package Math::Symbolic::Custom::MyTransformations;
  use Math::Symbolic::Custom::Base;
  BEGIN {*import = \&Math::Symbolic::Custom::Base::aggregate_import}
  
  our $Aggregate_Export = [qw/apply_transformation1 .../];
  sub apply_transformation1 {
     # ...
  }

=head1 DESCRIPTION

This is a base class for your extensions to the Math::Symbolic::Custom
class.

To extend the class, just use the following template for your custom class:

  package Math::Symbolic::Custom::MyTransformations;

  use Math::Symbolic::Custom::Base;
  BEGIN {*import = \&Math::Symbolic::Custom::Base::aggregate_import}
  
  our $Aggregate_Export = [...]; # exported subroutines listed here.
  
  # Now implement the subroutines.
  # Exported subroutine names must start with 'apply_', 'mod_',
  # 'is_', 'test_', 'contains_', or 'to_'
  
  # ...
  
  1;

=head2 EXPORT

Uses a custom exporter implementation to export certain routines from the
invoking namespace to the Math::Symbolic::Custom namespace.
But... Nevermind.

=head1 SUBROUTINES

=cut

package Math::Symbolic::Custom::Base;

use 5.006;
use strict;
use warnings;

our $VERSION = '0.613';
our $AUTOLOAD;

=head2 aggregate_import

aggregate_import() is the only public subroutine defined by
Math::Symbolic::Custom::Base and should only be called in BEGIN blocks like
the one shown in the SYNOPSIS above.

=cut

sub aggregate_import {
    my $class = shift;
    no strict 'refs';
    my $subs = ${"${class}::Aggregate_Export"};
    foreach my $sub (@$subs) {
        *{"Math::Symbolic::Custom::$sub"} = \&{"$class\:\:$sub"};
    }
}

1;
__END__

=head1 AUTHOR

Please send feedback, bug reports, and support requests to the Math::Symbolic
support mailing list:
math-symbolic-support at lists dot sourceforge dot net. Please
consider letting us know how you use Math::Symbolic. Thank you.

If you're interested in helping with the development or extending the
module's functionality, please contact the developers' mailing list:
math-symbolic-develop at lists dot sourceforge dot net.

List of contributors:

  Steffen Mller, symbolic-module at steffen-mueller dot net
  Stray Toaster, mwk at users dot sourceforge dot net
  Oliver Ebenhh

=head1 SEE ALSO

New versions of this module can be found on
http://steffen-mueller.net or CPAN. The module development takes place on
Sourceforge at http://sourceforge.net/projects/math-symbolic/

L<Math::Symbolic>

=cut