Skip Menu |

This queue is for tickets about the Log-Handler CPAN distribution.

Report information
The Basics
Id: 85346
Status: resolved
Priority: 0/
Queue: Log-Handler

People
Owner: Nobody in particular
Requestors: gkpect [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.38
  • 0.40
  • 0.41
  • 0.43
  • 0.44
  • 0.45
  • 0.46
  • 0.47
  • 0.48
  • 0.49
  • 0.50
  • 0.51
  • 0.51_01
  • 0.52
  • 0.53_01
  • 0.54
  • 0.55_01
  • 0.56
  • 0.57
  • 0.58
  • 0.59_01
  • 0.59_02
  • 0.60
  • 0.61_01
  • 0.61_02
  • 0.61_03
  • 0.61_04
  • 0.62
  • 0.63
  • 0.64
  • 0.65
  • 0.65_01
  • 0.65_02
  • 0.65_03
  • 0.65_04
  • 0.66
  • 0.67
  • 0.68
  • 0.68_01
  • 0.69
  • 0.70
  • 0.71
  • 0.72
  • 0.73
  • 0.74
  • 0.75
  • 0.76
  • 0.77
Fixed in: (no value)



Subject: validate() deletes 'default' section from config
Hi, As I can see suggested usage is the following: ---- if ( $log->validate( config => \%new_config ) ) { $log->reload( config => \%new_config ); } ---- But if there is 'default' section in %new_config it will not affect $log, cause validate() deletes it. Section is deleted in _get_hash_config() subroutine of Log::Handler::Config module. ---- %default = %{ delete $config->{default} }; ---- Please see example attached. Surely I can use clone() for validation to avoid this problem, but it is not clear behaviour. Please modify validate(), config() and reload() not to change passed config if it is possible. In additional: could you please make static method for validate? To call it like that: ---- Log::Handler->validate( config => $config ); ----
Subject: test.pl
#!/usr/bin/perl use Data::Dumper; use Log::Handler; # use Clone qw(clone); my $config = { file => { default => { maxlevel => 'info', }, error => { filename => '/tmp/error.log', }, } }; my $log = Log::Handler->get_logger( 'myapp' ); if ( $log->validate( config => $config ) ) { # ( config => clone( $config ) ) print Dumper($config); $log->config( config => $config ); } if ( $log->is_info() ) { print "INFO\n"; } else { print "NOT INFO\n"; }
Fixed in 0.78. Show quoted text
> In additional: could you please make static method for validate? To > call it like that: > ---- > Log::Handler->validate( config => $config ); > ----
No, that is not possible. Internal $self is needed.