Opened 18 years ago
Closed 18 years ago
#1113 closed patch (wontfix)
mythrename.pl - less verbose code for the --verbose option
Reported by: | Owned by: | xris | |
---|---|---|---|
Priority: | trivial | Milestone: | unknown |
Component: | mythtv | Version: | |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
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.
Attachments (1)
Change History (2)
Changed 18 years ago by
Attachment: | mythtv-mythrename-verbose.patch added |
---|
comment:1 Changed 18 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
If I add this in, and I later decide to make it have SOME kind of output in non-verbose mode, this will get messy. Easier to just leave it as it is now, or maybe someday write a vprint() function that only prints if verbose is enabled.
patch