Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Moo and Spreadsheet::ParseExcel

by tobyink (Abbot)
on Nov 08, 2012 at 22:17 UTC ( #1003003=note: print w/ replies, xml ) Need Help??


in reply to Moo and Spreadsheet::ParseExcel

I'm not able to reproduce that error message. Are you using the latest versions of all three modules? You could try re-ordering the use statements, perhaps putting Moo::Role first.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: Moo and Spreadsheet::ParseExcel
Download Code
Re^2: Moo and Spreadsheet::ParseExcel
by karlgoethebier (Curate) on Nov 09, 2012 at 07:59 UTC
    Spreadsheet::ParseExcel 0.59 Moo 1.000005 MooX::Types::MooseLike::Base 0.16

    All up to date. Re-ordering the use statements brought no success. I've tried this already. I don't have any idea for the moment.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      What's in run.pl??

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

        The whole stuff:

        ETL.pm

        package Karl::ETL; use Moo; use MooX::Types::MooseLike::Base qw( Str ); has user => ( is => 'rw', isa => Str ); has passwd => ( is => 'rw', isa => Str ); has dsn => ( is => 'rw', isa => Str ); with qw( Karl::DBIxODBC Karl::MyParseExcel ); 1;

        DBIxODBC.pm

        package Karl::DBIxODBC; use Moo::Role; use MooX::Types::MooseLike::Base qw(InstanceOf HashRef ArrayRef); use DBIx::Simple; requires qw( user passwd dsn ); has 'loader' => ( is => 'rw', isa => HashRef[ ArrayRef ], trigger => \&_load, ); has '_dbix' => ( is => 'ro', isa => InstanceOf('DBIx::Simple'), handles => [qw( insert )], builder => '_build_dbix', lazy => 1, ); sub _build_dbix() { my $self = shift; my $connect_string; $connect_string = "dbi:ODBC:" . $self->dsn; DBIx::Simple->new( $connect_string, $self->user, $self->passwd ); } sub _load() { my ( $self, $input ) = @_; my $table = ( keys %$input )[0]; foreach my $row ( @{ $input->{$table} } ) { $self->insert( $table, $row ); } } 1;

        MyParseExcel.pm

        package Karl::MyParseExcel; use Moo::Role; use Spreadsheet::ParseExcel; use MooX::Types::MooseLike::Base qw(InstanceOf Str); 1;

        etl.pl (was run.pl)

        #!C:/perl/bin/perl.exe use strict; use warnings; use lib q(C:/local/lib/perl); use Karl::ETL; my $etl = Karl::ETL->new( dsn => 'dsn_name', user => 'name', passwd => 'secret', ); my $data->{test} = [ [qw(foo bar)] ]; $etl->loader($data);
        Regards, Karl
        «The Crux of the Biscuit is the Apostrophe» Karl Goethebier
Re^2: Moo and Spreadsheet::ParseExcel
by karlgoethebier (Curate) on Nov 09, 2012 at 10:35 UTC

    The only plan i have at the moment is: Not using roles and rewrite the stuff.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003003]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2014-08-22 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (158 votes), past polls