.9999% Pure Moose.

Now I do have a working version of the MooseXs Scaffold and Shortcut and even built out the Shortcut version to not hard-code the LSD classes I might have to load. Now what I do not have a pure Moose version so I think I will stub that out now using what I have learned form the other Modules.

Now it really did not take much time or effort to make this a pure Moose mod. All I had to to was make some adjustments BUILD like this

– grep { -d $_ } map { File::Spec->catdir($_, 'DA_SC','LSD' ) } @INC;
++ grep { -d $_ } map { File::Spec->catdir($_, 'DA_PM','LSD' ) } @INC;

and the same sort of thing in my '_loadLSDClassesFromDir' sub like this

– $classname = join '::', 'DA_SC', 'LSD', $file;
++ $classname = join '::', 'DA_PM', 'LSD', $file;

– unless (does_role($classname,'DA_SC::Roles::LSD'));
++ unless (does_role($classname,'DA_PM::Roles::LSD'));

to match up all my class name-spaces. I did have to change the retrieve sub a little
form this call

my $lsd = DA_SC::LSD::build_instance(
package => "LSD::".ref($conn),
superclasses =>['DA_SC::LSD'],
roles =>[$driver,'DA::Roles::API'],
elements=>$self->elements );

to this

my $lsd = $driver->new({view=>$self->view,

Now with that change, my DA_PM::LSD had to change a bit as well. It is still a role but I had to add in the Element and View attributes as read only, and to save name-space I added in the code from DA::Roles::API and removed that file. So I added the following in.

requires '_execute';
has view => (
is => 'ro',
isa => 'Object',

has elements => (
isa => 'ArrayRef',
is => 'ro',

Now in the Mongo and SQL LSDs all I had to do was add in

use Moose;
++with (qw( DA_PM::Roles::LSD));

I did have to readjust my 02_base.t add in a fake Mongo package and all my test pass

ok 1 - use DA_PM;
ok 2 - use DA::View;
ok 3 - use DA::Element;
ok 4 - Person is a View
ok 5 - Street is an Element
ok 6 - County is an Element
ok 7 - City is an Element
ok 8 - Address is a DA_SC
ok 9 - SQL correct
ok 10 - Mongo Query correct

I did check what happens if I take that 'with' in my SQL LSD out and I go this result

No DSL loaded for DBI::db Maybe you have to load a DSL for it? at D:\GitHub\DA-blog\lib/DA_PM.pm line 117.

So that is good next I took out the required 'connection_class' sub and got this

Load of DA/LSD/SQL.pm failed: Error='DA_PM::Roles::LSD' requires the method 'connection_class' to be implemented by 'DA_PM::LSD::SQL' …

Exactly what I want to see.

So now to make some choices.



Less than 1%? Maybe you meant 99.99%?

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations