Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Strange system call failure in OS X

by moritz (Cardinal)
on Feb 15, 2013 at 20:26 UTC ( #1018967=note: print w/replies, xml ) Need Help??

in reply to Strange system call failure in OS X

Right now you're assigning a single string to the array @args. Instead you can assign a list to it, and omit the quoting entirely:

@args = (qw(scutil --set ComputerName), $name); system(@args)

Though I guess that the problem is not with quoting, but something else.

Perhaps I should insert some sort of sleep command to pause between system calls?

And what would you gain from that?

Replies are listed 'Best First'.
Re^2: Strange system call failure in OS X
by endor-moon (Initiate) on Feb 15, 2013 at 21:13 UTC

    I have more system calls which might be cleaner if I send them as a list. Do I break it into a separate item for each argument? Any need for quotes? Here are the other system calls. They do actually work as they are but I would like to learn how to use the system call the "right" way so to speak.

    # Disable autologin @args = ("defaults delete /Library/Preferences/ a +utoLoginUser"); system(@args); # exit our test version here before doing anything irrevocable exit 0; # Serialize Adobe CS6 Design and Web Premium @args = ("/Library/AdminToolBox/AdobeSerialization adobe_prtk --tool=V +olumeSerialize --provfile=/Library/AdminToolBox/prov.xml"); system(@args); # Bind to Active Directory @args = ("/Library/AdminToolBox/"); system(@args); # This time we'll use exec since we are restarting anyway @args = ("/sbin/shutdown -r now"); exec(@args);
        $ perl -MData::Dump -e " dd\@ARGV " "he llo" there "bu ddy" ["he llo", "there", "bu ddy"] $ perl -MData::Dump -e " dd\@ARGV " he llo there bu ddy ["he", "llo", "there", "bu", "ddy"] $ perl - he llo there bu ddy use Data::Dump; dd\@ARGV; __END__ ["he", "llo", "there", "bu", "ddy"] $
Re^2: Strange system call failure in OS X
by endor-moon (Initiate) on Feb 15, 2013 at 20:46 UTC

    Sending a list to system is much cleaner, thank you, but the error remains. I think perhaps for now I will just delete the system call that isn't working, as when I inserted a call to get that preference, the correct value came back -- so perhaps I don't really need to set that particular value. (I read about this command on

    Regarding sleep, there was nothing to be gained. I tried a sleep 4 without any change in the error. Perhaps it is a newbie attribute to hope that inserting a sleep will make a problem go away. <grin>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018967]
and the fog begins to lift...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-01-19 11:39 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.