line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 Unique
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Unique id
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
PhilipRBrenan@yahoo.com, 2004, Perl license
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head2 Synopsis
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Example t/unique.t
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#_ Unique _____________________________________________________________
|
14
|
|
|
|
|
|
|
# Unique
|
15
|
|
|
|
|
|
|
# philiprbrenan@yahoo.com, 2004, Perl License
|
16
|
|
|
|
|
|
|
#______________________________________________________________________
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Math::Zap::Unique;
|
19
|
|
|
|
|
|
|
use Test::Simple tests=>3;
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
ok(unique() ne unique());
|
22
|
|
|
|
|
|
|
ok(unique() ne unique());
|
23
|
|
|
|
|
|
|
ok(unique() ne unique());
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 Description
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Returns a unique id each time it is called.
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package Math::Zap::Unique;
|
36
|
|
|
|
|
|
|
$VERSION=1.07;
|
37
|
4
|
|
|
4
|
|
578
|
use Carp;
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
456
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 Constructors
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head3 unique
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Return new unique id
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $unique = 0;
|
51
|
|
|
|
|
|
|
|
52
|
6
|
|
|
6
|
1
|
102
|
sub unique() {++$unique}
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head3 new
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Return new unique id, synonym for L
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
1
|
|
sub new {unique()}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 Exports
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Export L
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
4
|
|
|
|
|
20
|
use Math::Zap::Exports qw(
|
73
|
|
|
|
|
|
|
unique ()
|
74
|
4
|
|
|
4
|
|
1254
|
);
|
|
4
|
|
|
|
|
9
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#_ Unique _____________________________________________________________
|
77
|
|
|
|
|
|
|
# Package loaded successfully
|
78
|
|
|
|
|
|
|
#______________________________________________________________________
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1;
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Credits
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head3 Author
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
philiprbrenan@yahoo.com
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head3 Copyright
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
philiprbrenan@yahoo.com, 2004
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head3 License
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Perl License.
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut
|