| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PDL::Exporter - PDL export control |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Implements the standard conventions for |
|
8
|
|
|
|
|
|
|
import of PDL modules in to the namespace |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Hopefully will be extended to allow fine |
|
11
|
|
|
|
|
|
|
control of which namespace is used. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use PDL::Exporter; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use PDL::MyModule; # Import default function list ':Func' |
|
18
|
|
|
|
|
|
|
use PDL::MyModule ''; # Import nothing (OO) |
|
19
|
|
|
|
|
|
|
use PDL::MyModule '...'; # Same behaviour as Exporter |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SUMMARY |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
C is a drop-in replacement for the L |
|
24
|
|
|
|
|
|
|
module. It confers the standard PDL export conventions to your module. |
|
25
|
|
|
|
|
|
|
Usage is fairly straightforward and best illustrated by an example. The |
|
26
|
|
|
|
|
|
|
following shows typical usage near the top of a simple PDL module: |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package PDL::MyMod; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use strict; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# For Perl 5.6: |
|
34
|
|
|
|
|
|
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
35
|
|
|
|
|
|
|
# For more modern Perls: |
|
36
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
require PDL::Exporter; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
@ISA = qw(PDL::Exporter); |
|
41
|
|
|
|
|
|
|
@EXPORT_OK = qw(inc myfunc); # these will be exported by default |
|
42
|
|
|
|
|
|
|
%EXPORT_TAGS = (Func=>[@EXPORT_OK], |
|
43
|
|
|
|
|
|
|
Internal => [qw/internfunc1 internfunc2/], |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# ... body of your module |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; # end of simple module |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package PDL::Exporter; |
|
54
|
|
|
|
|
|
|
|
|
55
|
123
|
|
|
123
|
|
908
|
use Exporter; |
|
|
123
|
|
|
|
|
222
|
|
|
|
123
|
|
|
|
|
20926
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub import { |
|
58
|
5783
|
|
|
5783
|
|
156740
|
my $pkg = shift; |
|
59
|
5783
|
100
|
|
|
|
44819
|
return if $pkg eq 'PDL::Exporter'; # Module don't export thyself :) |
|
60
|
4357
|
|
|
|
|
10555
|
my $callpkg = caller($Exporter::ExportLevel); |
|
61
|
4357
|
50
|
|
|
|
13992
|
print "DBG: pkg=$pkg callpkg = $callpkg :@_\n" if($PDL::Exporter::Verbose); |
|
62
|
4357
|
100
|
|
|
|
13668
|
push @_, ':Func' unless @_; |
|
63
|
4357
|
100
|
100
|
|
|
20082
|
@_=() if scalar(@_)==1 and $_[0] eq ''; |
|
64
|
4357
|
|
|
|
|
1694873
|
Exporter::export($pkg, $callpkg, @_); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
L |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Copyright (C) Karl Glazebrook (kgb@aaoepp.aao.gov.au). |
|
76
|
|
|
|
|
|
|
Some docs by Christian Soeller. |
|
77
|
|
|
|
|
|
|
All rights reserved. There is no warranty. You are allowed |
|
78
|
|
|
|
|
|
|
to redistribute this software / documentation under certain |
|
79
|
|
|
|
|
|
|
conditions. For details, see the file COPYING in the PDL |
|
80
|
|
|
|
|
|
|
distribution. If this file is separated from the PDL distribution, |
|
81
|
|
|
|
|
|
|
the copyright notice should be included in the file. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |