Skip to content

Instantly share code, notes, and snippets.

@hesco
Created February 24, 2013 18:05
Show Gist options
  • Save hesco/5024853 to your computer and use it in GitHub Desktop.
Save hesco/5024853 to your computer and use it in GitHub Desktop.
$ perl 9998-throw-me-away.t
::ResetPassword->myapp says config_files is: $VAR1 = [
't/conf/myapp_api.ini'
];
ok 1 - The object isa MyApp::ThisApplication
1..1
-------------------------------------
#!/usr/bin/env perl
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
use Test::More;
use lib qw( lib );
use MyApp::ThisApplication;
my $config_files = [ 't/conf/myapp_api.ini' ];
warn '::ResetPassword->myapp says config_files is: '
. Dumper( $config_files ) . "\n";
my $obj = MyApp::ThisApplication->new({
'config_files' => $config_files });
isa_ok( $obj, 'MyApp::ThisApplication' );
done_testing();
exit;
--------------------
And compare that with:
::ResetPassword->my_app says config_files is: $VAR1 = [
't/conf/myapp_api.ini'
];
[Sun Feb 24 12:18:33 2013] [error] MyApp's constructor invoked with no Confirguration File.
$VAR1 = bless( {}, 'MyApp::Base' );
$VAR2 = [
'Moose::Meta::Attribute',
'/usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm',
545
];
---------- AND ----------
package MyApp::WWW::Admin::ControlPanel::ResetPassword;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
use Data::Dumper;
use lib qw( lib );
use MyApp::ThisApplication;
has 'config_files' => (
is => 'rw',
isa => 'ArrayRef[Str]',
required => 1,
);
has 'my_app' => (
is => 'ro',
isa => 'MyApp::ThisApplication',
default => sub {
my $self = shift;
warn '::ResetPassword->my_app says config_files is:'
. Dumper( $self->config_files ) . "\n";
return MyApp::ThisApplication->new({
'config_files' => $self->config_files });
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment