X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=caaa38008b18928ad4435612ed84357ce67b965b;hb=295f32fa75fefedcf1cd980c5afcc5de08417ba9;hp=d7ca5ed218e2b6e8e1671091e9c2cb043a3bf4c8;hpb=9e2fbafcfdab1ee45e581524311f1a97ac41f6ad;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index d7ca5ed2..caaa3800 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -191,9 +191,9 @@ sub shellregex # start an attempt at determining whether this string might be a callsign sub iscallsign { - my $call = shift; - return 1 if $call =~ /^\w+\d+/; - return 1 if $call =~ /^\d+\w+/; + my $call = uc shift; + return 1 if $call =~ /^[A-Z]+\d+[A-Z]+/; + return 1 if $call =~ /^\d+[A-Z]\d+[A-Z]+/; return undef; } @@ -268,11 +268,13 @@ sub writefilestr } my $fh = new IO::File ">$fn"; - my $dd = new Data::Dumper([ $obj ]); - $dd->Indent(1); - $dd->Terse(1); - $dd->Quotekeys(0); -# $fh->print(@_) if @_ > 0; # any header comments, lines etc - $fh->print($dd->Dumpxs); - $fh->close; + if ($fh) { + my $dd = new Data::Dumper([ $obj ]); + $dd->Indent(1); + $dd->Terse(1); + $dd->Quotekeys(0); + # $fh->print(@_) if @_ > 0; # any header comments, lines etc + $fh->print($dd->Dumpxs); + $fh->close; + } }