On Tue, May 14, 2013 at 12:35 AM, xiaolan <practicalp...@gmail.com> wrote:
> Hello, > > what's the disadvantage when calling a system command from Perl? > i.e, system call to "rsync" rather than using the File::Rsync module. > is it hard to control the signals between the caller process and the > called system command? > The only real disadvantage is portability, perhaps speed (e.g. PerlIO::gzip is faster than calling gzip itself, and if you're shelling out multiple times, it'll generally be slower than simply using a module). Additionally, if you're passing user-provided arguments to the outside command and aren't doing things "properly", that is, you aren't using IPC::Cmd, IPC::Run, or multi-arg open, you have a potential security hole in your program. But if what you're doing doesn't gain any advantages from increased portability or security, there's nothing wrong with calling a system command.