Skip to content

Instantly share code, notes, and snippets.

View ryan5500's full-sized avatar

Tomoaki Sano ryan5500

View GitHub Profile
#!/usr/bin/env perl
use warnings;
use strict;
#make module name directory
if (!$ARGV[0]) {
die "given no module name";
}
my $module_name = $ARGV[0];
my $permissions = "0755";
#Makefile.PL
use strict;
use inc::Module::Install; #makefile writer module
name('Example-Software'); #describe module name
all_from('lib/Example/Software.pm'); #file include meta data
requires('Hoge'); #required module
requires('Hoga', '1.00');
#!/usr/bin/env perl
package Coffee;
use Moose;
has 'beans' => (
is => 'rw',
isa => 'ArrayRef'
);
__PACKAGE__->meta->make_immutable;
#!/usr/bin/env perl
#
# Database CRUD test using DBIx::Class module
#
use strict;
use My::Schema;
my $schema = My::Schema->connect('dbi:SQLite:./test.db');
# [C]RUD: create new row at 'Album' table
sub edit_user {
my ($self, $update_info) = @_;
if (!%$update_info) {
return; #ERROR
}
#TODO validate update_info
my $user_obj = models('User')->update(%$update_info);
#!/bin/sh
grep -irl 'match_twit' ./t | xargs -n 1 sh forxargs.sh
use strict;
use warnings;
#use AnyEvent;
use AnyEvent::Strict;
use AnyEvent::Run;
my $match_time_start = AnyEvent->condvar;
my $wait_game_change;
$wait_game_change = AnyEvent::Run->new(
package MatchScraper;
use strict;
use warnings;
use LWP::Simple;
use HTML::TreeBuilder::XPath;
my $tree = HTML::TreeBuilder::XPath->new;
sub scrape {
my $url = shift;
use strict;
use GD::Graph::bars;
use Path::Class qw(dir);
my $dir = dir('.');
my $handle = $dir->open;
while (my $file = $handle->read) {
next unless $_ =‾ /log$/;
for each(var o:* in sprite.getChildren()) {
if(o as MyClass) {
trace('here!');
}
}