CGI-Application-Plugin-Config-Std
view release on metacpan or search on metacpan
t/lib/cgi/application/plugin/config/std.t view on Meta::CPAN
# now let's test the config() method to see if we get a Config::Simple object
$value = $self->config();
is(ref($value), 'Config::Std::Hash', 'config() returned expected object');
}
# 17..20
# lets cause some errors
SKIP: {
# try to change it's permissions
my $new_file = 't/test_unwriteable.ini';
chmod(0000, $new_file) || die "Could not chmod $new_file! $!";
# skip these tests if we can still read the file
# cause we're probably running as root
skip('user wont have permission issues', 4) if( -r $new_file );
# un readable file
$self->config_file($new_file);
throws_ok { $self->config_param('param1') }
qr/Permission denied/i, 'un readable file';
# un writeable file
chmod(0400, $new_file)
|| die "Could not chmod $new_file! $!";
my $value = $self->config_file($new_file);
is($value, $new_file, 'new unwriteable file');
lives_ok { $self->config_param(param1 => 'xyz') }
'Set param ok';
throws_ok { $self->commit_config() }
qr/\(permission denied\)/i, 'could not write';
# don't specify a config file
$ENV{CGIAPP_CONFIG_FILE} = '';
$self->config_file('');
xt/author/perlcriticrc view on Meta::CPAN
# allow =
# If the string contains ' characters, allow "" to quote it.
# allow_if_string_contains_single_quote = 0
# Write `oct(755)' instead of `0755'.
[ValuesAndExpressions::ProhibitLeadingZeros]
severity = 5
# Don't allow any leading zeros at all. Otherwise builtins that deal with Unix permissions, e.g. chmod, don't get flagged.
# strict = 0
# Long chains of method calls indicate tightly coupled code.
[ValuesAndExpressions::ProhibitLongChainsOfMethodCalls]
severity = 2
# The number of chained calls to allow.
# Minimum value 1. No maximum.
# max_chain_length = 3
( run in 0.324 second using v1.01-cache-2.11-cpan-496ff517765 )