The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Begin::Declare - compile time my and our

VERSION

version 0.04

SYNOPSIS

don't you hate writing:

my ($foo, @bar);
BEGIN {
    ($foo, @bar) = ('fooval', 1 .. 10);
}

when you should be able to write:

MY ($foo, @bar) = ('fooval', 1 .. 10);

just use Begin::Declare; and you can.

EXPORT

use Begin::Declare;

is the same as:

use Begin::Declare qw (MY OUR);

you can also write:

use Begin::Declare qw (My Our);

if you prefer those names.

DECLARATIONS

MY ... = ...;

    works just like the keyword my except it lifts the assignment to compile time.

    MY $x = 1;            # my $x; BEGIN {$x = 1}
    MY ($y, $z) = (2, 3); # my ($y, $z); BEGIN {($y, $z) = (2, 3)}

OUR ... = ...;

    works just like the keyword our except it lifts the assignment to compile time.

    OUR ($x, @xs) = 1 .. 10;  # our ($x, @xs); BEGIN {($x, @xs) = 1 .. 10}

AUTHOR

Eric Strom, <asg at cpan.org>

BUGS

please report any bugs or feature requests to bug-begin-declare at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Begin-Declare. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

the authors of Devel::Declare

LICENSE AND COPYRIGHT

copyright 2011 Eric Strom.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

see http://dev.perl.org/licenses/ for more information.