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

NAME

Object - Basic object

SYNOPSIS

use App::Framework::Lite::Object ;

DESCRIPTION

DIAGNOSTICS

Setting the debug flag to level 1 prints out (to STDOUT) some debug messages, setting it to level 2 prints out more verbose messages.

AUTHOR

Steve Price <sdprice at cpan.org>

BUGS

None that I know of!

INTERFACE

new([%args])

Create a new object.

The %args are specified as they would be in the set method, for example:

        'mmap_handler' => $mmap_handler

Special arguments are:

        'fields'        => Either ARRAY list of valid field names, or HASH of field names with default values 

Example:

        new(
                'fields' => {
                        'cmd'           => undef,
                        'status'        => 0,
                        'results'       => [],
                        
                )
        )

All defined fields have an accessor method created.

init([%args])

Initialises the newly created object instance.

init_class([%args])

Initialises the object class variables.

add_fields($fields_href, $args_href)

Adds the contents of the HASH ref $fields_href to the args HASH ref ($args_href) under the key 'fields'. Used by derived objects to add their fields to the parent object's fields.

init_class_instance([%args])

Initialises the object class variables. Creates a class instance so that these methods can also be called via the class (don't need a specific instance)

global_debug(level)

Set global debug print options to level.

        0 = No debug
        1 = standard debug information
        2 = verbose debug information
global_verbose(level)

Set global verbose print level to level.

        0 = None verbose
        1 = verbose information
        2 = print commands
        3 = print command results
strict_fields($flag)

Enable/disable strict field checking

class_instance([%args])

Returns an object that can be used for class-based calls - object contains all the usual fields

has_class_instance()

Returns true if this class has a class instance object

allowed_class_instance()

Returns true if this class can have a class instance object

field_list()

Returns hash of object's field definitions.

debug(level)

Set debug print options to level.

undef_debug()

Set debug print options flag to undefined.

verbose(level)

Set verbose print options to level.

undef_verbose()

Set verbose print options flag to undefined.

field_access($field, [$val])

Get/set a field value. Used by derived objects to get/set the underlying object field variable when they have overridden that field's access method.

set(%args)

Set one or more settable parameter.

The %args are specified as a hash, for example

        set('mmap_handler' => $mmap_handler)

Sets field values. Field values are expressed as part of the HASH (i.e. normal field => value pairs).

vars([@names])

Returns hash of object's fields (i.e. field name => field value pairs).

If @names array is specified, then only returns the HASH containing the named fields.

DESTROY()

Destroy object

check_instance()

If this is not an instance (i.e. a class call), then if there is a class_instance defined use it, otherwise error.

copy_attributes($target)

Transfers all the supported attributes from $this object to $target object.

class()

Returns name of object class.

clone()

Create a copy of this object and return the copy.

quote_str($str)

Returns a quoted version of the string.

expand_vars($string, \%vars)

Work through string expanding any variables, replacing them with the value stored in the %vars hash. If variable is not stored in %vars, then that variable is left.

Returns expanded string.

dump_callstack()

Print out the call stack. Useful for debug output at a crash site.