[jifty-devel] beginner at jifty needs help finding my way about

Shawn M Moore sartak at bestpractical.com
Wed Jun 3 22:40:50 EDT 2009


Hi Bill,

On Wed, Jun 03, 2009 at 10:23:14PM -0400, William F. Dudley Jr. wrote:
> Hi,
> I consider myself an experienced developer but am new to jifty, and wanted to
> avoid ruby on rails because I already use Perl.

Great. :)

> I've fooled around with the tutorials and am trying to build my own application
> (the only way I can lear, I'm afraid), and cannot seem to find things in the
> documentation, so I thought I'd ask here.

That's fine. Please ask questions, there's no better indicator of where
we need to improve documentation.

> First question:
> 
> In one of the tutorials, one creates a lib/MyApp/View.pm, and in there it
> says:
>     # Display each reader in a <dl>.
>     dl {
>         dt { }
>         dd { }
>         }
> 
> I understand what this does, but where is the documentation for the functions
> dl(), dt(), and dd() ?  Surely there must be other functions to create
> other HTML
> markup but I can't find them even after browsing the various docs for hours.

This is Template::Declare code (brought in via "use
Jifty::View::Declare"). Every common (and many uncommon) HTML tag is
exposed to you. The only caveat is that "tr" is "row" and "td" is
"cell". (tr is a special Perl builtin that we can't override)

> Second question:
> 
> I've created an App with two tables, one of which has "indices" into the other.
> 
> What documents should I be reading to figure out how to search for a record,
> or to retrieve a record based on an index or other field in a table?

Our ORM is called Jifty::DBI. The API documentation is available in
Jifty::DBI::Record and Jifty::DBI::Collection. The methods you want to
look at are Record's load_by_cols and Collection's limit.

> My record
> pointers are NOT the native "autoincrement" unsigned int that one
> would typically
> use, since the application calls for records to have unique identifiers that are
> hardware based, sort of like the MAC address on an ethernet interface.  So
> even though my app will create records 1,2,3,..., they will have unique codes
> based on the hardware, which will not, in general, be monotonically increasing
> or start with 1.

Yep, that is fine. You could use something like:

    my $computer = MyApp::Model::Computer->new;
    $computer->load_by_cols(
        MAC => $MAC,
    );

> 
> Thanks in advance,
> Bill Dudley

Enjoy!

Shawn


More information about the jifty-devel mailing list