Skip to content

Instantly share code, notes, and snippets.

=head2 run( @args, $opts )
my $exit = $cmd->run( @args, $opts );
my ( $output, $exit ) = $cmd->run( @args, $opts );
Run the command with with given C<@args> and C<$opts>. C<@args>
are the positional arguments to give to the command. C<$opts>
is a hash reference of options. Possible options are:
=over
@preaction
preaction / text.txt
Created March 18, 2016 22:33
Presentation categories
Cloud
Community
Data/Storage
Design
DevOps
IoT/Maker
Languages
Mobile/Client
Project Management
Security
@preaction
preaction / new-role.t
Last active March 22, 2016 17:23
Testing HTML constructs with Test::Mojo
use Test::Mojo::WithRoles 'HTML';
$t->form_ok( 'main form' => {
username => 'ddupree',
name => 'Debbie Dupree',
email => '[email protected]',
password => '',
password_verify => '',
active => 1,
role => 'admin',
@preaction
preaction / Building Command-line Tools the UNIX Way.markdown
Last active February 29, 2016 00:21
YAPC::NA 2016 Talk Proposals

Want to build great command-line utilities? This talk focuses on the UNIX philosophy of building good command-line tools that are composeable, reusable, scriptable, and do what the user expects.

This talk will go over the differences between the default filehandles (STDIN, STDOUT, STDERR), how options and arguments should behave, and how to use the surrounding shell environment to your tool's advantage (including all the code you don't have to write because of the shell's tools).

Perl is used for examples, but this talk is about UNIX and GNU conventions and best practices for command-line programs.

use strict;
use warnings;
use feature qw( :5.10 );
use Benchmark qw( cmpthese );
use List::Util qw( reduce );
my @index_tags = qw( -foo +bar -baz );
my @pages = (
use trap;
trap ( qr{Out of memory} ) {
$big_data = undef;
return main(); # Try again
}
trap ( $_->isa( 'HTTP::Response' ) && $_->code != 200 ) {
return error_page( $_ );
#!/usr/bin/env perl
# Run a CPAN::Reporter::Smoker under the current Perl
# To start the daemon:
# perl smoker.pl start
# To stop the daemon:
# perl smoker.pl stop
#
# To start the smoker under all Perls in perlbrew:
# perlbrew exec perl smoker.pl start
my $server = $c->stash( 'server' );
my $group = $c->model->server->get_server( $server )->group;
my @servers = $c->model->server->get_servers_in_group( $group );
# ... OR ...
my @servers = $c->model->server->get_servers_in_group( $c->model->server->get_server( $server )->group );

NAME

CoolApp

SYNOPSIS

# config.yml
1/2 cup unsalted butter, plus more to butter the molds
4 ounces bittersweet chocolate, preferably Valrhona
2 eggs
2 egg yolks
1/4 cup sugar
2 teaspoons flour, plus more for dusting
1. In the top of a double boiler set over simmering water, heat the butter and
chocolate together until the chocolate is almost completely melted. While