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:
This code gives me:#!/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");
Can't call method "filename" on an undefined value at ./myconf3.pl line 11.
Or is there an error on my side?In reply to MooseX::SimpleConfig: role attribute cannot be made lazy by lune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |