File: Explicit.pm

package info (click to toggle)
libbadger-perl 0.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: perl: 11,004; makefile: 9
file content (53 lines) | stat: -rw-r--r-- 1,115 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
# test the ability to specify explicit package symbols and subroutine 
# references in export declarations

package My::Exporter::Explicit::Math;

use constant {
    E   => 2.718,
    PI  => 3.141,
    PHI => 1.618,
};

our $ANSWER = 42;


package My::Exporter::Explicit::Science;

sub physics {
    return "E=mc^2";
}

sub biology {
    return "evolution";
}

sub chemistry {
    return "2 H2O -> 2 H2 + O2";
}


package My::Exporter::Explicit;

use Badger::Class
    exports => {
        tags => {
            math => {
                E   =>  'My::Exporter::Explicit::Math::E',
                PI  => '&My::Exporter::Explicit::Math::PI',
                PHI => \&My::Exporter::Explicit::Math::PHI,
                '$ANSWER' => '$My::Exporter::Explicit::Math::ANSWER',
                gamma => '=0.57721',
            },
            science   => {
                physics   => 'My::Exporter::Explicit::Science::physics',
                biology   => '&My::Exporter::Explicit::Science::biology',
                chemistry => \&My::Exporter::Explicit::Science::chemistry,
            },
        }
    };



    
1;