Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

const::fast(3pm) [debian man page]

Const::Fast(3pm)					User Contributed Perl Documentation					  Const::Fast(3pm)

NAME
Const::Fast - Facility for creating read-only scalars, arrays, and hashes VERSION
version 0.011 SYNOPSIS
use Const::Fast; const my $foo => 'a scalar value'; const my @bar => qw/a list value/; const my %buz => (a => 'hash', of => 'something'); SUBROUTINES
/METHODS const $var, $value const @var, @value... const %var, %value... This the only function of this module and it is exported by default. It takes a scalar, array or hash lvalue as first argument, and a list of one or more values depending on the type of the first argument as the value for the variable. It will set the variable to that value and subsequently make it readonly. Arrays and hashes will be made deeply readonly. Exporting is done using Sub::Exporter for flexibility on import. RATIONALE
This module was written because I stumbled on some serious issues of Readonly that aren't easily fixable without breaking backwards compatibility in subtle ways. In particular Readonly's use of ties is a source of subtle bugs and bad performance. Instead, this module uses the builtin readonly feature of perl, making access to the variables just as fast as any normal variable without the weird side- effects of ties. Readonly can do the same for scalars when Readonly::XS is installed, but chooses not to do so in the most common case. This may change in the future if someone takes up maintenance of Readonly, and the two modules may be convergence if that happens. CAVEATS
Perl doesn't distinguish between restricted hashes and readonly hashes. This means that: use Const::Fast; const my %a => (foo => 1, bar => 2); say 1 unless $a{baz} Will give the error "Attempt to access disallowed key 'baz' in a restricted hash". You have to use "exists $a{baz}" instead. This is a limitation of perl that can hopefully be solved in the future. ACKNOWLEDGEMENTS
The interface for this module was inspired by Eric Roode's Readonly. The implementation is inspired by doing everything the opposite way Readonly does it. AUTHOR
Leon Timmermans <fawaka@gmail.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-04-22 Const::Fast(3pm)

Check Out this Related Man Page

PPIx::Utilities::Statement(3pm) 			User Contributed Perl Documentation			   PPIx::Utilities::Statement(3pm)

NAME
PPIx::Utilities::Statement - Extensions to PPI::Statement. VERSION
This document describes PPIx::Utilities::Statement version 1.1.0. SYNOPSIS
use PPI::Document qw< >; use PPIx::Utilities::Statement qw< get_constant_name_elements_from_declaring_statement >; my $document = PPI::Document->new('Readonly::Scalar my $THINGY => 47.2;'); # Returns the PPI::Token::Symbol for "$THINGY". my ($constant) = get_constant_name_elements_from_declaring_statement( $document->schild(0) ); DESCRIPTION
This is a collection of functions for dealing with PPI::Statements. INTERFACE
Nothing is exported by default. "get_constant_name_elements_from_declaring_statement($statement)" Given a PPI::Statement, if the statement is a Readonly or Const::Fast declaration statement or a "use constant", returns the names of the things being defined. Given use constant 1.16 FOO => 'bar'; this will return the PPI::Token::Word containing 'FOO'. Given use constant 1.16 { FOO => 'bar', 'BAZ' => 'burfle' }; this will return a list of the PPI::Tokens containing 'FOO' and 'BAZ'. Similarly, given Readonly::Hash my %FOO => ( bar => 'baz' ); or const my %FOO => ( bar => 'baz' ); this will return the PPI::Token::Symbol containing '%FOO'. BUGS AND LIMITATIONS
Please report any bugs or feature requests to "bug-ppix-utilities@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHOR
Thomas R. Wyant, III "<wyant at cpan dot org>" COPYRIGHT
Copyright (c) 2009-2010 Thomas R. Wyant, III. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.10.1 2010-12-03 PPIx::Utilities::Statement(3pm)
Man Page