RE: Email function question
Have you tried put a semi-colon and space on the end of each users name? @names=([EMAIL PROTECTED]; ,[EMAIL PROTECTED]; ,[EMAIL PROTECTED]; ); Terry -Original Message- From: Scott, Deborah [mailto:[EMAIL PROTECTED]] Sent: 27 January 2003 22:54 To: [EMAIL PROTECTED] Subject: RE: Email function question > >if your file is a text file > >#! /usr/bin/perl -w > >$file = "/suidbin/sendmail -t"; >$var = "the_file.txt"; > >open(FILE, "$var") || die "cant open text file"; >@file = ; >close(FILE); > >##open pipe to sendmail >open(MAIL, "|$file") || die "cant open sendmail"; >print MAIL "To: blah\@devnull.bz\n" ; >print MAIL "From: blah\@cyberspace.org\n" ; >print MAIL "Subject: Fresh\n\n" ; >foreach(@file){ > print MAIL; >} >close ( MAIL ) ; > > >-- >jd >[EMAIL PROTECTED] > >Bad spellers of the world untie! The above file works great on my NT server but how do I send it to multiple people? I've tried turning the addressee string into an array, in multiple ways. An example is the following: @addressee=("joe_employee\@my.com","jane_employee\@your.com"); foreach $i (@addressee) { open(MAIL, "|$file $addressee") || die "can't open sendmail"; print MAIL "To: $addressee\n" ; print MAIL "From: tom_employee\n" ; print MAIL "Subject: Email Message\n\n" ; AND THEN I've put the closing brackets in multiple places... but I get the error that NO RECIPIENT is specified. Sent to dead letter file. It works if I only specify one addressee. Help, again??? --Deborah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sybase DBlib & CGI issue
as far as I can make out, apache needs to be running as a sybase user, you may also need to set some $ENV variables within the script eg: $ENV{'DSQUERY'}='SQLCAS' HTH Terry -Original Message- From: Dan Muey [mailto:[EMAIL PROTECTED]] Sent: 10 January 2003 17:41 To: Andy Bridger; Beginners Perl (E-mail) Subject: RE: Sybase DBlib & CGI issue Have it print $dbh->errstr to see what the database says is wrong. At least that'd work with DBI not sure about Sybase::Dblib. Regardless have it print the problem instead of just , 'sorry' Not sure also but it sounds like apache may not have permission to access the database. Ie you 'userbob' can access it but 'nobody' can't. Dan -Original Message- From: Andy Bridger [mailto:[EMAIL PROTECTED]] Sent: Friday, January 10, 2003 11:03 AM To: Beginners Perl (E-mail) Subject: Sybase DBlib & CGI issue I have a perl cgi script that needs to access a database using Sybase::DBlib. The CGI bit is working - am able to display text, forms etc correctly, but when try to connect to the database it fails to connect. Oddly the same db connection script works in a different script - and the db connection even works if run from the unix command line. use Sybase::DBlib; my $user = "xxxt"; my $pwd = "yyy"; my $server = "zzz"; my $dbh; if ($dbh = new Sybase::DBlib $user, $pwd, $server) { print "Server: $server \n"; $dbh->dbuse("kplus"); } else { print "Couldn't connect to $server "; return -1; } This displays the server connection when run from the command line, but the "Couldn't connect.." when run via the browser... The web server is Apache running on Solaris if that makes any difference. Any suggestions gratefully received. > Andy Bridger > > > > This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl and DB connectivities
Title: RE: perl and DB connectivities you could try this little routine, After opening the connection and making the query:- while(($rc = $X->ct_results($restype)) == CS_SUCCEED) { next if ($restype == CS_CMD_DONE || $restype == CS_CMD_FAIL || $restype == CS_CMD_SUCCEED); @names = $X->ct_col_names(); while(@dat = $X->ct_fetch) { #$no ++; if (%linehash) {undef(%linehash)}; #Clear out the hash ready for new data - if the hash exisits! $i=0; foreach $nm (@names) { #Populate a hash so that names of columns in DB can be used. $field{@names[$i]} = @dat[$i]; $i++; } } } .-Original Message- .From: loan tran [mailto:[EMAIL PROTECTED]] .Sent: 23 September 2002 16:12 .To: [EMAIL PROTECTED] .Subject: perl and DB connectivities . . .Howdy, . .Does someone know if there is a function in sybperl .(use Sybase::DBlib) which does exactly the same thing .of: $data = "$sth->fetchrow_hashref" (use DBI). . .In order words, .when using DBI, i can extract data from Sybase using .this .$sql = qq(select name,dbid from sysdatabases); .while(my $data = "$sth->fetchrow_hashref){ . print "DBName: $data{name}\n . DBId: $data{dbid}"; .} . .My question is: .Is there $sth->fetchrow_hashref or something similar .in sybperl (use Sybase::DBlib). . .Thanks. .Loan . .__ .Do you Yahoo!? .New DSL Internet Access from SBC & Yahoo! .http://sbc.yahoo.com . This message has been scanned for Viruses by Trend Interscan - Indalo Technologies www.indalo.co.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
$ENV{remote_user} - solved
Thanks to all who sugested that I needed to Define an authentication realm for my CGI directory That did the trick! terry On Thu, Feb 21, 2002 at 02:42:31PM -, IT Workflow - Terry Honeyford wrote: > but when I use Apache 1.3.22 I don't get as many $ENV's back from > the server, in particular the one my script is looking for - > ($ENV{remote_user}) In apache's httpd.conf, you should enable these lines: LoadModule auth_module modules/mod_auth.so AddModule mod_auth.c and define an authentication realm for your cgi directory, like this: Options ExecCGI Order allow,deny Allow from all AuthType Basic AuthName "World Administration" AuthUserFile /etc/httpd/conf/htpasswd require valid-user Satisfy all
$ENV{remote_user}?
Not sure if this is Perl or apache related, but have spent hours trawling through web sites for the answer Gettin a bit desperate now so any help would be much appreciated. I have a perl script that runs fine using netscape fastrack server but when I use Apache 1.3.22 I don't get as many $ENV's back from the server, in particular the one my script is looking for - ($ENV{remote_user}) has anyone any idea why this is happening? TIA Terry
RE: Stripping windows CR/LF characters
Got it sorted! I had already put the \n on the line before printing with no success, but I followed chomp with a chop, and it worked a treat! I think that chomp was removing the Carriage return but not line feed (maybe the other way round), the chop just removes the last character (which after chomp'ing would be the line feed) I think that's whats going on anyway! Thanks for all your help Terry Honeyford On Fri, 25 Jan 2002, IT Workflow - Terry Honeyford wrote: > I am trying to print out only the lines that begin with Either "Unable to > attach to", OR "Backup of" > and append to the line "NOT OK" or "OK" depending on which match I get > Here is the offending bit of script... > > open (FILE, " > while (){ > chomp; chop; #removes last character on line > if (m/^Unable to attach to/){ $line .= "$_ \t NOT OK\n"; > }elsif{ > (m/^Backup of/){ $line .= "$_ \tOK\n"; > } > } > Print $line; > > if I dont chomp $_ then I get the OK/Not OK message on the line below, > if I do use chomp I get the first 7 characters of the Original line then the > "OK/Not Ok" the original line the continues as though the OK/Not OK has > overprinted it! Just append "\n" to the line when you print it. -- Brett http://www.chapelperilous.net/ Is there life before breakfast? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stripping windows CR/LF characters
I am trying to print out only the lines that begin with Either "Unable to attach to", OR "Backup of" and append to the line "NOT OK" or "OK" depending on which match I get Here is the offending bit of script... open (FILE, "){ chomp; if (m/^Unable to attach to/){ $line .= "$_ \t NOT OK"; }elsif{ (m/^Backup of/){ $line .= "$_ \tOK"; } } Print $line; if I dont chomp $_ then I get the OK/Not OK message on the line below, if I do use chomp I get the first 7 characters of the Original line then the "OK/Not Ok" the original line the continues as though the OK/Not OK has overprinted it! EG: Unable to attach to Drive C: becomes Unable tNOT OKch to Drive C: Whereas what I am looking for is:- Unable to attach to Drive C: NOT OK Hope this makes the problem clearer! Many thanks for your help Terry Honeyford -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Stripping windows CR/LF characters
I am reading a line at a time of a windows log file and want to strip off the CR or LF characters at the end of the line chomp seems to have a weird effect (returning the cursor to the beginning of the line!) I am sure there is a regex to do this (similar to s/\cM//g for MAC line endings) but I don't know what characters are at the end of lines on a windows machine. Can anyone help? TIA Terry Honeyford -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]