in reply to Re: Help wiht mojolicious
in thread Help with mojolicious

Hmm, I tried it all in one file, files are created, but they're mostly empty , no tables no schema gets created ... weird :)
use strict; use warnings; use Carp::Always; use Devel::VersionDump; BEGIN { package Moblo::Schema::Result::Post; use base qw/DBIx::Class::Core/; # Associated table in database __PACKAGE__->table('posts'); # Column definition __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1, }, author => { data_type => 'text', }, title => { data_type => 'text', }, content => { data_type => 'text', }, date_published => { data_type => 'datetime', }, ); # Tell DBIC that 'id' is the primary key __PACKAGE__->set_primary_key('id'); 1; $INC{'Moblo/Schema/Result/Post.pm'} = __FILE__; } BEGIN { package Moblo::Schema; # based on the DBIx::Class Schema base class use base qw/DBIx::Class::Schema/; # This will load any classes within # Moblo::Schema::Result and Moblo::Schema::ResultSet (if any) __PACKAGE__->load_namespaces(); 1; $INC{'Moblo/Schema.pm'} = __FILE__; } package main; my $schema = Moblo::Schema->connect('dbi:SQLite:goner.moblo.db'); $schema->deploy( { add_drop_table => 1 }, ); $schema->create_ddl_dir; __END__ $ ls -loanh goner.moblo.db -rw-rw-rw- 1 0 0 2015-03-16 23:50 goner.moblo.db $ ls -loanh Moblo*sql -rw-rw-rw- 1 0 156 2015-03-17 00:27 Moblo-Schema-1.x-MySQL.sql -rw-rw-rw- 1 0 103 2015-03-17 00:27 Moblo-Schema-1.x-PostgreSQL.sql -rw-rw-rw- 1 0 132 2015-03-17 00:27 Moblo-Schema-1.x-SQLite.sql $ cat moblo*sql -- -- Created by SQL::Translator::Producer::MySQL -- Created on Tue Mar 17 00:27:26 2015 -- SET foreign_key_checks=0; SET foreign_key_checks=1; -- -- Created by SQL::Translator::Producer::PostgreSQL -- Created on Tue Mar 17 00:27:26 2015 -- -- -- Created by SQL::Translator::Producer::SQLite -- Created on Tue Mar 17 00:27:26 2015 -- BEGIN TRANSACTION; COMMIT;

Replies are listed 'Best First'.
Re^3: Help wiht mojolicious
by ww (Archbishop) on Mar 17, 2015 at 12:36 UTC

    Guess: the AM author of the immediate parent node (to whom this reply is directed) is actually caseycole589 after logging out.

    If so, caseycole589, the same question as posed by the AM of the initial reply stands: what happened? What error/warning messages/ What output? If any, how did it differ from your intent?


    Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
    1. code
    2. verbatim error and/or warning messages
    3. a coherent explanation of what "doesn't work actually means.

      Sorry about that I would have put errors but there weren't many descriptive things/errors to put. It was more I was just lost on where to go and trying random things after spending a couple of hours reading through perl docs I am still pretty new to perl. Thanks everyone for the help shortly after posting this I figured out the dependency on my own. That was one problem the other was I needed to add

      use lib '.'; use Moblo::Schema;

      In a file file in the right directory that was the other

      Guess: the AM author of the immediate parent node (to whom this reply is directed) is actually caseycole589 after logging out.

      Nope, its me ... I figured since it apparently worked for trippledubs, it was weird it didn't work from a singlefile