#!/usr/bin/perl use Data::Dumper; use DateTime;#is that what was missing? could be use lib 'lib'; use JournalApp::Schema; my $entry = { id => 12, fulltext => "hello world test test test", image_url => "http://myimage.com/new.png", date => DateTime->now()->epoch, }; #our $schema = JournalApp::Schema->connect( 'dbi:SQLite:./journals.db', '', ''); our $schema = JournalApp::Schema->connect( 'dbi:mysql:database=journal;host=localhost;port=3306', 'journal_user', 'journal_password', { quote_names => 1 }); sub test_remove_from_db{ #delete by id my $journalentry = $schema->resultset('Journal')->find({ id => $entry->{id} }); $journalentry->delete(); } sub test_get_entry_by_date{ my $res = $schema->resultset('Journal')->search({ -and => [ date => { '>', DateTime->now()->epoch - 3600 * 24 * 2 }, date => { '<=', DateTime->now()->epoch }, ] }, { order_by => "date" } ); foreach my $row ($res->all){ print Dumper $row->id; #so it just didn't find anything? looks so yeah just needed <= } } sub test_add_journal_entry{ my $journalentry = $schema->resultset('Journal')->create($entry); if ($journalentry){ print "added sucessfully\n"} else { "add failed\n" }; return $journalentry; } #how do I connect? sub main{ test_add_journal_entry; test_get_entry_by_date; test_remove_from_db; } main();