Moose Tall Tale

Just another quire review here at the Moose-Pen

Yesterday I summed up what I was up to over the past month or so since I left the Dist-Pen, So tadoy as I am rather sort on time I will just do a quick post-ette on the state of Database::Accessor::Driver::DBI.

Well just for kicks before I revisited any of the Driver::DBI code I re-ran the the very limited test suite of two test case and got a full fail, so I guess every thing is broken.

Looking at the code the first think I noticed was that I have this sub

sub _warn {
my $self = shift;
my ($message) = @_;
warn("Database::Accessor::Driver::DBI: $message ");

Which I was using to key of this DA flag 'da_warning' now what I think I will do is hop back to 'Database::Accessor::Roles::Driver' and add this in

      requires 'DB_Class';
      requires 'execute';
++    requires 'da_warn'; 
What I want to make sure is that any other DAD writer who comes along will have that function implemented I will also have to make a note that there should be a value associated with it for more detailed waring.

And looking a little deeper I see that the sub execute is still in good order but I see that the little code I did write for sub _insert (create) will have to be rewritten as I have some logic there to check for some of those element level flags. I no longer need those rules as I now do that in

Reading a little further along in my very old code I see that I will have add in another attribute to my Database::Accessor::Roles::Driver and that is a param attribute, which will be an array-ref of Database::Accessor::Params and I will need this to store the values coming in on the container. So I added;

has params => (
            is => 'rw',
            isa =>'ArrayRefofParams',
            traits  => ['Array'],
            handles => { param_count => 'count', },
            default => sub { [] },
Now this is a purely local attribute, just a place to store some incoming data-point so they match up when I do some DBI binding. I do not think I need a test for it Database::Accessor but will need one in the driver for sure.

Fortunately not too far down the rabbit hole I think I am good to go without much coding to re-due.

Now a special prize goes to who every can name this character;


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