Click here to get back home

problem using system()

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
problem using system() mike 04-09-2008
Get Chitika Premium
Posted by A. Sinan Unur on April 9, 2008, 10:25 am
Please log in for more thread options
9a29-8d67509b7d61@q1g2000prf.googlegroups.com:

> I changed it to ( taking all pointers into account):
>
...

> system(@args) == 0 or die "system @args failed: $?"

There is a semi-colon missing at the end of that line.

> syntax error at remote_deploy.pl line 63, near "system"

...

> Does not really help me as a newbie :-)

As a newbie, you would be better helped by reading your code more
carefully rather than asking us to figure out every syntax error.

As a newbie, you might want to learn more before writing deployment
scripts if you don't want to ruin your customers.

Sinan

--
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

Posted by J. Gleixner on April 9, 2008, 11:21 am
Please log in for more thread options
mike wrote:
> Hi,
>
> I changed it to ( taking all pointers into account):
>
>
> my @args = ($User_Preferences, 'deploy', "--user=
> $User_Preferences","--passwordfile=
> $User_Preferences","--host=$User_Preferences","--
> port=$User_Preferences","$User_Preferences");

Could also make that easier to read:


my @args = (
        $User_Preferences,
        'deploy',
        "--user=$User_Preferences",
        "--passwordfile=$User_Preferences",
        "--host=$User_Preferences",
        "--port=$User_Preferences",
        "$User_Preferences",
        );

Posted by Ben Bullock on April 9, 2008, 6:22 pm
Please log in for more thread options
On Wed, 09 Apr 2008 10:21:14 -0500, J. Gleixner wrote:
> mike wrote:
>> my @args = ($User_Preferences, 'deploy', "--user=
>> $User_Preferences","--passwordfile=
>> $User_Preferences","--host=$User_Preferences","--
>> port=$User_Preferences","$User_Preferences");
> Could also make that easier to read:
> my @args = (
>         $User_Preferences, 'deploy',
>         "--user=$User_Preferences",
>         "--passwordfile=$User_Preferences",
>         "--host=$User_Preferences",
>         "--port=$User_Preferences",
>         "$User_Preferences",
>         );

my @jazz = qw/user passwordfile host port/;
my @args = ($User_Preferences,
         'deploy',
         (map "--$_=$User_Preferences", @jazz),
         $User_Preferences,
        );

Posted by A Dude on April 9, 2008, 9:48 am
Please log in for more thread options
> Hi,
>
> I have the following string:
>
> my $command =3D "$User_Preferences deploy =A0--user=
=3D
> $User_Preferences --passwordfile=3D
> $User_Preferences --host=3D$User_Preferences --
> port=3D$User_Preferences $User_Preferences";
> system($command);
>
> Global symbol "$command" requires explicit package name at
> remote_deploy.pl line 55.
> syntax error at remote_deploy.pl line 55, at EOF
> Missing right curly or square bracket at remote_deploy.pl line 55,
> within string
> Execution of remote_deploy.pl aborted due to compilation errors.
>
> Any ideas what I need to do to make it possible to execute the
> command?
>
> cheers,
>
> //mike

Actually, what you have there is a _quoting_ problem.

First of all there is no reason to delimit hash keys with the double
quotes. But if you're going to do that, you shouldn't surround the
whole string literal with double quotes. Use single quotes
( $User_Preferences -- if any -- $User_Preferences --
works just fine. ) or surround the thing with the qq operator, to
allow for the embedded double quotes.

For more on qq: perldoc perlop

Similar ThreadsPosted
system problem May 16, 2005, 8:35 pm
problem with system(@args) February 18, 2005, 7:52 am
Python Doc Problem Example: os.system September 4, 2005, 5:16 pm
problem with system() and fork November 7, 2005, 6:47 am
SYSTEM command problem April 20, 2006, 10:01 am
Problem with system command February 8, 2007, 12:36 pm
Problem with Perl system() December 18, 2007, 8:13 am
Re: Problem with call to system(), I think. December 3, 2008, 5:53 pm
Problem with cp in system call running Mac OS X November 7, 2004, 10:50 am
system call problem under Win32 May 31, 2006, 11:51 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap