Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    EntityModel 0.017

    Download button

    No screenshots available
    Downloads: 155  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Tom Molesworth | More programs
    Perl Artistic License / FREE
    September 8th, 2012, 09:37 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    EntityModel description

    Manage entity model definitions

    EntityModel is a Perl module that provides a data storage abstraction system (in the form of an Object Relational Model) for accessing backend storage from Perl and other languages. The intent is to take a model definition and generate or update database tables, caching layer and the corresponding code (Perl/C++/JS) for accessing data.

    SYNOPSIS

     use EntityModel;
     # Define model
     my $model = EntityModel->new->load_from(
     JSON => { entity : [
     { name : 'article', field : [
     { name : 'idarticle', type : 'bigserial' },
     { name : 'title', type : 'varchar' },
     { name : 'content', type : 'text' }
     ], primary => { field : [ 'idarticle' ], separator : ':' }
     ] }
     );
     # Apply PostgreSQL schema (optional, only needed if the model changes)
     $model->apply('PostgreSQL' => { schema => 'datamodel', host => 'localhost', user => 'testuser' });
     # Create Perl classes
     $model->apply('Perl' => { namespace => 'Entity', baseclass => 'EntityModel::EntityBase' });

     my $article = Entity::Article->create(
     title => 'Test article',
     content => 'Article content'
     )->done(sub {
     my $article = shift;
     say "ID was " . $article->id;
     })->fail(sub {
     die 'Failed to create new article';
     });
     Entity::Article->find(
     title => 'Test article'
     )->first(sub {
     my $match = shift;
     $match->title('Revised title');
     die "Instances of the same object should always be linked, consistent and up-to-date"
     unless $article->title eq $match->title;
     });



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    data storage | storage abstraction | model definitions | data | storage | abstraction

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM