[svn-commits] tzafrir: tools/trunk r6056 - in /tools/trunk/xpp: ./ perl_modules/Dahdi/Confi...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Mar 1 08:26:05 CST 2009
Author: tzafrir
Date: Sun Mar 1 08:26:02 2009
New Revision: 6056
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6056
Log:
dahdi-perl: more defensive coding and some docs
Modified:
tools/trunk/xpp/dahdi_drivers
tools/trunk/xpp/perl_modules/Dahdi/Config/Gen.pm
tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Users.pm
tools/trunk/xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm
Modified: tools/trunk/xpp/dahdi_drivers
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/xpp/dahdi_drivers?view=diff&rev=6056&r1=6055&r2=6056
==============================================================================
--- tools/trunk/xpp/dahdi_drivers (original)
+++ tools/trunk/xpp/dahdi_drivers Sun Mar 1 08:26:02 2009
@@ -7,3 +7,17 @@
my $hardware = Dahdi::Hardware->scan;
print join("\n", $hardware->drivers),"\n";
+__END__
+
+=head1 NAME
+
+dahdi_drivers - Show drivers required for installed dahdi devices.
+
+=head1 SYNOPSIS
+
+dahdi_drivers
+
+=head1 DESCRIPTION
+
+This script shows by default the list of drivers required for currently
+installed dahdi devices.
Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/Gen.pm
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/Gen.pm?view=diff&rev=6056&r1=6055&r2=6056
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/Gen.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/Gen.pm Sun Mar 1 08:26:02 2009
@@ -7,7 +7,8 @@
use strict;
sub is_true($) {
- my $val = shift || die;
+ my $val = shift;
+ return undef unless defined $val;
return $val =~ /^(1|y|yes)$/i;
}
Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Users.pm
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Users.pm?view=diff&rev=6056&r1=6055&r2=6056
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Users.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Users.pm Sun Mar 1 08:26:02 2009
@@ -171,6 +171,7 @@
=head1 DESCRIPTION
-Generate the F</etc/asterisk/users.conf> which is used by asterisk(1) and AsteriskGUI.
+Generate the F</etc/asterisk/users.conf> which is used by asterisk(1)
+and AsteriskGUI.
Its location may be overriden via the environment variable F<USERS_FILE>.
Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm?view=diff&rev=6056&r1=6055&r2=6056
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm Sun Mar 1 08:26:02 2009
@@ -14,7 +14,14 @@
my $cfg_file = shift || die;
my $self = { GENCONF_FILE => $cfg_file };
bless $self, $pack;
- open(F, $cfg_file) || return $self; # Empty configuration
+ if(!open(F, $cfg_file)) {
+ if(defined($!{ENOENT})) {
+ #print STDERR "No $cfg_file. Assume empty config\n";
+ return $self; # Empty configuration
+ }
+ die "$pack: Failed to open '$cfg_file': $!\n";
+ }
+ #print STDERR "$pack: $cfg_file\n";
my $array_key;
while(<F>) {
my ($key, $val);
@@ -43,11 +50,15 @@
sub dump($) {
my $self = shift || die;
+ print STDERR "Genconf dump:\n";
foreach my $k (sort keys %$self) {
my $val = $self->{$k};
my $ref = ref $val;
+ #print STDERR "DEBUG: '$k', '$ref', '$val'\n";
if($ref eq '') {
printf STDERR "%-20s %s\n", $k, $val;
+ } elsif($ref eq 'SCALAR') {
+ printf STDERR "%-20s %s\n", $k, ${$val};
} elsif($ref eq 'ARRAY') {
printf STDERR "%s\n", $k;
foreach my $v (@{$val}) {
More information about the svn-commits
mailing list