FAQ

On 15 Sep 2009, at 22:25, Dermot wrote:

2009/9/15 Matt Whipple <matt@mattwhipple.com>:
You want to pass the ref as an argument to create

$schema->create($ref)
I've made some alterations (including the mega laughable typos) but
I'm still getting un-expected results:

Can't call method "select_single" on an undefined value at
/usr/local/share/perl/5.10.0/DBIx/Class/ResultSet.pm line 740.


==============
#!/bin/perl

use strict;
use warnings;
use Carp;
use FindBin qw/$Bin/;
use Data::Dumper;

use lib "$Bin/../lib";
use SPL::Schema;

my $ref = {
number => 'A100/0002',
title => 'A Title',
codixId => 651000002,
};


my $schema = SPL::Schema->resultset('Assets');
# my $schema = SPL::Schema->resultset('Assets')->search();
die "Can't connect $@\n" unless $schema;
print Dumper($ref);
$schema->find_or_create($ref) or warn "Error inserting: $@\n";
#$schema->create($ref) or warn "Error inserting: $@\n"; prints Can't
call method "insert" on an undefined val
======================

Can anyone spot the error of my ways?
Thanx,
Dp.
Looks like never connected your schema to a DB. However the error it
gives leaves a lot to be desired. If you feel up to it, a patch would
be good, otherwise a bug on rt.cpan.org please.

-ash

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 9 | next ›
Discussion Overview
groupdbix-class @
categoriesperl, catalyst
postedSep 15, '09 at 7:49p
activeSep 15, '09 at 9:32p
posts9
users5
websitedbix-class.org
irc#dbix-class

People

Translate

site design / logo © 2021 Grokbase