Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Test::More;
BEGIN { use_ok 'StockRoom::Model::StockDB' }
my $schema = StockRoom::Model::StockDB->new;
my $parts = $schema->resultset('TblStock')->search(undef,
{
page => 1,
[edward@eddarch StockRoom]$ prove -l t/model_StockDB.t
t/model_StockDB.t .. 1/? # $VAR1 = bless( {
# 'total_entries' => 0,
# 'current_page' => 1,
# 'entries_per_page' => 10
# }, 'Data::Page' );
t/model_StockDB.t .. ok
All tests successful.
Files=1, Tests=1, 3 wallclock secs ( 0.05 usr 0.02 sys + 1.17 cusr 0.12 csys = 1.36 CPU)
Result: PASS
package EspressoParts::Scraper;
use Moose;
use WWW::Mechanize;
use HTML::TreeBuilder::XPath;
#ABSTRACT: Scrapes the site for parts
has parts => (
is => 'rw',
isa => 'ArrayRef[HashRef]',
sub next_manufacturer {
my $self = shift;
state $i = 0; #XXX: Breaks if used across multiple objects
my @manufacturers = @{$self->manufacturers};
return $manufacturers[$i++] || 0;
}
#!/usr/bin/env perl
use strict;
use warnings;
use File::Slurp qw(read_file);
my @zone_files = glob('/var/named/*.db');
my $out_dir = '/home/datastore/newzones/'; # always include trailing slash
use Net::DNS::ZoneFile::Fast;
use strict;
use warnings;
use Test::More;
BEGIN { use_ok 'StockRoom::Model::StockDB' }
my $schema = StockRoom::Model::StockDB->new;
my $parts = $schema->resultset('TblStock')->search(undef,
{
page => 1,
package StockRoom::View::Web;
use strict;
use warnings;
use base 'Catalyst::View::TT';
__PACKAGE__->config(
TEMPLATE_EXTENSION => '.tt',
render_die => 1,
package StockRoom;
use Moose;
use namespace::autoclean;
use Catalyst::Runtime 5.80;
# Set flags and add plugins for the application.
#
# Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
# therefore you almost certainly want to keep ConfigLoader at the head of the
[edward@eddarch StockRoom]$ prove -l t/model_StockDB.t
t/model_StockDB.t .. 1/? $VAR1 = bless( {
'total_entries' => 0,
'current_page' => 1,
'entries_per_page' => 10
}, 'Data::Page' );
use strict;
use warnings;
use Test::More;
BEGIN { use_ok 'StockRoom::Model::StockDB' }
my $schema = StockRoom::Model::StockDB->new;
my $parts = $schema->resultset('TblStock')->search(undef,
{
page => 1,