[mythtv-commits] Ticket #1113: mythrename.pl - less verbose code for the --verbose option

MythTV mythtv at cvs.mythtv.org
Wed Jan 25 18:15:02 UTC 2006

#1113: mythrename.pl - less verbose code for the --verbose option
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  xris
     Type:  patch                             |      Status:  new 
 Priority:  trivial                           |   Milestone:      
Component:  mythtv                            |     Version:      
 Severity:  low                               |  
 Attached patch makes "--verbose" output generation code less verbose,
 removing the need for

 if (defined($verbose)) {
     print ... ;

 code blocks by simply redirecting STDOUT to devnull() when "--verbose" is
 not specified.  Errors are still printed as before because die sends
 messages to STDERR.

 I used File::Spec's devnull() function for portability, but if you prefer
 just assuming "/dev/null" (and removing the "use File::Spec;"), it should
 work just as well any place the script is likely to be executed.  However,
 since File::Spec is a standard module, it probably doesn't hurt to use the
 devnull() function.

 The patch does assume we'll only ever need one level of verbose output,
 but I think for a contributed script, this is a safe assumption.  :)  Oh,
 and it's quite possible there's a prettier (more Perl-like) way of opening
 STDOUT with the devnull() function than concatenating the "> " to the
 function's output, but I couldn't find anything.

Ticket URL: <http://svn.mythtv.org/trac/ticket/1113>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list