Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Foray into Tangram and Schemas

by rob_au (Abbot)
on Jun 09, 2001 at 14:41 UTC ( #87171=perlquestion: print w/replies, xml ) Need Help??
rob_au has asked for the wisdom of the Perl Monks concerning the following question:

This node has been sparked following my question from yesterday (Metadata and DBI Abstraction) into parsing DBI table metadata in the attempt to build an abstraction layer for some CGI scripts I am building for a medium-to-large web site.
First of all, I must express thanks to the many monks who /msg-ed me with suggestions and links for my problem - One of which (links, not monks) led me to the Tangram module which allows the creation of orthogonal object abstraction and persistence through UML schemas. While this may not be the final road that I go down for the implementation of my DBI abstraction, this module (I feel) offers some very powerful methods. My problem however, is how to get it all working - For example, following the documentation in the Tangram PODs and on the Tangram Home page, I started experimenting with schema to this end:
#!/usr/bin/perl use strict; use Tangram; my ($schema) = Tangram::Schema->new( 'classes' => { 'item' => { 'table' => 'test', 'abstract' => 1, 'fields' => { 'string' => [ qw( category description_short description_long description_table image_1 image_2 supplier_id barcode_id ) ], 'int' => [ qw( manufacturer supplier ) ] } } } ); $schema->deploy();

But, despite this following closely to examples from these sources, I am presented with:
rob@kathmandu:/development$ ./test.perl Can't locate object method "deploy" via package "Tangram::Schema" (per +haps you forgot to load "Tangram::Schema"?) at ./test.perl line 31.

Surely this is something simple which I have overlooked or forgotten, but I have done a little digging (more mundane and rudimentary attempts which I won't bore my fellow monks with) with little success. Prehaps, some of the well know proponents of DBIx::Recordset and Tangram could provide me with further enlightenment?
Thanks in advance,

Ooohhh, Rob no beer function well without!

Replies are listed 'Best First'.
Re: Foray into Tangram and Schemas
by mugwumpjism (Hermit) on Jun 09, 2001 at 17:13 UTC

    One thing I've noticed about Tangram is its shockingly inaccurate documentation and poor error messages when you pass an unexpected object type to a function. But when you do call it with the correct syntax it seems to work well :).

    Once you have a schema, you need to deploy it with a back end. So if you're deploying to a generic relational database:

    #!/usr/bin/perl use strict; use Tangram; use Tangram::Relational; my ($schema) = Tangram::Schema->new( 'classes' => { 'item' => { 'table' => 'test', 'abstract' => 1, 'fields' => { 'string' => [ qw( category description_short description_long description_table image_1 image_2 supplier_id barcode_id ) ], 'int' => [ qw( manufacturer supplier ) ] } } } ); Tangram::Relational->deploy($schema);

    s/Relational/mysql/ if you're using MySQL.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://87171]
Approved by root
[Cosmic37]: FANN also has LGPL license which I like and its supposed to be quite a capable library from what I read
[corenth]: Cosmic, that sounds interesting. What is FANN (I could search it if I weren't so lazy about it)?
[Cosmic37]: how big was @stuff corenth?
[Cosmic37]: Fast Artificial Neural Network (FANN) is cross-platform open source programming library for developing multilayer feedforward Artificial Neural Networks
[corenth]: @stuff was pretty big. I think it grew to about 8000.
[corenth]: each element was several three + element references
[corenth]: That FANN thing sounds like something I
[Cosmic37]: When I say I like LGPL what I mean is that I like the GPL aspect. I am a fan of Rishard Stallman and the Free Software Foundation but I wish I could be more virtuous... self-flagellates
[corenth]: . . . I'd like to play with

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2018-02-20 18:21 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.