/usr/share/perl5/Poet/Test/Class.pm is in libpoet-perl 0.16-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | package Poet::Test::Class;
$Poet::Test::Class::VERSION = '0.16';
use Method::Signatures::Simple;
use Carp;
use Cwd qw(realpath);
use Plack::Util;
use Poet::Environment::Generator;
use Poet::Environment;
use Poet::Mechanize;
use Poet::Tools qw(basename dirname mkpath rmtree tempdir_simple write_file);
use Test::Class::Most;
use YAML::XS;
use strict;
use warnings;
__PACKAGE__->SKIP_CLASS("abstract base class");
method write_conf_file ($class:) {
my ( $conf_file, $conf_content ) = @_;
if ( ref($conf_content) eq 'HASH' ) {
$conf_content = %$conf_content ? YAML::XS::Dump($conf_content) : "";
}
mkpath( dirname($conf_file), 0, 0775 );
write_file( $conf_file, $conf_content );
}
method temp_env ($class:) {
my (%params) = @_;
my $root_dir = $class->temp_env_dir(%params);
my $app_name = $params{app_name} || 'TestApp';
if ( my $conf = $params{conf} ) {
$class->write_conf_file( "$root_dir/conf/local.cfg", $conf );
}
if ( my $conf_files = $params{conf_files} ) {
while ( my ( $conf_file, $contents ) = each(%$conf_files) ) {
$class->write_conf_file( "$root_dir/conf/$conf_file", $contents );
}
}
return Poet::Environment->new(
root_dir => $root_dir,
app_name => $app_name
);
}
method temp_env_dir ($class:) {
my (%params) = @_;
local $ENV{POET_SHARE_DIR} = $params{share_dir} || $class->share_dir;
my $app_name = $params{app_name} || 'TestApp';
my $root_dir = Poet::Environment::Generator->generate_environment_directory(
root_dir => tempdir_simple('Poet-XXXX'),
app_name => $app_name,
quiet => 1,
style => 'bare',
);
return realpath($root_dir);
}
method share_dir () {
my $dist_root = dirname( dirname( dirname( dirname( realpath(__FILE__) ) ) ) );
my ($share_dir) =
grep { -d $_ } ( "$dist_root/share", "$dist_root/lib/auto/share/dist/Poet" );
return $share_dir;
}
method initialize_temp_env ($class:) {
my $poet = $class->temp_env(@_);
Poet::Environment->initialize_current_environment( env => $poet );
}
method mech ($class:) {
return Poet::Mechanize->new(@_);
}
# prevent YAML::XS warning...wtf
YAML::XS::Dump( {} );
YAML::XS::Dump( {} );
1;
|