Wijaya Edward wrote:
Dear Jupiter, Thanks so much for the reply. However...

>you are not passing the variabels to
it proeprly.
(an oi, why is that written so incredibly hard to read ???)



sorry about that.


So you see it has nothgin to do with using system it has to so with calling a funtion as its documented :)



Now what I have is this (let's call the script "test.pl") :

__BEGIN__
use strict;
use Data::Dumper;
use CGI::Carp qw( fatalsToBrowser );
use Acme::Spork;

  my $uemail = "[EMAIL PROTECTED]";
  my $ct = "sugar";
  my $nu = 10;

    # Run the job at the background
     spork(
         sub {
            my ( $ue, $con_type, $nb_un ) = @_;
            system qq("perl compute_price.pl -email $ue -type $con_type -unit 
$nb_un");

Ok, you do realize that with that qq() you are trygin to execute the command "perl ..." (IE inclduing the quotes) which your shell probably doesn't like?

$ perl -le 'print 123;'
123
$ "perl -le 'print 123;'"
-bash: perl -le 'print 123;': command not found
$

         },$uemail, $ct, $nu
     )
    or die qq {Could not fork for spork: $!};

__END__

But why it still doesn't do the job?

I don't know, in what way is it not doing "the job"?

As a start do "a" and "b" below:

a) does it "do the job" by itself:

#!/usr/bin/perl

use strict;
use warnings;

my $ue       = 'whatever';
my $con_type = 'whatever';
my $nb_un    = 'whatever';
print "Running: perl compute_price.pl -email $ue -type $con_type -unit $nb_un\n";
system "perl compute_price.pl -email $ue -type $con_type -unit $nb_un";

b) are the variables what you expect them to be in the spork()ed process?

...

      spork(
          sub {
             my ( $ue, $con_type, $nb_un ) = @_;
# write the variables to a file here and check that file afterwards
          },$uemail, $ct, $nu
      ) or die qq {Could not fork for spork: $!};

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to