APM: Asking again because I'm dense... Running a prog from a prog?

Jim Woodgate jdwoody at gmail.com
Fri Oct 20 13:37:05 PDT 2006


The first two should have worked, system returns the return code.

@dbtables = qx(gettables.pl mysql database user password);

is a bit nicer since you would get an array of tables.

Like someone else already mentioned however you are making things a
lot more difficult on yourself by following this paradigm.  It may not
be working because of path problems, you might have other errors you
aren't seeing, it is very insecure, won't work if you are forced to
use taintperl, it's harder to debug and uses more system resources
with the forking.  The first thing I would check is your error log.

On 10/20/06, CaptNemo <CaptNemo at austin.rr.com> wrote:
>
>  Sorry to ask this again but, I just can't grasp system() and get it to
> work....
>
>   I have written a program named gettables.pl which reads all the tables in
> a database and prints them out.   The program is run with this line:
>
>  gettables.pl mysql database user password
>
>  It in turn prints out a list of the tables in the database-
>  EXAMPLE:
>          products
>          inventory
>          porn_collection
>          accounts
>
>
>  I need to execute this FROM my web page generator program and  have the
> print result returned so I can make a table.
>
>  I have tried:
>
>          $dbtable = `gettables.pl mysql database user password`;
>
>
>          my $command = "gettables.pl mysql database user password4";
>          $dbtable = `$command`;
>
>
>          $dbtable = system(gettables.pl mysql database user password);
>
>
>          my $command = "gettables.pl mysql database user password";
>          $dbtable = system($command);
>
>
>          @dbtable = system(gettables.pl mysql database user password);
>
>
>          my $command = "gettables.pl mysql database user password";
>          @dbtable = system($command);
>
>
>  How can I do this without having to write a file and read the results?
>
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
>


-- 
Jim Woodgate
jdwoody at gmail.com


More information about the Austin mailing list