Give the teachers_file and students_file builder (or built-in default subs) methods that install them from the configuration file. The builder is launched only if these attributes are not provided as constructor keys (unless you use init_arg => undef so that they are not set in the constructor).
If your config is a native attribute, with a builder that reads the configuration file, then you have a problem with the ordering between config and teachers_file and students_file . You can solve this problem by creating teachers_file and students_file lazy attributes that guarantee that they will not try to construct before the config attribute. However, you can verify that the "foo is not readable file" error is raised as early as possible during build, and not the first time the attribute is used. You can get around this by adding
sub BUILD { my $self = shift; $self->teachers_file; $self->students_file; }
which ensures that these attributes are read once (and built) before the constructor returns.
hobbs source share