Skip to content

Instantly share code, notes, and snippets.

View jjn1056's full-sized avatar

John Napiorkowski jjn1056

View GitHub Profile
package Local::MyApp::Controller::Session;
use Moose;
extends 'Catalyst::Controller::PerRequest';
has person => (
is => 'rw',
isa => DBICResult,
lazy => 1,
default => sub($self) {
jnapiorkowski@MM-MAC-11294 Valiant % OPENSSL_PREFIX=/usr/local/opt/[email protected] cpanm Net::SSLeay -v
cpanm (App::cpanminus) 1.7044 on perl 5.034000 built for darwin-2level
Work directory is /Users/jnapiorkowski/.cpanm/work/1636310557.29093
You have make /usr/bin/make
You have /usr/bin/curl
You have /usr/bin/tar: bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
You have /usr/bin/unzip
Searching Net::SSLeay () on cpanmetadb ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
package Test::A;
use Moo;
use Valiant::Validations;
use Types::Standard qw(Str);
has 'b' => (is=>'ro');
has 'c' => (is=>'ro');
validates 'b',
package MyApp::Model::Session;
use Moose;
extend 'Catalyst::ApplicationModel';
has 'person' => (is=>'ro', required=>1, model=>'Schema::Person');
sub authenticate($self, $username='', $password='') {
my $user = $self->person->authenticate($username, $password);
$self->ctx->session->{user_id} = $user->id if !$user->has_errors;
package Example::Controller::Root;
use Moose;
use MooseX::MethodAttributes;
extends 'Catalyst::Controller';
sub root :Chained(/) PathPart('') CaptureArgs(0) { }
# map body params directly to action args
{
name => 'John',
age => '52',
address => {
street => "15604 Harry Lind Road",
zip => "78621",
},
email => ['[email protected]', '[email protected]'],
credit_cards: [
$ PERL_MM_USE_DEFAULT=1 cpanm --reinstall --verbose Crypt::SSLeay
cpanm (App::cpanminus) 1.7044 on perl 5.028001 built for darwin-2level
Work directory is /Users/jnapiorkowski/.cpanm/work/1601651704.14365
You have make /usr/bin/make
You have LWP 6.49
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Crypt::SSLeay () on cpanmetadb ...
--> Working on Crypt::SSLeay
Fetching http://www.cpan.org/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz ... OK
$ openssl version -a
OpenSSL 1.1.1g 21 Apr 2020
built on: Tue Apr 21 13:28:37 2020 UTC
platform: darwin64-x86_64-cc
options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr)
compiler: clang -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -D_REENTRANT -DNDEBUG
OPENSSLDIR: "/usr/local/etc/[email protected]"
ENGINESDIR: "/usr/local/Cellar/[email protected]/1.1.1g/lib/engines-1.1"
## Template syntax update to allow capture blocks with "sub() {"
% use experimental 'signatures';
%= formbuilder->form(method => 'POST', sub($fb) {
<fieldset>
<legend>My Test Form</legend>
%= $fb->input(type='text');
%= $fb->input(type='text');
</fieldset>
% });
<div class='form-group'>
%= model_errors_for 'person_roles', max_errors=>1, class=>'alert alert-danger', role=>'alert';
<fieldset class="border p-2">
<legend class="w-auto"><%= $model->human_attribute_name('person_roles') %></legend>
%= checkbox_from_related 'person_roles', 'role', label => 1, checkbox_attrs => +{class=>'form-check-input'}, begin
<div class="form-check">
% my ($checkbox, $label) = @_;
%= $checkbox;
%= $label;
</div>