Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Evil SQL::Translator::Schema Hack

by jk2addict (Chaplain)
on Aug 08, 2005 at 19:14 UTC ( #481980=perlquestion: print w/replies, xml ) Need Help??

jk2addict has asked for the wisdom of the Perl Monks concerning the following question:

I've been working on a hack against SQL::Translator::Schema to create schemas with a little less keystrokes. tables(), fields(), procedures(), etc change the scope of the objects returned, and all of the other properties like data_type(), size(), name(), nullable(), primary(), etc return $self to perpetuate the the current object.

my $schema = SQL::Translator::RecursiveSchema->new(name=>'MySchema'); $schema->tables('NewTable')->fields('id')->type('varchar')->size(36)-> +nullable(0); # instead of... my $field = $schema->get_table('NewTable')->get_field('id'); $field->size(36); $field->type('varchar'); $field->nullable(0);

This was inspired by a post about hacking the same into HTML::Element.

I wouldn't mind dumping it up on CPAN, but the name for such a beast is elusive to me...::RecursiveSchema, ::ChainedSchema, or something completely different. While it probably belongs in the SQL::Translator namespace, I don't want to invade that namespace if I don't have too. Anyone have any altername naming ideas?


20050809 Unconsidered by Corion (Keep/Edit/Delete: 7/3/0). Was considered by holli for moving to Meditations

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://481980]
Approved by friedo
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2022-01-25 17:48 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (67 votes). Check out past polls.