line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package nonsense; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
78358
|
$nonsense::VERSION = '0.01'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: no-nonsense perl |
6
|
1
|
|
|
1
|
|
12
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
8
|
1
|
|
|
1
|
|
851
|
use true; |
|
1
|
|
|
|
|
29075
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
10170
|
use namespace::autoclean (); |
|
1
|
|
|
|
|
37898
|
|
|
1
|
|
|
|
|
136
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub unimport { |
12
|
1
|
|
|
1
|
|
9
|
my ($class, $command, @args) = @_; |
13
|
1
|
|
|
|
|
3
|
my $into = caller; |
14
|
1
|
|
|
|
|
14
|
strict->import; |
15
|
1
|
|
|
|
|
11
|
warnings->import; |
16
|
1
|
|
|
|
|
7
|
true->import; |
17
|
|
|
|
|
|
|
# return $into unless defined $command; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# if( $command eq 'class' ){ |
20
|
|
|
|
|
|
|
# require Moose; |
21
|
|
|
|
|
|
|
# Moose->import({ into => $into }); |
22
|
|
|
|
|
|
|
# } |
23
|
|
|
|
|
|
|
# elsif( $command eq 'role' ){ |
24
|
|
|
|
|
|
|
# require Moose::Role; |
25
|
|
|
|
|
|
|
# Moose::Role->import({ into => $into }); |
26
|
|
|
|
|
|
|
# } |
27
|
|
|
|
|
|
|
# elsif( $command eq 'library' ){ |
28
|
|
|
|
|
|
|
# require Sub::Exporter; |
29
|
|
|
|
|
|
|
# Sub::Exporter::setup_exporter({ |
30
|
|
|
|
|
|
|
# into => $into, |
31
|
|
|
|
|
|
|
# @args, |
32
|
|
|
|
|
|
|
# }); |
33
|
|
|
|
|
|
|
# } |
34
|
|
|
|
|
|
|
# elsif( $command eq 'type library' ){ |
35
|
|
|
|
|
|
|
# require MooseX::Types; |
36
|
|
|
|
|
|
|
# require MooseX::Types::Moose; |
37
|
|
|
|
|
|
|
# MooseX::Types::Moose->import({ into => $into }, ':all'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# my $types = join ', ', map { '"'. quotemeta($_). '"' } @args; |
40
|
|
|
|
|
|
|
# eval "package $into; MooseX::Types->import(-declare => [$types])"; |
41
|
|
|
|
|
|
|
# } |
42
|
|
|
|
|
|
|
# else { |
43
|
|
|
|
|
|
|
# die "unknown command $command"; |
44
|
|
|
|
|
|
|
# } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# if( $command eq 'class' || $command eq 'role' ){ |
47
|
1
|
|
|
|
|
1134
|
namespace::autoclean->import( |
48
|
|
|
|
|
|
|
-cleanee => $into, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
# } |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
75
|
return $into; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
nonsense - no-nonsense perl |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 0.01 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
package Foo; |
70
|
|
|
|
|
|
|
no nonsense; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This is my contribution to the module-that-enables-pragmas-for-me |
75
|
|
|
|
|
|
|
meme. It enables strict, warnings, automatically makes your module |
76
|
|
|
|
|
|
|
return true, and automatically cleans out your namespace. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
And, let's be honest, "no nonsense" is the best name for a pragma |
79
|
|
|
|
|
|
|
ever. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 BUGS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
If you C |
84
|
|
|
|
|
|
|
nonsense! |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 TODO |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
If you look at the commented-out code in C, I might extend |
89
|
|
|
|
|
|
|
this module to allow even more boilerplate-free programming. If you |
90
|
|
|
|
|
|
|
want a type library, you just say C. If |
91
|
|
|
|
|
|
|
you want a class, you just say C. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This module should integrate with the L pragma, so the degree of |
94
|
|
|
|
|
|
|
nonsense that your module |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 EVAN CARROLL |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Someone mentioned that releasing a module like this makes me look like |
99
|
|
|
|
|
|
|
Evan Carroll. I disagree, as the words "but maintained" appear |
100
|
|
|
|
|
|
|
nowhere in the program text. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Jonathan Rockway |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Jonathan Rockway. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |