Ambrosia::core::ClassFactory - a factory of classes.
version 0.010
require Ambrosia::core::ClassFactory; #In memory (on fly) Ambrosia::core::ClassFactory::create('Employes::Person', {public => qw/FirstName LastName Age/}); my $p = new Employes::Person(FirstName => 'John', LastName => 'Smith', Age => 33); #From module Employes/Person.pm (Employes::Person created by Ambrosia::Meta) my $p = Ambrosia::core::ClassFactory::create_object('Employes::Person', (FirstName => 'John', LastName => 'Smith', Age => 33)); print $p->FirstName; #John
Ambrosia::core::ClassFactory is a factory of classes that allows to produce classes on the fly, to create objects of certain type and just to load packages.
Ambrosia::core::ClassFactory
Produces class of represented type dynamically with represented fields. create($package, $fields); in params: $package - name of class ('Foo::Bar::Baz') $fields - hash. See L<Ambrosia::Meta>
Loads the package and creates the appropriate object and initializes it by the specified parameters. in params: $package - name of class ('Foo::Bar::Baz') %params - data hash.
Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to B<use> but without B<BEGIN> in params: $package - name of class ('Foo::Bar::Baz') equivalent: require Foo::Bar::Baz; Foo::Bar::Baz->import;
Ambrosia::core::Exceptions Ambrosia::Meta
Not tested.
Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.
Ambrosia
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Nikolay Kuritsyn (knm[at]cpan.org)
To install Ambrosia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ambrosia
CPAN shell
perl -MCPAN -e shell install Ambrosia
For more information on module installation, please visit the detailed CPAN module installation guide.