summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-11-26 13:38:14 -0500
committerdoy <doy@tozt.net>2008-11-26 13:38:14 -0500
commit4b47a0bd8ce0a76922f681a29878bd90341115b9 (patch)
tree756628a5f11ed8089fe2c258b94c5a9e9ebfedb7
parent5dc3095b6d2a9fa8734811628128874123542cc9 (diff)
downloadlog-dispatch-channels-4b47a0bd8ce0a76922f681a29878bd90341115b9.tar.gz
log-dispatch-channels-4b47a0bd8ce0a76922f681a29878bd90341115b9.zip
allow passing in a string for channels rather than just an arrayref
-rw-r--r--lib/Log/Dispatch/Channels.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Log/Dispatch/Channels.pm b/lib/Log/Dispatch/Channels.pm
index aa2695d..2021710 100644
--- a/lib/Log/Dispatch/Channels.pm
+++ b/lib/Log/Dispatch/Channels.pm
@@ -29,13 +29,18 @@ sub new_channel {
sub _forward_to_channels {
my $self = shift;
- my $channels = shift || [keys %{ $self->{channels} }];
+ my $channels = shift;
my $method = shift;
+ my @channels = !defined $channels
+ ? [keys %{ $self->{channels} }]
+ : ref $channels
+ ? @$channels
+ : ($channels);
# XXX: sort of a hack - the return value is only used by would_log, which
# just wants a boolean
my $ret = 0;
- for my $channel (@$channels) {
+ for my $channel (@channels) {
$ret ||= $self->{channels}{$channel}->$method(@_);
}
return $ret;