[jifty-devel] Tutorial questions

Jesse Vincent jesse at bestpractical.com
Wed Jan 4 13:14:51 EST 2006


Rob Kinyon wrote:
> First off, this looks very very cool. It's the closest to Rails I've
> seen in Perl, which is impressive.
>
> I'm just starting to run through the tutorial now and I've run into
> the following items:
>
> 1) If you run the following commands, you hit an error (No
> inc::Module::Install found)
>   jifty app --name MyWebLog
>   cd MyWebLog
>   perl Makefile.PL
> Having remedied that by copying the inc found in SVN, I am now able to
> run "make test" with the base Post model and I'm happy.
>

Jifty should depend on Module::Install


> 2) I don't like SQLite. So, I want to use MySQL. The tutorial says if
> I want to do that, I need to look in Jifty::Config. Except,
> Jifty::Config doesn't tell me anything about what to set. So, I look
> in Jifty::DBI and Jifty::DBI::mysql, but they don't talk about config
> files. So, I hop into etc/config.yml and it looks pretty simple. So, I
> change the user/pw to something my db has and the schema to "test". I
> run "make test" and hit the following:


here's a "full"  etc/config.yml for "BTDT" our inhouse app. You up for
patching the Jifty::Config docs to describe the database setup?


---
framework:
   ApplicationClass: BTDT
   AdminMode: 0
   ActionBasePath: BTDT::Action
   LogConfig: etc/btdt.log4perl.conf
   Web:
     Port: 8008
     TemplateRoot: html
     StaticRoot: static
     BaseURL: http://localhost
   Database:
     Database: jifty
     Driver: Pg
     Host: localhost
     User: postgres
     Version: 0.2.17
     Password: ''
     RequireSSL: 0
   Mailer: IO
   MailerArgs:
     - %log/mail.log%
   SiteConfig: etc/site_config.yml
application:
   MaxWurbles: 9




>
> "Connect Failed Access denied for user 'rob'@'localhost' to database
> 'testtest' at /usr/lib/perl5/site_perl/5.8.6/i486-linux/Jifty/Script/Schema.pm
> line 409"
>
> That's cool, except I put "test", not "testtest". So, there seem to be
> different schemas based on whether you're doing dev vs. testing, like
> in Rails. Where is this documented?

Good question. Possibly nowhere yet.

> 3) I fix the schema name issue and run "make test" again. This time, I
> hit the following:
>
> error creating a table: Couldn't execute the query 'CREATE TABLE posts (
>   id INTEGER NOT NULL  AUTO_INCREMENT,
>   body text NULL  ,
>   title text NULL DEFAULT 'Untitled post' ,
>   PRIMARY KEY (id)
> )
> 'BLOB/TEXT column 'title' can't have a default value at
> /usr/lib/perl5/site_perl/5.8.6/i486-linux/Jifty/Script/Schema.pm line
> 224.
>
> That's not a MySQL idiosyncracy, that's a SQLite idiosyncracy.
>
> 4) I change the columntype for title to "varchar". Now, it complains
> about the syntax:
>
> error creating a table: Couldn't execute the query 'CREATE TABLE posts (
>   id INTEGER NOT NULL  AUTO_INCREMENT,
>   body text NULL  ,
>   title varchar NULL DEFAULT 'Untitled post' ,
>   PRIMARY KEY (id)
> )
> 'You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'NULL DEFAULT 'Untitled post' ,
>
> I fix this by changing varchar => varchar(255) and the tests pass. I
> would've thought that Jifty::DBI::mysql would be smart enough to fix
> this problem.

It should be passing everything on. I'm not sure where that's coming from.



> 5) Whenever I ran "make test", the weblogtest database would
> disappear! This means I cannot run "make test" twice in a row. Why
> does it disappear?!? This is a serious usability issue.

Starting your testing with a dirty database is a serious probelm in my
book. Can you explain what you're trying to do in a bit more detail?

(Break this one out into a separate message?)


> 6) Why can't I use Module::Build instead of Module::Install? For one
> thing, adding in new actions is very simple. Take a look at
> Module::Build::JSAN for an example. Some actions I can see being handy
> would be "create_databases", "load_fixtures", etc. A
> Module::Build::Jifty would definitely be in order.


By all means. Feel free to change the Makefile.PL to a Build.PL.
Personally, I don't much care for Module::Build, but there's nothing
stopping you. And I'm sure others would love the functionality. The
Makefile.pl is all about having one sane default.


> 7) Something I noticed when sourcediving - "use warnings" is all over
> the place. Yet, I didn't see a restriction on Perl version 5.6+
> anywhere in the install process. If it's 5.6+, that's cool. Just make
> sure that it's restricted to that in the install process. Also, if you
> have "use warnings", you don't need "-w" in the tests. Also, I noticed
> that Jifty::DBI::Column doesn't have strictures or warnings enabled.
I
> would recommend that the specific stricture be disabled in a tight
> section vs. disabling all strictures for the file.

I suspect that last is an oversight, not an intentional non-stricture.
Actually, in my version it does. And going back to Jifty::DBI 0.06, it
does too. Did you mean something else?

Jifty defaults everything to UTF8, so I think we're actually 5.8.3+.
(Because RT is, everything in house assumes 5.8.3, so we didn't catch
that....oh. no.  the Makefile.PL does enforce that.


> More thoughts later.
>

I look forward to it :)

Jesse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20060104/ced93a47/signature-0001.pgp


More information about the jifty-devel mailing list