Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hi

when i try the to use the Audio::Beep module
i get the following error:

Cannot open console: Permission denied at /usr/local/share/perl/5.8.7/Audio/Beep /Linux/PP.pm line 21

Audio::Beep::Linux::PP::play('Audio::Beep::Linux::PP=HASH(0x81cba0c)', 4 40, 2000) called at /usr/local/share/perl/5.8.7/Audio/Beep.pm line 204

how can i get access to /dev/console ?
- i assume that is the problem ?

thanks
chris

Replies are listed 'Best First'.
Re: permission denied Audio::Beep
by sgifford (Prior) on Jun 05, 2006 at 17:03 UTC
    Generally, console permissions are given to the user logging into the console, and are always available to root. Those are your first two options.

    Another option is to change permissions on /dev/console to allow your program to access it, for example by running your program in a special group and giving that group write access.

    You can also solve this with a small network program or setuid program to provide access to the console as appropriate, or perhaps by playing a sound via the soundcard instead, whose permissions might be a little easier to manage (and less tragic if they're wrong).

    Update: Also see Does Perl ring a bell?.

Re: permission denied Audio::Beep
by MidLifeXis (Monsignor) on Jun 05, 2006 at 17:36 UTC

    Just in case you are just trying to get a beep to the user's screen, try the \a escape character in your output.

    --MidLifeXis