The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PerlBean::Symbol - Symbol in a Perl bean

SYNOPSIS

 use strict;
 use PerlBean;
 use PerlBean::Attribute::Factory;
 
 my $bean = PerlBean->new( {
     package => 'MyPackage',
 } );
 my $factory = PerlBean::Attribute::Factory->new();
 my $attr = $factory->create_attribute( {
     method_factory_name => 'true',
     short_description => 'something is true',
 } );
 $bean->add_method_factory($attr);
 
 use IO::File;
 -d 'tmp' || mkdir('tmp');
 my $fh = IO::File->new('> tmp/PerlBean.pl.out');
 $bean->write($fh);

ABSTRACT

Symbol in a Perl bean

DESCRIPTION

PerlBean::Symbol allows to specify, declare, assign an export a symbol from a PerlBean.

CONSTRUCTOR

new( [ OPT_HASH_REF ] )

Creates a new PerlBean::Symbol object. OPT_HASH_REF is a hash reference used to pass initialization options. On error an exception Error::Simple is thrown.

Options for OPT_HASH_REF may include:

assignment

Passed to set_assignment().

comment

Passed to set_comment().

declared

Passed to set_declared(). Defaults to 1.

description

Passed to set_description().

export_tag

Passed to set_export_tag(). Must be an ARRAY reference.

symbol_name

Passed to set_symbol_name().

volatile

Passed to set_volatile().

METHODS

add_export_tag(ARRAY)

Add additional values on the list of tags with which the symbol is exported. NOTE: The default tag lets the symbol be exported by default. ARRAY is the list value. The addition may not yield to multiple identical elements in the list. Hence, multiple occurrences of the same element cause the last occurrence to be inserted. On error an exception Error::Simple is thrown.

The values in ARRAY must match regular expression:
^\S*$
delete_export_tag(ARRAY)

Delete elements from the list of tags with which the symbol is exported. NOTE: The default tag lets the symbol be exported by default. Returns the number of deleted elements. On error an exception Error::Simple is thrown.

exists_export_tag(ARRAY)

Returns the count of items in ARRAY that are in the list of tags with which the symbol is exported. NOTE: The default tag lets the symbol be exported by default.

get_assignment()

Returns the value assigned to the symbol during declaration.

get_comment()

Returns the comment for the symbol declaration.

get_description()

Returns the description of the symbol.

get_symbol_name()

Returns the symbol's name (e.g. $var or @list).

is_declared()

Returns whether the symbol is to be declared with our or not.

is_volatile()

Returns whether the symbol is volatile or not.

set_assignment(VALUE)

Set the value assigned to the symbol during declaration. VALUE is the value. On error an exception Error::Simple is thrown.

set_comment(VALUE)

Set the comment for the symbol declaration. VALUE is the value. On error an exception Error::Simple is thrown.

set_declared(VALUE)

State that the symbol is to be declared with our. VALUE is the value. Default value at initialization is 1. On error an exception Error::Simple is thrown.

set_description(VALUE)

Set the description of the symbol. VALUE is the value. On error an exception Error::Simple is thrown.

set_export_tag(ARRAY)

Set the list of tags with which the symbol is exported. NOTE: The default tag lets the symbol be exported by default absolutely. ARRAY is the list value. Each element in the list is allowed to occur only once. Multiple occurrences of the same element yield in the last occurring element to be inserted and the rest to be ignored. On error an exception Error::Simple is thrown.

The values in ARRAY must match regular expression:
^\S*$
set_symbol_name(VALUE)

Set the symbol's name (e.g. $var or @list). VALUE is the value. On error an exception Error::Simple is thrown.

VALUE must match regular expression:
^\S+$
set_volatile(VALUE)

State that the symbol is volatile. VALUE is the value. On error an exception Error::Simple is thrown.

values_export_tag()

Returns an ARRAY containing all values of the list of tags with which the symbol is exported. NOTE: The default tag lets the symbol be exported by default.

write(FILEHANDLE)

Writes the code for the symbol. FILEHANDLE is an IO::Handle object.

SEE ALSO

PerlBean, PerlBean::Attribute, PerlBean::Attribute::Boolean, PerlBean::Attribute::Factory, PerlBean::Attribute::Multi, PerlBean::Attribute::Multi::Ordered, PerlBean::Attribute::Multi::Unique, PerlBean::Attribute::Multi::Unique::Associative, PerlBean::Attribute::Multi::Unique::Associative::MethodKey, PerlBean::Attribute::Multi::Unique::Ordered, PerlBean::Attribute::Single, PerlBean::Collection, PerlBean::Dependency, PerlBean::Dependency::Import, PerlBean::Dependency::Require, PerlBean::Dependency::Use, PerlBean::Described, PerlBean::Described::ExportTag, PerlBean::Method, PerlBean::Method::Constructor, PerlBean::Method::Factory, PerlBean::Style

BUGS

None known (yet.)

HISTORY

First development: March 2003 Last update: September 2003

AUTHOR

Vincenzo Zocca

COPYRIGHT

Copyright 2003 by Vincenzo Zocca

LICENSE

This file is part of the PerlBean module hierarchy for Perl by Vincenzo Zocca.

The PerlBean module hierarchy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The PerlBean module hierarchy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the PerlBean module hierarchy; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA