ManaTools::Shared::PropertiesRole

Section: User Contributed Perl Documentation (3)
Updated: 2017-07-06
Page Index
 

NAME

    ManaTools::Shared::PropertiesRole - a Properties Moose::Role

 

SYNOPSIS package Foo;

    with 'ManaTools::Shared::PropertiesRole';

    1;

    ...

    my $f = Foo->new();
    my @props = $f->properties();
    my $vendor = $f->prop('vendor');
    $f->prop('vendor', 'myself');
    $f->remove('vendor');
    $f->prop_from_file('vendor', '/sys/bus/scsi/2:0:0:0/vendor');

 

DESCRIPTION

    This Role is a collection of Properties

 

SUPPORT

    You can find documentation for this Role with the perldoc command:

    perldoc ManaTools::Shared::PropertiesRole

 

AUTHOR

    Maarten Vanraes <alien@rmail.be>

 

COPYRIGHT and LICENSE

Copyright (c) 2015 Maarten Vanraes <alien@rmail.be>

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

This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

METHODS

 

properties

OUTPUT

    array of string

DESCRIPTION

    this method returns a list of Property keys

 

has_prop

INPUT

    $key: string

OUTPUT

    1 if Property is assigned, 0 otherwise

DESCRIPTION

    this method checks if it has the properties assigned

 

prop

INPUT

    $key: string
    $value: optional value to set

OUTPUT

    value of the Property

DESCRIPTION

    this method gets the value of a Property and optionally sets it

 

prop_from_file

INPUT

    $key: string
    $file: file with value to set

OUTPUT

    value of the Property, or undef if failed

DESCRIPTION

    this method sets the value of a Property from a file and returns the value

 

remove

INPUT

    $key: string

DESCRIPTION

    this method removes a property


 

Index

NAME
SYNOPSIS package Foo;
DESCRIPTION
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
METHODS
properties
has_prop
prop
prop_from_file
remove