Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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!

Comment on Foray into Tangram and Schemas
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://87171]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-09-20 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (159 votes), past polls