Skip to content

Instantly share code, notes, and snippets.

@Woody2143
Woody2143 / Index.pm
Created November 9, 2012 14:56
Untainting data in Moose::Util::TypeConstraints
package Index;
use Moose;
use namespace::autoclean;
use Index::Types;
use POSIX qw(strftime);
has 'date' => (
is => 'rw',
isa => 'Index::Types::Date',
@Woody2143
Woody2143 / Index.pm
Created November 2, 2012 01:32
I am a horrible horrible person
package Index;
use Moose;
use namespace::autoclean;
use Index::Types;
use IPC::System::Simple qw(capture);
use POSIX qw(strftime);
has 'date' => (
@Woody2143
Woody2143 / Index.pm
Created October 16, 2012 14:07
Moose Customer Error on Type Constraint Violation
package Index;
use Mouse;
use namespace::autoclean;
use Index::Types;
has 'date' => (
is => 'rw',
isa => 'Index::Types::Date',
@Woody2143
Woody2143 / Index.pm
Created October 9, 2012 16:49
coerce doesn't work for me; I'm doing something wrong
package Index;
use Mouse;
use Mouse::Util::TypeConstraints;
subtype 'phonenumber',
as 'Str',
where { length($_) > 6 },
message { "This number ($_) is not a valid phone number!" };
#!/export/home/bwood/perl/bin/perl
use Modern::Perl;
use Test::More tests => 1;
use_ok( 'Remote' ) or exit;
@Woody2143
Woody2143 / CDRIndex.pm
Created February 1, 2011 02:22
test module. Rough example: running CGIIndex->search would return a list of files contained in $date.txt
package CDRIndex;
use strict;
use warnings;
sub new {
my ($class, %args) = @_;
bless \%args, $class;
}
package MergeFunctions;
# Usage: `use MergeFunctions qw( getURL, mergeFiles );`
use strict;
use warnings;
use base qw(Exporter);
our $VERSION = 1.00;
our @EXPORT_OK = qw( &getURL &mergeFiles );
sub getURL {
# <--SNIP-->
my $total_files = @files;
my %file_data;
my @files_to_search;
my $start_file;
my $end_file;
for ( my $i = 0; $i < $total_files; $i++) {
# Convert the filename to a date and get epoch
package SnoopDatabase::File;
sub get_url {
use Expect;
$Expect::Exp_Internal = 0;
$Expect::Log_Stdout = 0;
$Expect::Multiline_Matching = 1;
package DateRange;
# Usage: `use DateRange qw( getDateArray );`
use strict;
use warnings;
use base qw(Exporter);
our $VERSION = 1.00;
our @EXPORT_OK = qw( &getDateArray );
sub getDateArray {