README
1NAME
2 constant::boolean - Define TRUE and FALSE constants.
3
4SYNOPSIS
5 use constant::boolean;
6
7 use File::Spec;
8
9 sub is_package_exist {
10 my ($package) = @_;
11 return FALSE unless defined $package;
12 foreach my $inc (@INC) {
13 my $filename = File::Spec->catfile(
14 split( /\//, $inc ), split( /\::/, $package )
15 ) . '.pm';
16 return TRUE if -f $filename;
17 };
18 return FALSE;
19 };
20
21 no constant::boolean;
22
23DESCRIPTION
24 Defines `TRUE' and `FALSE' constants in caller's namespace. You could
25 use simple values like empty string or zero for false, or any non-empty
26 and non-zero string value as true, but the `TRUE' and `FALSE' constants
27 are more descriptive.
28
29 It is virtually the same as:
30
31 # double "not" operator is used for converting scalar to boolean value
32 use constant TRUE => !! 1;
33 use constant FALSE => !! '';
34
35 The constants exported by `constant::boolean' are not reported by
36 Test::Pod::Coverage, so it is more convenient to use this module than to
37 define `TRUE' and `FALSE' constants by yourself.
38
39 The constants can be removed from class API with `no constant::boolean'
40 pragma or some universal tool like namespace::clean.
41
42AUTHOR
43 Piotr Roszatycki <dexter@cpan.org>
44
45LICENSE
46 Copyright 2008, 2009 by Piotr Roszatycki <dexter@cpan.org>.
47
48 This program is free software; you can redistribute it and/or modify it
49 under the same terms as Perl itself.
50
51 See http://www.perl.com/perl/misc/Artistic.html
52
53