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.
  • 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 accomplished with related_resultset calls. Interestingly, DBIx::Class has managed to keep the "driverness" to a very small set of variations in the DBIx::Class::Storage subclasses.
    • 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.