So, previously I spoke about having to make install after every code change to have tests run properly under prove -l t/test_name.t. This is obviously quite a bitch.
So after some question asking in #catalyst-dev, mst kindly pointed me to some code he'd written for Reaction to do just this very thing:
This is neat, and will really help me to make changes and test them faster, instead of having to remember to do make install each time and banging my head on the desk until I realize i didn't run it, thus, the errors that seem to never disappear.
So after some question asking in #catalyst-dev, mst kindly pointed me to some code he'd written for Reaction to do just this very thing:
sub _find_share_dir {
my ($self, $args) = @_;
my $share_name = $self->name;
if ($share_name =~ s!^/(.*?)/!!) {
my $dist = $1;
$args->{share_base_dir} = eval {
Dir->new(File::ShareDir::dist_dir($dist))
->subdir('share');
};
if ($@) {
# not installed
my $file = __FILE__;
my $dir = Dir->new(dirname($file));
my $share_base;
while ($dir->parent) {
if (-d $dir->subdir('share') && -d $dir->subdir('share')->subdir('root')) {
$share_base = $dir->subdir('share')->subdir('root');
last;
}
$dir = $dir->parent;
}
confess "could not find sharebase by recursion. ended up at $dir, from $file"
unless $share_base;
$args->{share_base_dir} = $share_base;
}
}
my $base = $args->{share_base_dir}->subdir($share_name);
confess "No such share base directory ${base}"
unless -d $base;
$self->share_dir($base);
};
This is neat, and will really help me to make changes and test them faster, instead of having to remember to do make install each time and banging my head on the desk until I realize i didn't run it, thus, the errors that seem to never disappear.






