[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Missing function perl.m
From: |
John W. Eaton |
Subject: |
Re: Missing function perl.m |
Date: |
Mon, 31 Mar 2008 22:08:04 -0400 |
On 1-Apr-2008, Julian Schnidder wrote:
|
| Am 31.03.2008 um 23:36 schrieb John W. Eaton:
| > On 31-Mar-2008, Julian Schnidder wrote:
| >
| > | Here is a changeset that implements the perl function in octave.
| > |
| > | perl.m invokes the perl command via a call of system(). A perl
| > | interpreter with name "perl" is assumed to be present. No security
| > | checks are performed.
| >
| > I think you can eliminate the loop by using
| >
| > sprintf (" %s", varargin{:})
|
| Good idea, thanks.
|
| > function [output, status] = perl (script = "", varargin = {})
| > ...
|
| The default aurgument for script is " -e ''" (the perl interpreter
| executes an empty statement and exits). But I didn'd succeed in
| setting a deault argument for varargin (syntax error at least in
| version 3.0.0).
OK, it does work for the current development sources, so I changed the
function to be
function [output, status] = perl (script = "-e ''", varargin = {})
if (ischar (script)
&& ((nargin != 1 && iscellstr (varargin))
|| (nargin == 1 && ! isempty (script))))
[status, output] = system (cstrcat ("perl ", script,
sprintf (" %s", varargin{:})));
else
error ("perl: invalid arguments");
endif
endfunction
and checked it in.
Thanks,
jwe