|No such thing as a small change|
Strange system call failure in OS Xby endor-moon (Initiate)
|on Feb 15, 2013 at 20:00 UTC||Need Help??|
endor-moon has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Perl Monks: I'm having an interesting problem with Perl on OS X Mountain Lion, perl v5.10.1. I replaced a bash script called on-firstboot.sh with a Perl script called on-firstboot.pl that does a number of things to a newly imaged Mac such as set the machine host name. I am using system to make these calls to bash, like so:
The first two of these work just fine. The $name variable contains a MAC address, in this case:3c0754131c6d
The third command above fails with this error:SCPreferencesSetLocalHostName() failed: Invalid argument
It's almost as if the first two commands get the variable $name contents correctly and the third gets an empty string.
Any ideas? Perhaps I need to escape some of these quote characters? I used single quotes to avoid a quoting issue. The commands at the Terminal in OS X work fine with the MAC address in question whether I use single quotes or double-quotes. The failure only happens in the Perl script.
Other system calls in the Perl script are working fine. Perhaps I should insert some sort of sleep command to pause between system calls? (How does one sleep in Perl?)