in reply to Inserting a relation into a database with Class::DBI
You create a hashref called $session_rec which probably should be passed to insert like so# is this a requirement or can both records be created at once? #my $session_rec = MyDbase::Session->insert({ my $session_rec = { 'id' => $session_id, 'timestamp' => time, }; #});
my $session_rec = MyDbase::Session->insert( my $session_rec = { 'id' => $session_id, 'timestamp' => time, }; );
Notice that I've removed a pair of braces from your called to insert that were attempting to create a hashref from $session_rec which is already a hashref.
When I try to do something similar here, I get the error I expected.
my $hr2 = { my $hr1 = { A => 1, B => 2 } }; #Odd number of elements in anonymous hash at /home/funky/play line 46.
Standard Disclaimer.txt
I haven't used DBI::Class in a long while, so I may be a mile off the mark.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inserting a relation into a database with Class::DBI
by wojtyk (Friar) on May 29, 2007 at 16:39 UTC | |
by agianni (Hermit) on May 29, 2007 at 17:54 UTC |