[Catalyst] TheSchwartz and Catalyst, Data::Objectdriver new + no strict

Adam Sjøgren adsj at novozymes.com
Mon Nov 12 09:24:58 GMT 2007


  Hi.

I am in the process of wiring calls to TheSchwartz into a Catalyst
application (to queue indexing jobs).

When I do a $client->insert() from a standalone script, everything is
fine, but when I do the same thing from within Catalyst, I get an error:

 Can't use string ("Data::ObjectDriver::Driver::DBD:") as a SCALAR ref
 while "strict refs" in use at
 /usr/share/perl5/Data/ObjectDriver/Driver/DBD.pm line 13

Adding the patch included below to Data::ObjectDriver::Driver::DBD makes
it work as expected (no error, job is inserted in the job-queue).

I wonder why it is not needed "outside" Catalyst, but within. I guess
that it is due to some module that Catalyst uses, and my script doesn't
- but which one?

(The standalone script does use strict; use warnings; so it is not one
one those :-))

Just curious...

  Best regards,

    Adam

[Catalyst 5.7007, Data::ObjectDriver 0.04, TheSchwartz 1.04]

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com

--- DBD.pm.orig	2007-11-12 09:56:12.056777877 +0100
+++ DBD.pm	2007-11-12 10:02:21.473628001 +0100
@@ -10,10 +10,13 @@
     my($name) = @_;
     die "No Driver" unless $name;
     my $subclass = join '::', $class, $name;
+  {
+    no strict;
     unless (defined ${"${subclass}::"}) {
         eval "use $subclass"; ## no critic
         die $@ if $@;
     }
+  }
     bless {}, $subclass;
 }
 



More information about the Catalyst mailing list