1constant::boolean(3)  User Contributed Perl Documentation constant::boolean(3)
2
3
4

NAME

6       constant::boolean - Define TRUE and FALSE constants.
7

SYNOPSIS

9         use constant::boolean;
10
11         use File::Spec;
12
13         sub is_package_exist {
14           my ($package) = @_;
15           return FALSE unless defined $package;
16           foreach my $inc (@INC) {
17               my $filename = File::Spec->catfile(
18                   split( /\//, $inc ), split( /\::/, $package )
19               ) . '.pm';
20               return TRUE if -f $filename;
21           };
22           return FALSE;
23         };
24

DESCRIPTION

26       Defines "TRUE" and "FALSE" constants in caller's namespace.  You could
27       use simple values like empty string or zero for false, or any non-empty
28       and non-zero string value as true, but the "TRUE" and "FALSE" constants
29       are more descriptive.
30
31       It is virtually the same as:
32
33         # double "not" operator is used for converting scalar to boolean value
34         use constant TRUE => !! 1;
35         use constant FALSE => !! '';
36
37       The constants exported by "constant::boolean" are not reported by
38       Test::Pod::Coverage, so it is more convenient to use this module than
39       to define "TRUE" and "FALSE" constants by yourself.
40

AUTHOR

42       Piotr Roszatycki <dexter@debian.org>
43

LICENSE

45       Copyright 2008 by Piotr Roszatycki <dexter@debian.org>.
46
47       This program is free software; you can redistribute it and/or modify it
48       under the same terms as Perl itself.
49
50       See <http://www.perl.com/perl/misc/Artistic.html>
51
52
53
54perl v5.12.0                      2010-04-30              constant::boolean(3)
Impressum