LanceDeeply has asked for the wisdom of the Perl Monks concerning the following question:
Cannot open output file - c:\test\data\extract.csv No such file or directory
sub SqlScriptResultsToFile { my %args = ( db_srv => '', db_name => '', db_user => '', db_pass => '', sql => '', filepath => '', separator => ',', columnwidth => 20000, @_ ); my @errors; # # arg validation ... # my $osql = "|c:\\Progra~1\\MSSQL7\\Binn\\osql.exe -n -U$args{db_us +er} -P$args{db_pass} -S$args{db_srv} -d$args{db_name} -o$args{filepat +h}"; $osql .= " -s$args{separator}" if ( $args{separator} ne ' +' ); $osql .= " -w$args{columnwidth}" if ( $args{columnwidth} ne '' +); if ( ! open(PROGRAM,$osql) ) { push @errors, "invalid filepath [$args{$filepath}]"; return ( success => 0, errors => \@errors ); } print PROGRAM $args{sql}; close PROGRAM; return ( success => 1, errors => \@errors ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How would you catch this error?
by hardburn (Abbot) on May 09, 2003 at 14:47 UTC | |
by LanceDeeply (Chaplain) on May 09, 2003 at 14:57 UTC | |
|
Re: How would you catch this error?
by BrowserUk (Patriarch) on May 09, 2003 at 16:05 UTC | |
by LanceDeeply (Chaplain) on May 09, 2003 at 18:06 UTC |