Posted on 2009-06-30 16:49:05-07 by sirrobert
Moose isn't creating a constructor.
Hey all. I'm experienced with OO perl, but have only built a dozen or so classes with Moose. I'm trying to extend DBI in Moose but ... they don't seem to be friendly with each other =) Can someone please explain what's wrong here? I feel like it's probably something simple that I'm missing. When I "use base" the script runs without error. With "extends" it balks. Here's the error I'm getting:
Can't locate object method "new" via package "DBIX_sample" at ./test.pl line 7.
Here's my source: test.pl
#!/usr/bin/perl use strict; use warnings; use DBIX_sample; my $db = DBIX_sample->new; exit;
DBIX_sample.pm
package DBIX_sample; use Moose; ### Works when I 'use base' but not with 'extends.' extends 'DBI'; #use base 'DBI'; 1;
This is perl, v5.8.8 built for i686-linux
Direct Responses: 11095 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.