CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [dwaynepeeters] Restart/reload an impress from Perl: Edit Log

Veteran / Moderator

Apr 8, 2014, 6:23 AM

Views: 7141
Re: [dwaynepeeters] Restart/reload an impress from Perl

Why are you using 'cp' and 'pkill' system calls? Are you not aware that perl has the built-in kill function to kill a process and the File::Copy module to copy files?

The script is not "freezing". The system function forks a new (child) process to run the command and waits for that process to complete/exit before proceeding to the next statement.

If you want it to return immediately, you'll need to run libreoffice as a background process.

system("libreoffice —quickstart -show —norestore /home/picuntu/Desktop/Presentation.odp &");

A better method to do that would be to use the Proc::Background module.

use Proc::Background; 

my $cmd = "libreoffice —quickstart -show —norestore /home/picuntu/Desktop/Presentation.odp";
my $libreoffice = Proc::Background->new($cmd);

(This post was edited by FishMonger on Apr 8, 2014, 6:24 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Apr 8, 2014, 6:24 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives