How to set a global on the command line?
am 25.11.2007 15:51:11 von kj
I often use Johan Vromans' handy script mp3cat, which I downloaded
from CPAN. I invoke it like this, for example:
% mp3cat --output=all.mp3 /some/dir/*.mp3
mp3cat works great most of the time, but lately it has been giving
me problems. I've traced these problems to the value of a certain
global variable, $MPEG::Audio::Frame::free_bitrate. This variable
is undef by default, and mp3cat leaves it unchanged. I discovered
(by running mp3cat in the debugger) that the problems I mentioned
would disappear if I set this variable to the correct bitrate (which
I know).
The only problem now is that mp3cat offers no way to specify a
value for this variable. I could hack mp3cat to add this functionality,
but I wondered, is there was a less "invasive" way to specify the
value of a global variable, e.g. on the command line?
TIA!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Re: How to set a global on the command line?
am 25.11.2007 15:57:43 von Big and Blue
kj wrote:
....
> The only problem now is that mp3cat offers no way to specify a
> value for this variable. I could hack mp3cat to add this functionality,
> but I wondered, is there was a less "invasive" way to specify the
> value of a global variable, e.g. on the command line?
Write your own init.pm module which sets it, then run
perl -Minit /path/to/mp3cat --output=all.mp3 /some/dir/*.mp3
--
Just because I've written it doesn't mean that
either you or I have to believe it.
Re: How to set a global on the command line?
am 26.11.2007 06:52:13 von Glenn Jackman
At 2007-11-25 09:51AM, "kj" wrote:
> % mp3cat --output=all.mp3 /some/dir/*.mp3
>
> mp3cat works great most of the time, but lately it has been giving
> me problems. I've traced these problems to the value of a certain
> global variable, $MPEG::Audio::Frame::free_bitrate. This variable
> is undef by default, and mp3cat leaves it unchanged. I discovered
[...]
> but I wondered, is there was a less "invasive" way to specify the
> value of a global variable, e.g. on the command line?
untested: create a wrapper script
#!/usr/bin/perl --
$MPEG::Audio::Frame::free_bitrate = 'whatever';
do '/path/to/mp3cat';
__END__
Invoke as: mp3catwrapper.pl --output=...
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry