CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
system

 



yaz
stranger

Aug 6, 2001, 4:49 AM

Post #1 of 1 (394 views)
system Can't Post

This is calling a bcp - A unix utily that Copies a database table to or from an operating system file in a user-specified format.

This below is part of a perl script that is run from unix. The varaible are passed to it at command line.
#--------------------------
@args = ("$SYBASE/bcp", "$bcp_A_out", "out", "$txt_A", "-c", "-t'|'", "-S$opt_s", "-U$opt_u", "-P$opt_p","-o/tmp/$opt_t.bcpout_a");

system(@args) == 0
or die "system @args failed: $?";
#--------------------------

If I place the above in the perl script that will be placed on the web server as
print "Content-type: text/html","\n\n";
print "<html>", "\n";
print "<head>\n";
print "</head>\n";

print "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n";
print "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
print " <tr>\n";
print " <td height=\"10\"><I>Comparison Results of the table: </I><b>$opt_t
</b>\n";
@args = ("$SYBASE/bcp", "$bcp_A_out", "out", "$txt_A", "-c", "-t'|'", "-S$opt_s", "-U$opt_u", "-P$opt_p","-o/tmp/$opt_t.bcpout_a");

system(@args) == 0
or die "system @args failed: $?";
print " <hr>\n";
print " </td>\n";
print " </tr>\n";

print " </table>\n";
print " </body>\n";
print " </html>\n";



As the result of this when the system call is made, all the output after it is not printed on screen.
Only the follwoing is printed:
print "Content-type: text/html","\n\n";
print "<html>", "\n";
print "<head>\n";
print "</head>\n";

print "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n";
print "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
print " <tr>\n";
print " <td height=\"10\"><I>Comparison Results of the table: </I><b>$opt_t
</b>\n";

ANd thats it

Is there a way I can call this unix utility (also passing it the varaible required) from the perl script, so that it (the unix utility -bcp) can work in the background.





 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives