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

Hello Monks,
UPDATE: I need help iterating through a resultset of DBIx::Class::ResultSet. It does not appear to give me the amount of records I specify on command line. Here is is my code:
#! /usr/bin/env perl use strict; use warnings; use Getopt::Long; use DBIx::Class::ResultSet; use Data::Dumper; use My::App::Schema; use Smart::Comments '###'; my $max_records = ''; GetOptions("max_records=i" => \$max_records) or die ("Error in command line arguments\n"); my @results = My::App::Schema->schema->resultset('MyTable')->all; for my $result ( @results ) { ### Processing Domain ID: ($result->id) for ( 0..$max_records ) { print $result."\n"; } }
Any insight is greatly appreciated :)

Replies are listed 'Best First'.
Re: Iterating through DBIx resultset
by stonecolddevin (Parson) on Jul 02, 2014 at 17:23 UTC
      Awesome, stonecolddevin, that worked - Thank you. I'm not all that great at DBIx yet -but that cookbook was a better source than the normal docs.

        It's a bit of a bear, and the docs are definitely a jungle, but that cookbook is a great starting place. Jump on #dbix-class on irc.perl.org and you'll get a lot of good help figuring out things that aren't immediately intuitive.

        Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

Re: Iterating through DBIx resultset
by Your Mother (Archbishop) on Jul 02, 2014 at 19:05 UTC

    Sidenote: the namespace in question is DBIx::Class not DBIx. Many DBIx::Class users abbreviate it DBIC. DBIx is a prefix to hundreds of unrelated packages.

      Thanks! Noted and updated the title of the post :)