12 return grep { defined and length }
17 sub stash_name { $_[0] }
22 # If no one wants the result, don't bother computing it.
23 return unless defined wantarray;
25 my $hinthash = ( caller 0 )[10];
27 @tags{ _unpack_tags( $hinthash->{ $class->stash_name } ) } = ();
30 exists $tags{$_} and return !!1 for @_;
40 my $stash = $class->stash_name;
42 @_ = 'please' if not @_;
44 @tags{ _unpack_tags( @_, $^H{ $stash } ) } = ();
46 $^H{$stash} = _pack_tags( keys %tags );
55 @tags{ _unpack_tags( $^H{$class} ) } = ();
56 delete @tags{ _unpack_tags(@_) };
57 my $new = _pack_tags( keys %tags );
59 if ( not length $new ) {
60 delete $^H{ $class->stash_name };
63 $^H{ $class->stash_name } = $new;
67 delete $^H{ $class->stash_name };
79 less - perl pragma to request less of something
87 This is a user-pragma. If you're very lucky some code you're using
88 will know that you asked for less CPU usage or ram or fat or... we
89 just can't know. Consult your documentation on everything you're
92 For general suggestions, try requesting C<CPU> or C<memory>.
98 If you ask for nothing in particular, you'll be asking for C<less
103 =head1 FOR MODULE AUTHORS
105 L<less> has been in the core as a "joke" module for ages now and it
106 hasn't had any real way to communicating any information to
107 anything. Thanks to Nicholas Clark we have user pragmas (see
108 L<perlpragma>) and now C<less> can do something.
110 You can probably expect your users to be able to guess that they can
111 request less CPU or memory or just "less" overall.
113 If the user didn't specify anything, it's interpreted as having used
114 the C<please> tag. It's up to you to make this useful.
120 =head2 C<< BOOLEAN = less->of( FEATURE ) >>
122 The class method C<< less->of( NAME ) >> returns a boolean to tell you
123 whether your user requested less of something.
125 if ( less->of( 'CPU' ) ) {
128 elsif ( less->of( 'memory' ) ) {
132 =head2 C<< FEATURES = less->of() >>
134 If you don't ask for any feature, you get the list of features that
135 the user requested you to be nice to. This has the nice side effect
136 that if you don't respect anything in particular then you can just ask
137 for it and use it like a boolean.
150 =item This probably does nothing.
152 =item This works only on 5.10+
154 At least it's backwards compatible in not doing much.