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::Symbolobject.OPT_HASH_REFis a hash reference used to pass initialization options. On error an exceptionError::Simpleis thrown.Options for
OPT_HASH_REFmay 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
ARRAYreference. 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
defaulttag lets the symbol be exported by default.ARRAYis 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 exceptionError::Simpleis thrown. - delete_export_tag(ARRAY)
-
Delete elements from the list of tags with which the symbol is exported. NOTE: The
defaulttag lets the symbol be exported by default. Returns the number of deleted elements. On error an exceptionError::Simpleis thrown. - exists_export_tag(ARRAY)
-
Returns the count of items in
ARRAYthat are in the list of tags with which the symbol is exported. NOTE: Thedefaulttag 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.
$varor@list). - is_declared()
-
Returns whether the symbol is to be declared with
ouror not. - is_volatile()
-
Returns whether the symbol is volatile or not.
- set_assignment(VALUE)
-
Set the value assigned to the symbol during declaration.
VALUEis the value. On error an exceptionError::Simpleis thrown. - set_comment(VALUE)
-
Set the comment for the symbol declaration.
VALUEis the value. On error an exceptionError::Simpleis thrown. - set_declared(VALUE)
-
State that the symbol is to be declared with
our.VALUEis the value. Default value at initialization is1. On error an exceptionError::Simpleis thrown. - set_description(VALUE)
-
Set the description of the symbol.
VALUEis the value. On error an exceptionError::Simpleis thrown. - set_export_tag(ARRAY)
-
Set the list of tags with which the symbol is exported. NOTE: The
defaulttag lets the symbol be exported by default absolutely.ARRAYis 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 exceptionError::Simpleis thrown. - set_symbol_name(VALUE)
-
Set the symbol's name (e.g.
$varor@list).VALUEis the value. On error an exceptionError::Simpleis thrown. - set_volatile(VALUE)
-
State that the symbol is volatile.
VALUEis the value. On error an exceptionError::Simpleis thrown. - values_export_tag()
-
Returns an
ARRAYcontaining all values of the list of tags with which the symbol is exported. NOTE: Thedefaulttag lets the symbol be exported by default. - write(FILEHANDLE)
-
Writes the code for the symbol.
FILEHANDLEis anIO::Handleobject.
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