This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub next_manufacturer { | |
my $self = shift; | |
state $i = 0; #XXX: Breaks if used across multiple objects | |
my @manufacturers = @{$self->manufacturers}; | |
return $manufacturers[$i++] || 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package StockRoom::View::Web; | |
use strict; | |
use warnings; | |
use base 'Catalyst::View::TT'; | |
__PACKAGE__->config( | |
TEMPLATE_EXTENSION => '.tt', | |
render_die => 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |