On Fri, Nov 02, 2012 at 03:00:08AM +0200, Thanos Zygouris wrote:
> Also, i couldn't find any reference that \d in regex is
> different from [0-9] (or [:digit:]), but i'm interested for
> more information about it.

I wouldn't have found it either if I didn't know to look for it.
I guess I have this mailing list to thank for that. :) See
'Digits' in `perldoc perlrecharclass'. :) I guess you can
alternatively use \d with /a, but [0-9] isn't many more
characters and should always work whereas /a might affect other
code (and it also requires the reader to know what it does).

> So, here is the new code (i'm pretty happy with how it became):

Looks good to me. The only part that I question is this:

>     my $amixer_cmd = "$amixer_path sset Master,0 $amixer_vol";
>     my $amixer;
>     run(
>         command => $amixer_cmd,
>         verbose => 0,
>         buffer  => \$amixer,
>     );

It seems that IPC::Cmd::run can accept an array reference for the
command so perhaps that would be better.

my $amixer_cmd = [$amixer_path, 'sset', 'Master,0', $amixer_vol];

In this case $amixer_vol is currently trusted though so maybe I'm
just being paranoid. :) Just be careful not to let the user
directly input that and make sure that you are careful about
shell meta characters.

Regards,


-- 
Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

Attachment: signature.asc
Description: Digital signature

Reply via email to