Dist::Zilla Party Time

Its a good day for a party here in the Dist-pen.

A milestone here today in the Dist-pen. I finally got;


t/56_retrieve.t ............. ok
t/test.t .................... ok
All tests successful.
Files=26, Tests=319, 34 wallclock secs ( 0.21 usr 0.11 sys + 31.23 cusr 1.99 csys = 33.54 CPU)
Result: PASS
[DZ] all's well; removing .build/usLuCs7LTk

So time for a praty.

Once I got though that problem I had with my last post, I quickly went through the last set of tests updating mostly the includes and the lib call and finally got the result above.

I did notice one thing I kept getting this


t/56_retrieve.t ............. Useless use of string in void context at /home/scolesj/database-accessor/.build/usLuCs7LTk/blib/lib/Database/Accessor.pm line 111.

Now this only cropped up when I added in 'use warnings' in my test files, and then I checked Accessor.pm and sure enough I had forgot to but 'use warnings' in that file hence I was not seeing this until now.

Looking in Accessor.pm and I see it is in this block


eval {
"require $classname";
};

and I can eliminate that warning by adding this in the 'eval' block;


                eval {
++                 no warnings;
                   "require $classname";
                };
and if I re-run my test I get;

t/56_retrieve.t ............. ok
but that led me a little deeper in my code. I was doing that 'require' so it would load the file until run-time and thus I would not load in extra DADs that my user may not be using. However, I did notice that I had that 'require' wrapped in quotes so it really was doing nothing hence the warning I think I will fix this at the source.

              eval {
                    no warnings; 
                   "require $classname";
                };
                if ($@) {
                    my $err = substr( $@, 0, index( $@, ' at ' ) );
                    my $advice =
"Database/Accessor/DAD/$file ($classname) may not be an Database Accessor Driver (DAD)!\n\n";
                    warn(
"\n\n Warning Load of Database/Accessor/DAD/$file.pm failed: \n   Error=$err \n $advice\n"
                    );
                    next;
                }
                else {
                    next
                      unless (
                        does_role(
                            $classname, 'Database::Accessor::Roles::DAD'
                        )
                      );    #now only loads this class
                    $dad->{ $classname->DB_Class } = $classname;
                }
is my original block of code which I stole from a much earlier project the '$@' will never get an error so I can that that out, but the does_role will check that $classname for the role so I think this all I need;

          if (   does_role( $classname, 'Database::Accessor::Roles::DAD' )){
                    $dad->{ $classname->DB_Class } = $classname;)
          };

sot that cleans that up and all my tests still pass.

Now to start setting this up for a real release, once I get all the POD in there.

playdtathing.jpg

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