Data::Object::Scalar
Data-Object Scalar Class
use Data::Object::Scalar; my $scalar = Data::Object::Scalar->new(\*main);
Data::Object::Scalar provides routines for operating on Perl 5 scalar objects. Scalar methods work on data that meets the criteria for being a scalar.
This package implements the following methods.
# given \*main my $scalar = Data::Object::Scalar->new(\*main);
The new method expects a scalar reference and returns a new class instance.
# given $scalar $scalar->roles;
The roles method returns the list of roles attached to object. This method returns a Data::Object::Array object.
my $rules = $scalar->rules;
The rules method returns consumed rules.
# given $scalar $scalar->defined; # 1
The defined method returns true if the object represents a value that meets the criteria for being defined, otherwise it returns false. This method returns a Data::Object::Number object.
# given $scalar $scalar->eq; # exception thrown
This method is a consumer requirement but has no function and is not implemented. This method will throw an exception if called.
# given $scalar $scalar->ge; # exception thrown
# given $scalar $scalar->gt; # exception thrown
# given $scalar $scalar->le; # exception thrown
# given $scalar $scalar->lt; # exception thrown
# given $scalar $scalar->ne; # exception thrown
This package inherits all behavior from the folowing role(s):
Data::Object::Role::Detract
Data::Object::Role::Dumper
Data::Object::Role::Output
Data::Object::Role::Throwable
Data::Object::Role::Type
This package adheres to the requirements in the folowing rule(s):
Data::Object::Rule::Comparison
Data::Object::Rule::Defined
To install Data::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Object
CPAN shell
perl -MCPAN -e shell install Data::Object
For more information on module installation, please visit the detailed CPAN module installation guide.