once - Execute code only once throughout the program's lifetime


once documentation  | view source Contained in the once distribution.

Index


NAME

Top

once - Execute code only once throughout the program's lifetime

VERSION

Top

version 1.101420

SYNOPSIS

Top

    use once;

    sub setup {
        my $self = shift;
        ONCE {
            print "run only once however often setup() is called"
        };
        # other_things();
    }

DESCRIPTION

Top

This module provides a way to run code only once, no matter how often the surrounding code is called.

METHODS

Top

ONCE

This subroutine is exported automatically. It takes a code block and executes it only the first time that this specific call of ONCE is encountered. This might be useful, for example, in a situation where you initialize an object but only want to do it the first time any object of that class is initialized, perhaps to install methods or setup some other data.

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=once.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/once/.

The development version lives at http://github.com/hanekomu/once/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


once documentation  | view source Contained in the once distribution.