perl question

Support and queries relating to all previous versions of ZoneMinder
Locked
ynn
Posts: 152
Joined: Fri Mar 17, 2006 2:30 am

perl question

Post by ynn »

hi,

I would like to ask a question in perl, does anyone know how to change the permission (chmod) of /dev/audio and /dev/ttyS0 from the perl script?

thanks.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Code: Select all

    $cnt = chmod 0755, 'foo', 'bar';
    chmod 0755, @executables;
    $mode = '0644'; chmod $mode, 'foo';      # !!! sets mode to --w----r-T
    $mode = '0644'; chmod oct($mode), 'foo'; # this is better
    $mode = 0644;   chmod $mode, 'foo';      # this is best

You can find the Perl manual here.

Regards,
Corey
ynn
Posts: 152
Joined: Fri Mar 17, 2006 2:30 am

Post by ynn »

thanks cordel for the reply, but i have tried that one and it didn't work out. doe you have any other suggestion?
thanks.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

You can only do it if you have permissions, so if the device files are owned by root and your script is running as someone else then it won't work.
Phil
Locked