line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1253
|
use 5.12.0; |
|
1
|
|
|
|
|
9
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
package fewer 0.204; |
4
|
|
|
|
|
|
|
# ABSTRACT: use fewer units of a countable resource |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use less 0.03 (); |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
358
|
use parent 'less'; |
|
1
|
|
|
|
|
266
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
0
|
2027
|
sub stash_name { 'less' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=pod |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=encoding UTF-8 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
fewer - use fewer units of a countable resource |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 VERSION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
version 0.204 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use fewer 'top level namespaces'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
As of perl5 version 10, the long-useless pragma L became a usable tool |
32
|
|
|
|
|
|
|
for indicating that less I could be used. For example, the user |
33
|
|
|
|
|
|
|
could specify that less memory should be used, and other libraries could then |
34
|
|
|
|
|
|
|
choose between multiple algorithms based on that choice. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
In the user's program: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use less 'memory'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $result = Analyzer->analyze( $large_data_set ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
In the library: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub analyze { |
45
|
|
|
|
|
|
|
my ($self, $data) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $cache = less->of('memory') ? 'disk' : 'ram'; |
48
|
|
|
|
|
|
|
my $method = "analyze_with_${cache}_cache"; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return $self->$method($data); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This allowed for an explosion of highly adaptive implementions, accounting for |
54
|
|
|
|
|
|
|
a complex matrix of "less" interactions. Unfortunately, with the introduction |
55
|
|
|
|
|
|
|
of new strictures in perl5 version 18, the following code will stop working: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use strict 'English'; |
58
|
|
|
|
|
|
|
use less 'filehandles'; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
To clarify the matter for our foreign readership, "less" is used for things |
61
|
|
|
|
|
|
|
which are uncounted, while "fewer" is used for counted resources. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This library corrects this error by allowing the user to write: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use fewer 'filehandles'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Then, both of the following conditions will be true: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
if ( less->of('filehandles') ) { ... } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if ( fewer->of('filehandles') ) { ... } |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 PERL VERSION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
76
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
77
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
78
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
81
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
82
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
83
|
|
|
|
|
|
|
the minimum required perl. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Ricardo SIGNES |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 CONTRIBUTOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=for stopwords Ricardo Signes |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Ricardo Signes |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
100
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |