top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

what's the problem with a system call

0 votes
356 views

whats 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?

posted May 14, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

Well, usually using a module you have access to several things in a
Perl way, like for instance to the arguments to pass to the command as
an hash or an array. instead of a string. Moreover, the perl module
could have some workarounds to provide you better portability.

answer May 14, 2013 by anonymous
0 votes

The only real disadvantage is portability, perhaps speed (e.g. PerlIO::gzip is faster than calling gzip itself, and if youre shelling out multiple times, itll generally be slower than simply using a module).
Additionally, if youre passing user-provided arguments to the outside command and arent doing things "properly", that is, you arent using IPC::Cmd, IPC::Run, or multi-arg open, you have a potential security hole in your program.

But if what youre doing doesnt gain any advantages from increased portability or security, theres nothing wrong with calling a system command.

answer May 14, 2013 by anonymous
Similar Questions
+1 vote
$ perl -le 'system "df -h"'
$ perl -le 'system "df","-h"'

Both two styles work fine. What's the difference between them and which is better usage?

0 votes

PHP:: Suppose I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, whats the problem?

0 votes

http://perldoc.perl.org/perlembed.html

Above link only shows calling from C to perl.

What I want to do is to create a function in C code and somehow export it to my embedded perl interpreter. Then I want to be able to call this C function from perl code.

Can someone point me to a good example on how to do this?

+1 vote

There seem to be two modules for it, yet none of them seems to let you do it --- if they do, the documentation doesn't have any example of how to do it.

The alternative seems to be to write MS excel files, and I don't really want to resort to that.

...