File Coverage

blib/lib/Acme/Eatemup.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 7 7 100.0


line stmt bran cond sub pod time code
1 1     1   316 use 5.004;
  1         3  
2             package Acme::Eatemup;
3 1     1   4 @ISA=Exporter;use Exporter;@EXPORT=qw(yumyum eatemup);
  1         1  
  1         68  
4             require XSLoader;XSLoader'load(__PACKAGE__,
5             $VERSION='0.02'
6             );*yumyum=*eatemup;
7              
8             =head1 NAME
9              
10             Acme::Eatemup - A list chopper
11              
12             =head1 VERSION
13              
14             0.02
15              
16             =head1 SYNOPSIS
17              
18             print foo(), yumyum; # all but the last element
19             print foo(), eatemup; # same
20              
21             =head1 DESCRIPTION
22              
23             Have you ever needed all but the last two items of a list? Have you ever
24             been annoyed that Perl's C<(...)[...]> list slice has no way for you to
25             specify that without knowing the number of items? Then this module is for
26             you. Before, you would have to write:
27              
28             my @tmp = foo();
29             print @tmp[0..$#tmp-2]; # ugly
30              
31             Or:
32              
33             my @tmp = foo();
34             pop @tmp, pop @tmp; # or splice @tmp, -2
35             print @tmp; # THREE lines!
36              
37             With this module, you can simply eat them off the list:
38              
39             use Acme::Eatemup;
40             print foo(), yumyum, eatemup;
41              
42             =head1 INSPIRATION
43              
44             $,=",",$\="\n";
45             sub eat(){goto z;not 1 .do{z:1}}
46             print 1,2,eat,3,4;
47              
48             Output:
49              
50             1,,3,4
51              
52             =head1 PREREQUISITES
53              
54             This module requires perl 5.004 or later. Whether it actually works that
55             far back I have not verified. (The earliest I tested it with was 5.8.7.)
56              
57             =head1 BUGS
58              
59             There is no check to see whether you are eating more items off the list
60             that are present. When used carelessly, this module can crash perl.
61              
62             Please report bugs to
63             L.
64              
65             =head1 AUTHOR & COPYRIGHT
66              
67             Copyright (C) 2017 Father Chrysostomos (sprout at, um,
68             cpan dot
69             org)
70              
71             This program is free software; you may redistribute or modify it (or both)
72             under the same terms as perl.
73              
74             =head1 SEE ALSO
75              
76             L