http://qs321.pair.com?node_id=933872

lune has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I want to create a class that reads in simple yaml config files, based on an argument.

With MooseX::SimpleConfig I want the path to be constructed from the argument and some base path already known. However, it seems the role Attribute '+configfile' cannot be made lazy and is always being created before anything else:

#!/usr/bin/perl package My::Config; use Moose; with 'MooseX::SimpleConfig'; has filename => ( is => 'ro', isa => 'Str', required => 1, ); has '+configfile' => ( default => sub { my $self = shift; '/some/path/' . $self->filename + . ".yaml"; }, lazy => 1, ); my $config = My::Config->new_with_config( filename => "config");
This code gives me:

Can't call method "filename" on an undefined value at ./myconf3.pl line 11.

Or is there an error on my side?