> There are several problems when using 'backtick' here:
> 1) From my tests, be it a background or foreground command within
> backticks, your process has to wait for it to finish to continue. A
> simple Mason file can address this problem:
>
> <% rand() %>
> <%init>
>  `sleep 20 &`;
> </%init>
>
> and see how long it takes to render your webpage.
>
> My point: if the external program takes some non-trivial time to
> finish, qx// and the likes are not the ways OP might need.
>
> 2) "backtick" is usually not used in a void context, this might just
> be a trivial Perl problem though.

Interesting. I would have thought backticks would have returned
straight away since the process was backgrounded. system() however
does what you want:

<%init>
  print "before: " . time() . "<br />";
  system "sleep 200 &";
  print "after" . time() . "<br />";
</%init>

As you can see from the output, before and after are the same. If you
'ps aux | grep sleep', you will see apache is resting.

Alfie
--
http://www.Share-House.com.au
FREE Share House Advertising

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to