Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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?


Comment on Re: Strange system call failure in OS X
Select or Download Code
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/com.apple.loginwindow 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/bind.sh"); 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 osxdaily.com.)

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018967]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2015-07-28 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls