Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Hi Alias,

    I don't know if I understood completely what you are trying to accomplish, but I think I have developed a similar system, that is used to access different data sources (txt, ftp, http, sql, AS/400, ...) with a single interface. Sql class in particular has the behaviour you mention, in that it supports Postgres, Mysql, Oracle, DB2, Sybase, Informix, ...

    In my case, I have a "Driver" class with many subclasses like Pg, Oracle, Sybase, MSSQL, ... that are embedded in a $self->{driver} membe

  • I'm probably over-simplifying your problem, but I think that the solution adopted by DBIx::Class is a nice brain fit. Under Catalyst, I would say something like:

    my $query = $c->model('Entity::Person');
    $query = $query->search({age => ['==', 30]});
    $query = $query->search({mumble...  => ['==', 'Fido']});
    $query = $query->search(undef, {order_by => 'name ASC'});
    my $adam = $query->first;

    where I don't know how to write the "mumble" part off the top of my head, but it's probably acc

    • Unfortunately, yes this oversimplifies the problem.

      It solves the problem by getting rid of the class tree altogether and using Perl structures.

      Here's another example of the sort of stuff I'm doing.

      # We need a certain type of person
      my $query = MyApp::Entity::Person->Fetch;
      $query->condition('OptimizedFor', '==', 'fun');
                      MyApp::SQL::Clause->new('Lame', 'is null'),
      • Ack, my "less than" condition in the nested structure broke it :(

        But you get the point.