RE: Catalyst and Gedcom
[email protected] ("Brian Cassidy")
| Newsgroups | perl.gedcom |
|---|---|
| Organization | NALD |
| Message-ID | <[email protected]> |
Hi Dave,
> -----Original Message-----
> One of the interesting things I found out at last night's Web Frameworks
> Night[1] in London was that Catalyst[2] has a driver which allows you to
> use a Gedcom file as a model[3].
The Gedcom model for Catalyst you speak of was my creation -- but it's such
a thin wrapper it's hardly worth mentioning. It simply calls Gedcom->new
with whatever config options you specify.
Though this does give you at least one extra benefit, you can easily
configure the model from an external file. Example:
Let's say you have a config.yml file stored in <app home>/conf/ and it looks
like this
--- #YAML:1.0
name: MyGedcom
Model::Gedcom:
gedcom_file: root/my.ged
read_only : 1
in MyGedcom.pm you can do the following:
use YAML qw( LoadFile );
__PACKAGE__->config( LoadFile( __PACKAGE__->path_to( qw( conf config.yml ) )
) );
So, in a nearby controller:
sub foo : Global {
# ...
my $ged = $c->model( 'Gedcom' );
# ...
}
I hope that makes sense. :)
If you can think of anything that needs to be added to this little module,
let me know!
I have my own plans to make a nice web-based Gedcom viewer with some FOAF
integration (*kicks* pjcj :) -- if I ever get around to it.
-Brian