Skip to content

Instantly share code, notes, and snippets.

View TristinDavis's full-sized avatar

Tristin Davis TristinDavis

  • Thrivent Financial
  • Arkansas, USA
  • 09:11 (UTC -05:00)
View GitHub Profile
@TristinDavis
TristinDavis / perl-Mojolicious.spec
Created November 17, 2012 16:02
RPM spec file for Mojolicious
Name: perl-Mojolicious
Version: 3.56
Release: 1%{?dist}
Summary: A next generation web framework for Perl
License: Artistic 2.0
Group: Development/Libraries
URL: http://mojolicious.org/
Source0: http://search.cpan.org/CPAN/modules/by-module/Mojolicous/Mojolicious-%{version}.tar.gz
BuildArch: noarch
BuildRequires: perl >= 0:5.010, perl(ExtUtils::MakeMaker)
#!/usr/bin/perl
use Mojolicious::Lite;
get '/' => { message => '' } => 'index';
post '/' => sub {
my $self = shift;
# getting params
my $email = $self->param('email') || '';
#!/usr/bin/perl
use Mojolicious::Lite;
get '/' => { message => '' } => 'index';
post '/' => sub {
my $self = shift;
# getting params
my $email = $self->param('email') || '';
@TristinDavis
TristinDavis / index.pl
Created November 17, 2012 16:38 — forked from dvinciguerra/index.pl
Mojolicious::Lite and Ajax Example
#!/usr/bin/env perl
use DateTime;
use Mojolicious::Lite;
get '/' => 'index';
get '/service/datetime' => sub {
my $self = shift;
my $dt = DateTime->now;
@TristinDavis
TristinDavis / index.pl
Created November 17, 2012 16:38 — forked from dvinciguerra/index.pl
Mojolicious::Lite and Ajax Example
#!/usr/bin/env perl
use DateTime;
use Mojolicious::Lite;
get '/' => 'index';
get '/service/datetime' => sub {
my $self = shift;
my $dt = DateTime->now;
@TristinDavis
TristinDavis / ioasync.pl
Created November 17, 2012 16:40 — forked from kraih/ioasync.pl
use Mojolicious::Lite;
use EV;
use IO::Async::Process;
use IO::Async::Loop::EV;
my $loop = IO::Async::Loop::EV->new;
get '/' => sub {
my $self = shift;
@TristinDavis
TristinDavis / mojo_lite_ioasync.pl
Created November 17, 2012 16:41 — forked from kraih/ioasync.pl
Mojo::Lite Ex. using IO::Async
use Mojolicious::Lite;
use EV;
use IO::Async::Process;
use IO::Async::Loop::EV;
my $loop = IO::Async::Loop::EV->new;
get '/' => sub {
my $self = shift;
use Mojolicious::Lite;
use EV;
use IO::Async::Process;
use IO::Async::Loop::EV;
my $loop = IO::Async::Loop::EV->new;
get '/' => sub {
my $self = shift;
@TristinDavis
TristinDavis / Perl: WWW::Mechanize
Created November 17, 2012 18:49 — forked from dvinciguerra/www-fgen.pl
Example of using WWW::Mechanize
package WWW::FGen;
use WWW::Mechanize;
# constructor
sub new {
my $class = shift;
return bless {
_mechanize => WWW::Mechanize->new( agent => 'Perl of Love' ),
_url => 'http://mendel.cs.rhul.ac.uk/mendel.php?topic=fgen-file',
@TristinDavis
TristinDavis / Perl: Mojolicious
Created November 17, 2012 18:50
Example of Test::Mojo used to unit test.
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 6;
use Test::Mojo;
my $url = 'http://localhost/~rhaen/index.html';
my $t = Test::Mojo->new;