NAME
Object::Botox - simple object constructor with accessor, prototyping and default-settings of inheritanced values.
VERSION
Version 1.15
SYNOPSIS
Object::Botox writed for easy object creation by default constructor and support managment properties, inherited by children of prototyping class.
package
Parent;
# default properties for ANY object of `Parent` class:
# prop1_ro ISA 'write-protected' && prop2 ISA 'public'
# and seting default value for each other
# strictly named constant PROTOTYPE !
DESCRIPTION
Object::Botox - simple constructor and properties prototyper whith checking of properties existans.
To create parent module:
package
Parent;
use
Botox;
# strictly named constant PROTOTYPE !
'prop1_ro'
=> 1 ,
'prop2'
=>
'abcde'
};
sub
show_prop1{
# It`s poinlessly - indeed property IS A accessor itself
my
(
$self
) =
@_
;
return
$self
->prop1;
}
sub
set_prop1{
# It`s NEEDED for RO aka protected on write property
my
(
$self
,
$value
) =
@_
;
$self
->prop1(
$value
);
}
sub
parent_sub{
# It`s class method itself
my
$self
=
shift
;
return
$self
->prop1;
}
1;
after that we are create instanse:
package
main;
use
Data::Dumper;
# change default value for prop1
my
$foo
= new Parent( {
prop1
=> 888888 } );
Dumper(
$foo
);
outputs get to us:
$VAR1
=
bless
( {
'Parent::prop1'
=> 888888,
'Parent::prop2'
=>
'abcde'
},
'Parent'
);
properties may have _rw[default] or _ro acess mode and inheritated.
eval
{
$foo
->prop1(-23) };
$@.
"\n"
;
output somthing like this:
Can`t change RO properties |prop1| to |-23| in object Parent from main at ./test_more.t line 84
to deal (write to) with this properties we are must create accessor .
Also all of properties are inheritanced.
give to us something like this
$VAR1
=
bless
( {
'Child::prop5'
=> 55,
'Child::prop2'
=>
'abcde'
,
'Child::prop1'
=> 48,
'Child::prop8'
=>
'tetete'
},
'Child'
);
Chainings - all setter return $self in success, so its chained
$baz
->prop1(88)->prop2(
'loreum ipsum'
);
EXPORT
new() method by default
SUBROUTINES/METHODS
new
new() - create object (on hashref-base) by prototype and initiate it from args
SEE ALSO
Moose, Mouse, Class::Accessor, Class::XSAccessor
AUTHOR
Meettya, <meettya at cpan.org>
BUGS
Please report any bugs or feature requests to bug-object-botox at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Botox. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Object::Botox
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2011 Meettya.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.