Re: check file existence

2003-01-09 Thread Vitaliy Babiy
Try this

unless  (-f $a) { $notAvialible = 1 }

=
"Alex Cheung Tin Ka" <[EMAIL PROTECTED]> wrote in message
021501c2b791$0c935bc0$[EMAIL PROTECTED]">news:021501c2b791$0c935bc0$[EMAIL PROTECTED]...
Dear All,
I have a problem on using CGI to check the file existence in a
directory. Here is my code

$workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
$path = "tulisar030108.rpt";
$notAvailabe = 0;
$a = qq`$workDir/$path`;
if (! -e $a){ $notAvailable = 1;}
return $notAvailable;

The file does exist, but the code always return 1;
I do try to install the module Test::File (but failed) and using open
file to test the file existence ( it works)

I would ike to know how to use the "-e" to check it.

Regards,
Alex




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: uploading and downloading files to MySQL

2003-01-09 Thread Vitaliy Babiy
I don't think it's  good idea to store files in DB. Especially big files
like music...
The common way is to store path_to_files in DB




"Mariusz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi,

I found some info on how to upload files into a directory on the server and
I was able to do that but can anyone tell me how to upload a file to my
database (MySQL)? I know to use BLOB for the field type (which BLOB
depending on the size) but how do I construct the INSERT or is there a
different special sql command just for that?
I will also need the visitor to be able to download that file and display in
the browser (in case of the pic) and download the other type of files (like
music) straight to his hard drive. Basically how can I let a visitor
download the file from my database?

I'll also greatly appreciate any pointers to some articles on the net.

thank you,
Mariusz





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Slurping a Text file

2003-01-14 Thread Vitaliy Babiy
  my %var = ('FirstName'=>'John Doe',
 'time' => '12:12:56',
 'date' => '2002-12-12');


  $line =~ s{<([^>]+)>} { exists( $var{$1} ) ? $var{$1} : "" }gsex;

"Colin Johnstone" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Gidday all,
>
> I wish to slurp in a letter template in the form of a text file and
> substitute fields in the letter for variables that are input on my html
> form. I indicate in the text file where the substitution should take place
> by the use of a  like in html.
>
> the Text file looks like this
>
> 
> Dear ,
>
> Your registration for our workshops has been successfully processed.
>
> Date: 
>
> Venue: 
>
> Time: 
>
> You have nominated to attend the following two workshops:
>
> 
>
> 
>
> We look forward to seeing you.
>
> 
>
> This is then to be sent as an email to the person who registered. I've
done
> the code it is below.
>
> 
>
> #!/usr/local/bin/perl
>
> print "Content-Type: text/html\n\n";
>
> $autoResponse = "responsepage.txt";
> $from = "colin\@johnstonefamily.com";
> $to = "colinjohnstone\@ozemail.com.au";
> $subject = "Testing.. Testing..";
> $sendmailpath="/usr/sbin/sendmail";
>
> #$inFile = "c:/xitami/cgi-bin/hp_data/".$autoResponse;
> $inFile =
> "/home/bdweb8083m/johnstonefamily.com/cgi-bin/hp_data/".$autoResponse;
>
> open (SENDMAIL, "| $sendmailpath -t");
> print SENDMAIL "Subject: $subject\n";
> print SENDMAIL "From: $from\n";
> print SENDMAIL "To: $to\n\n";
> print SENDMAIL "This is a test e-mail.\n\n";
>
> $/ = "undef";
> open(IN, "<$inFile") or die("Cannot open: $!");
> while( $email_body = ){
> print SENDMAIL "$email_body\n\n";
>   }
> close(IN);
>
> print SENDMAIL "Bye!\n\n";
> close (SENDMAIL);
>
> print("sending to...: $to");
>
> 
>
> All I need is help substituting the tags for the variables.
>
> Any help appreciated.
>
> Thank You
>
> Colin
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to create DBI connection on unix to MS SQL server ?

2002-08-02 Thread Vitaliy Babiy


"Learn Perl" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi guys,
>
> just wondering how to establish a DBI connection from a unix machine to a
> WINNT machine running MS SQL server? do I have to specify an OBDC?

I think you can do it as usually.

For example:
--
my $dbname ="aissm";
my $dbhost ="localhost";
my $dbuser ="root";
my $dbpass ="gfhjkm";

my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost","$dbuser","$dbpass");
--




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]