Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
constant::boolean(3) User Contributed Perl Documentation constant::boolean(3)

constant::boolean - Define TRUE and FALSE constants.

  use constant::boolean;

  use File::Spec;

  sub is_package_exist {
    my ($package) = @_;
    return FALSE unless defined $package;
    foreach my $inc (@INC) {
        my $filename = File::Spec->catfile(
            split( /\//, $inc ), split( /\::/, $package )
        ) . '.pm';
        return TRUE if -f $filename;
    return FALSE;

  no constant::boolean;

Defines "TRUE" and "FALSE" constants in caller's namespace. You could use simple values like empty string or zero for false, or any non-empty and non-zero string value as true, but the "TRUE" and "FALSE" constants are more descriptive.

It is virtually the same as:

  # double "not" operator is used for converting scalar to boolean value
  use constant TRUE => !! 1;
  use constant FALSE => !! '';

The constants exported by "constant::boolean" are not reported by Test::Pod::Coverage, so it is more convenient to use this module than to define "TRUE" and "FALSE" constants by yourself.

The constants can be removed from class API with "no constant::boolean" pragma or some universal tool like namespace::clean.

If you find the bug or want to implement new features, please report it at <>

Piotr Roszatycki <>

Copyright 2008, 2009 by Piotr Roszatycki <>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <>

2009-11-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.