AutoCode

 view release on metacpan or  search on metacpan

lib/AutoCode/MarshalRoot.pm  view on Meta::CPAN

    my $selector=${"$call\::selector"};
    use strict 'refs';
    if($class =~ /$marshal::(\S+)/){
        my $self=$class->SUPER::new(@args);
        $self->_initialize(@args);
        return $self;
    }else{
        my %params = @args;
        @params{map{lc $_}keys $params}=values %params;
        my $private = $params{$selector}||$params{"-$selector"};
        $private ||= $class->_guess_private(@args);
        $class->throw("Unknown $selector given") unless $private;
        my $private_module="$marshal\::$private";
        return undef unless($class->_load_module($private_module);
        return $private_module->new(@args);
    }
}

1;
__END__

lib/AutoCode/ModuleLoader.pm  view on Meta::CPAN

package AutoCode::ModuleLoader;
use strict;
use AutoCode::ModuleFactory;
our $SCHEMA;
our $FACTORY;
our %LOADED; # Cache

# In the previous design, the method 'import' can load any specific type. And 
# we forbid the feature, since it cannot return virtual package we want, and 
# the users should not guess/predict what the virtual package is, which is the 
# internal business to decide the VP of this AutoCode.

sub import {
    my $pkg=shift;
    $pkg->load_schema(@_) if @_;
}

sub load_schema {
    my ($pkg, $schema, $prefix)=@_;
    AutoCode::Root->_load_module($schema);



( run in 0.684 second using v1.01-cache-2.11-cpan-702932259ff )