[16109] in Perl-Users-Digest
Perl-Users Digest, Issue: 3521 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 06:10:31 2000
Date: Fri, 30 Jun 2000 03:10:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962359820-v9-i3521@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 30 Jun 2000 Volume: 9 Number: 3521
Today's topics:
Re: Installing Perlin non-predeined directory <gellyfish@gellyfish.com>
Re: Is there a way for perl to alarm() or sleep() for l (Abigail)
Re: Keeping track of open files (Abigail)
Re: Keeping track of open files <gellyfish@gellyfish.com>
Re: Load a HTML-File on another server <cyrus@aareus.com>
Logical Not : 'not' vs '!' <pat@isiserv.rug.ac.be>
Re: Logical Not : 'not' vs '!' (Neil Kandalgaonkar)
Re: Logical Not : 'not' vs '!' (Rafael Garcia-Suarez)
Re: Logical Not : 'not' vs '!' (Rafael Garcia-Suarez)
Re: Logical Not : 'not' vs '!' (Neil Kandalgaonkar)
Re: Logical Not : 'not' vs '!' (Abigail)
Looking for the comp.lang.perl.misc FAQ <o1technospam@skyenet.nospam.net>
Re: Lots of soft from NORMAN!! (Bart Lateur)
LPDEST Environment Variable <gyasuda@co.la.ca.us>
Re: Need help with IIS configuration for Perl script su <ekjolsrud@ipares.no>
Re: Need Help! <gellyfish@gellyfish.com>
Re: Need Help! <gellyfish@gellyfish.com>
Re: please help in an Dbi programme coonecting with mys <gellyfish@gellyfish.com>
Re: (Neil Kandalgaonkar)
Re: sending a password to a server. <gellyfish@gellyfish.com>
Re: Specifying smtp server in Mail::Mailer <gellyfish@gellyfish.com>
Sybase and perl anuragmenon@my-deja.com
Re: two BEGINs ? <gellyfish@gellyfish.com>
using @_ with subs (Just a quickie from a Perl Wannabe <lbg-geoff@powerup.com.au>
Re: where did the email my perl script sent go? <Peter.Dintelmann@dresdner-bank.com>
Re: where did the email my perl script sent go? <andre@UltraShell.Net>
Re: where did the email my perl script sent go? (Villy Kruse)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jun 2000 09:19:46 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Installing Perlin non-predeined directory
Message-Id: <8jhl72$9b4$1@orpheus.gellyfish.com>
On Thu, 29 Jun 2000 11:41:46 -0700 Sandeep Kasargod wrote:
> Hi,
> Programs like Apache depend on the paths in @INC and these are
> hardcoded.
No they dont. Perl uses @INC to find libraries and modules - no other
programs do.
> Is there some way that I can compile perl but have the user
> install the resulting binaries in some root directory not known at
> compile time - maybe have the paths needed for @INC be read out of an
> ascii configuration file ?
The PERL5LIB environment variable perhaps ?
> This would obviously mean changing something
> in the make process and/or source code. The aim is to not have the user
> compile anything, at the same time the install root should not be
> predefined.
>
>
The Activestate perl changes @INC depending on where the binary is installed
perhaps you could look at the source code and determine how it does it.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: 30 Jun 2000 01:20:26 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Is there a way for perl to alarm() or sleep() for less than a second
Message-Id: <slrn8locil.ka1.abigail@alexandra.delanet.com>
Flounder (japh@flashmail.com) wrote on MMCDXCV September MCMXCIII in
<URL:news:395C1B18.EFFC9C88@flashmail.com>:
;; Is there a way to send a sigalrm or sleep() in less than a second like
;; a half a second. alarm() and sleep() go by seconds i need milliseconds
That's a FAQ.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
------------------------------
Date: 30 Jun 2000 01:17:26 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Keeping track of open files
Message-Id: <slrn8locd1.ka1.abigail@alexandra.delanet.com>
Peter Sundstrom (peter.sundstrom@eds.com) wrote on MMCDXCV September
MCMXCIII in <URL:news:8jgv76$e2h$1@hermes.nz.eds.com>:
:}
:} Abigail wrote in message ...
:} >
:} >I would use IO::File by subclassing it, and then strictly use that
:} >subclass to open and access files.
:}
:} I'm not sure what you mean. Are you able to supply a code sample?
What part of what I said aren't you sure about?
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: 30 Jun 2000 09:44:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Keeping track of open files
Message-Id: <8jhmm4$e5l$1@orpheus.gellyfish.com>
On Wed, 28 Jun 2000 23:24:45 -0400 Tad McClellan wrote:
> On Thu, 29 Jun 2000 13:51:26 +1200, Peter Sundstrom <peter.sundstrom@eds.com> wrote:
>>
>>Tina Mueller wrote in message <8je5eo$dmii$1@ID-24002.news.cis.dfn.de>...
>>>hi,
>>>Peter Sundstrom <peter.sundstrom@eds.com> wrote:
>>>> What's the best way to handle keeping track of what files have been
>>opened?
>>>
>
>>>> I need to make sure that I only open the file once.
>
>>>> if (! defined $filehandle{$filename}) {
>>>> open $filehandle{$filename}, ">$filename" or die "Can not write to
>>>
>>>how do you initialize $filehandle{$filename}?
>>
>>It happens after the open:
>>
>>$filehandle{$filename}=$filename;
>>
>>>you should do it like
>>>$filehandle{$filename} = *FILEHANDLE;
>>>unless (fileno $filehandle{$filename}) {
>>> open $filehandle{$filename}, ">$filename" or die $!;
>>>}
>>
>>I don't see how this is any better. Perhaps I'm missing something obvious.
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I'm beginning to think that maybe you are missing the fact
> that filehandles are not first-class datatypes?
>
> (you cannot store them directly in an array)
>
Not strictly true as 5.6.0 :
#!/usr/bin/perl -w
use strict;
my %handles;
for (0 .. 9)
{
my $handle;
my $filename = "ht$_.txt";
open $handle,">$filename" or die "Cant open $filename - $!\n";
$handles{$filename} = $handle;
}
for (keys %handles)
{
print { $handles{$_} } "I am $_\n";
close $handles{$_};
}
Which might be similar to what the OP wants .
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Thu, 29 Jun 2000 22:47:36 -0600
From: "Cyrus W." <cyrus@aareus.com>
Subject: Re: Load a HTML-File on another server
Message-Id: <395C2668.36E03F7C@aareus.com>
With Apache, I believe you can go:
print "Location:$location\n\n";
where $location is where you want the user to go.
Was that the answer to your question?
Cyrus W.
Matthias Keller wrote:
> Hi
>
> Is it possible to redirect a browser to another HTML-File on another
> server?
>
> Thanks
>
> Matt
------------------------------
Date: Fri, 30 Jun 2000 10:21:32 +0100
From: "Patrick.Hochstenbach" <pat@isiserv.rug.ac.be>
Subject: Logical Not : 'not' vs '!'
Message-Id: <Pine.GSO.4.21.0006301015210.27248-100000@isiserv.rug.ac.be>
Am I missing something?
Why does this code give me answer '1':
$a = 'foo';
$b = 'bar';
if ( ! $a && ! $b ) {
print "0\n";
} else {
print "1\n";
}
while this code gives me answer '0':
$a = 'foo';
$b = 'bar';
if ( not($a) && not($b) ) {
print "0\n";
} else {
print "1\n";
}
Pat.
Patrick Hochstenbach Rozier 9
Ghent University 9000 GENT
Central Library, Informatic dept Belgium
Http://www.lib.rug.ac.be Patrick.Hochstenbach@rug.ac.be
------------------------------
Date: Fri, 30 Jun 2000 09:04:27 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <8jhnef$edk$1@localhost.localdomain>
In article <Pine.GSO.4.21.0006301015210.27248-100000@isiserv.rug.ac.be>,
Patrick.Hochstenbach <Patrick.Hochstenbach@rug.ac.be> wrote:
>
>
>Am I missing something?
>
>Why does this code give me answer '1':
>
>$a = 'foo';
>$b = 'bar';
>
>if ( ! $a && ! $b ) {
> print "0\n";
>} else {
> print "1\n";
>}
>
>
>while this code gives me answer '0':
>
>$a = 'foo';
>$b = 'bar';
>
>if ( not($a) && not($b) ) {
> print "0\n";
>} else {
> print "1\n";
>}
>
>
I can't replicate that.
According to Deparse, the code should compile identically.
[neil@delilah neil]$ perl -MO=Deparse,-p -e '$a = "foo"; $b="bar"; if ( not($a)
&& not($b) ) { print "0\n" } else { print "1\n"} ' > ab1
-e syntax OK
[neil@delilah neil]$ perl -MO=Deparse,-p -e '$a = "foo"; $b="bar"; if ( ! $a
&& ! $b ) { print "0\n" } else { print "1\n"} ' > ab2
-e syntax OK
[neil@delilah neil]$ diff ab1 ab2
[neil@delilah neil]$ more ab1 ab2
::::::::::::::
ab1
::::::::::::::
($a = 'foo');
($b = 'bar');
if (((not $a) and (not $b))) {
print("0\n");
}
else {
print("1\n");
}
::::::::::::::
ab2
::::::::::::::
($a = 'foo');
($b = 'bar');
if (((not $a) and (not $b))) {
print("0\n");
}
else {
print("1\n");
}
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: Fri, 30 Jun 2000 09:09:40 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <slrn8lop6j.pn0.garcia_suarez@rafael.kazibao.net>
Patrick.Hochstenbach wrote in comp.lang.perl.misc:
>
>
>Am I missing something?
>
>Why does this code give me answer '1':
>
>$a = 'foo';
>$b = 'bar';
>
>if ( ! $a && ! $b ) {
> print "0\n";
>} else {
> print "1\n";
>}
>
>
>while this code gives me answer '0':
>
>$a = 'foo';
>$b = 'bar';
>
>if ( not($a) && not($b) ) {
> print "0\n";
>} else {
> print "1\n";
>}
You misplaced the parentheses.
'not' is an operator, not a function. Thus
not($a) && not($b)
is equivalent to
not (($a) && not ($b))
because of operator precedence. ( '($a)' and '($b)' are single-element
lists). You should have written
(not $a) && (not $b)
to get the desired result.
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 30 Jun 2000 09:18:20 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <slrn8lopmr.poj.garcia_suarez@rafael.kazibao.net>
Neil Kandalgaonkar wrote in comp.lang.perl.misc:
>In article <Pine.GSO.4.21.0006301015210.27248-100000@isiserv.rug.ac.be>,
>Patrick.Hochstenbach <Patrick.Hochstenbach@rug.ac.be> wrote:
>>
>>
>>Am I missing something?
>>
>>Why does this code give me answer '1':
>>
>>$a = 'foo';
>>$b = 'bar';
>>
>>if ( ! $a && ! $b ) {
>> print "0\n";
>>} else {
>> print "1\n";
>>}
>>
>>
>>while this code gives me answer '0':
>>
>>$a = 'foo';
>>$b = 'bar';
>>
>>if ( not($a) && not($b) ) {
>> print "0\n";
>>} else {
>> print "1\n";
>>}
>>
>>
>
>I can't replicate that.
>
>According to Deparse, the code should compile identically.
What is your perl version? It seems that the parser has evolved since
5.00503.
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 30 Jun 2000 09:33:40 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <8jhp55$efe$1@localhost.localdomain>
In article <slrn8lop6j.pn0.garcia_suarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <garcia_suarez@hotmail.com> wrote:
>You misplaced the parentheses.
>'not' is an operator, not a function. Thus
> not($a) && not($b)
>is equivalent to
> not (($a) && not ($b))
>because of operator precedence.
Not.
$ perl -MO=Deparse,-p -e ' ! $a && ! $b ' 2>&-
((not $a) and (not $b));
$ perl -MO=Deparse,-p -e ' not($a) && not($b) ' 2>&-
((not $a) and (not $b));
$ perl -MO=Deparse,-p -e ' (not $a) && (not $b) ' 2>&-
((not $a) and (not $b));
The only really different one is low-precedence 'not' without any
parens:
$ perl -MO=Deparse,-p -e ' not $a && not $b ' 2>&-
(not ($a && (!$b)));
I see no difference in behaviour, and Deparse seems to confirm it.
(Forgive the use of Deparse twice in one thread, it's my favorite
new toy. :)
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: 30 Jun 2000 05:53:07 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <slrn8losht.r4j.abigail@alexandra.delanet.com>
Patrick.Hochstenbach (pat@isiserv.rug.ac.be) wrote on MMCDXCV September
MCMXCIII in <URL:news:Pine.GSO.4.21.0006301015210.27248-100000@isiserv.rug.ac.be>:
)) while this code gives me answer '0':
))
)) $a = 'foo';
)) $b = 'bar';
))
)) if ( not($a) && not($b) ) {
)) print "0\n";
)) } else {
)) print "1\n";
)) }
That prints '1' for me, as it should.
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
------------------------------
Date: Fri, 30 Jun 2000 01:53:22 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Looking for the comp.lang.perl.misc FAQ
Message-Id: <SmX65.628$JZ4.2014@newsfeed.slurp.net>
Ok, I'm sure I'm going to displease SOMEONE here, but I've looked on
deja.com CPAN, www.perlfaq.com www.perl.com language.per.com and a few
others I can't recall, but I still can't find the FAQ for this newsgroup.
I'm tired, and probably have overlooked it somewhere, so please forgive me,
but where is the FAQ? (Probably just not using the correct search
parameters.)
I'm not looking for the Perl FAQ, but the rules and etiqute for this
newsgroup.
Had much fun reading and learning today. You can learn SOOO much here, but
now I need to sleep.
Thanks in advance.
JMK
------------------------------
Date: Fri, 30 Jun 2000 09:19:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Lots of soft from NORMAN!!
Message-Id: <395c65d8.261607@news.skynet.be>
cdsimpl_2000@my-deja.com wrote:
>Lots of soft from NORMAN!!
>AUTOCAD 2000 ON 2 CD'S
You wrote AutoCAD? Wow!
--
Bart.
------------------------------
Date: Thu, 29 Jun 2000 15:03:24 -0700
From: Gary Yasuda <gyasuda@co.la.ca.us>
Subject: LPDEST Environment Variable
Message-Id: <395BC7AC.508DA077@co.la.ca.us>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>I am using Perl 5.6.0 with HP-UX 11.0.</tt><tt></tt>
<p><tt>I used the Env module so that I can use the LPDEST variable.</tt><tt></tt>
<p><tt>I wrote a script so that a user can designate a printer from</tt>
<br><tt>the command line.</tt><tt></tt>
<p><tt># print.pl PRINTER</tt><tt></tt>
<p><tt>In my code I include:</tt>
<br><tt>use Env;</tt>
<br><tt>$LPDEST=$ARGV[0];</tt>
<br><tt>system("echo $LPDEST");</tt>
<br><tt># PRINTER is displayed</tt>
<br><tt>system("lp file");</tt><tt></tt>
<p><tt>The message:</tt>
<br><tt>"lp: no system default destination" is displayed.</tt>
<br><tt>In the system("echo $LPDEST"), the PRINTER designated is</tt>
<br><tt>displayed prior to executing the "lp" command. Can someone</tt>
<br><tt>help me get this to print to the printer in LPDEST?</tt><tt></tt>
<p><tt>Sincerely,</tt><tt></tt>
<p><tt>Gary Yasuda</tt></html>
------------------------------
Date: Fri, 30 Jun 2000 06:06:22 GMT
From: "Eirik Kjølsrud" <ekjolsrud@ipares.no>
Subject: Re: Need help with IIS configuration for Perl script support
Message-Id: <yNW65.916$Dxe.180585472@news.telia.no>
Where can I get a new version, and more importantly, what version is the
current ?
Is the new versions backwards-compatible with old perl-scripts ?
Eirik
------------------------------
Date: 30 Jun 2000 10:12:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need Help!
Message-Id: <8jho9e$je0$1@orpheus.gellyfish.com>
On Wed, 28 Jun 2000 19:39:25 GMT tia_miller@my-deja.com wrote:
>
> sick,
> bonus, 100% health/dental benefits.
I'd rather have healthy, regular 75% health/dental benefits.
> Very casual environment (Shorts).
Cheers mines a large Glenmorangie.
>
> We are wrapping up our 2nd round of funding and we have other Venture
> Capitalists waiting in line to invest in our company.
>
Maybe you ought to just wrap up your Venture Capitalists.
Consider yourself flamed for posting a Job ad in a technical newsgroup.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: 30 Jun 2000 10:08:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need Help!
Message-Id: <8jho1t$il3$1@orpheus.gellyfish.com>
On 29 Jun 2000 15:26:06 GMT newsposter@cthulhu.demon.nl wrote:
> Drew Simonis <care227@attglobal.net> wrote:
>> tia_miller@my-deja.com wrote:
>>>
>>> bonus, 100% health/dental benefits. Very casual environment (Shorts).
>>> ^^^^^^
>
>> When I work from home I wear my undies till 2. Can I do that at your
>> establishment? (not work from home, but wear undies anyway.)
>
> If you do not wear a very short skirt I think you can get away
> with not wearing any underwear ;)
>
Or cling film - you probably ought to wear underwear if you are only wrapped
in cling film - but hey what do I know some companies have a very liberal
dress code these days - but I must admit I bottled out of wearing the
grass skirt this morning ..
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: 30 Jun 2000 09:40:33 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: please help in an Dbi programme coonecting with mysql
Message-Id: <8jhme1$dbh$1@orpheus.gellyfish.com>
On Thu, 29 Jun 2000 01:24:37 GMT Joydip Chakladar wrote:
> Hi everybody,
>
> I am new at DBI.
>
> This is an sample programme I am building for connecting to mysql. I
> have mentioned a part of it here where it is giving a compilation error
> mesage in Use DBI;line.
>
> Error Message :-
>
> Can't locate loadable object for module DBI in @INC contain
> c:\Perl\lib and C:\Perl\site\lib .) at c:\Perl\site\lib\dbi.pm at line
> 164.
>
You havent got DBI properly installed. Reinstall it properly using PPM.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Fri, 30 Jun 2000 09:43:04 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re:
Message-Id: <8jhpmp$eh0$1@localhost.localdomain>
In article <slrn8lopmr.poj.garcia_suarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <garcia_suarez@hotmail.com> wrote:
>What is your perl version? It seems that the parser has evolved since
>5.00503.
I'm using 5.6.0. Funny, I had a sneaking suspicion about this, but I
thought there was no way operator precedence had changed.
$ perl5.00503 -MO=Deparse,-p -e ' not($a) && not($b) ' 2>&-
(not ($a && (!$b)));
$ perl5.6.0 -MO=Deparse,-p -e ' not($a) && not($b) ' 2>&-
((not $a) and (not $b));
Shame on me for not checking.
So, is this a bug or a feature? I don't see anything in perldelta.
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: 30 Jun 2000 09:15:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: sending a password to a server.
Message-Id: <8jhkur$8gk$1@orpheus.gellyfish.com>
On Thu, 29 Jun 2000 14:08:07 -0400 Andrew Bacchi wrote:
> I have to send a password to a server to restart it from a Perl script.
> Can someone tell me where to look to do this? A hint would be helpful.
A hint as to what you mean by 'send' and 'server' might be of use.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: 30 Jun 2000 09:34:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Specifying smtp server in Mail::Mailer
Message-Id: <8jhm28$c4m$1@orpheus.gellyfish.com>
On Thu, 29 Jun 2000 18:35:09 GMT Shana Rosenberg wrote:
> I am using ActivePerl on a Win95 machine and am having the problem that
> when I have my personal mail server turned ON the code below works fine-
> -because it is accessing my mail server. (The code below does NOT refer
> to my mail server). However, when I turn the mail server off and
> attempt to use this code, I get the following error: 'Died at
> C:/Perl/site/lib/Mail/Mailer.pm line 264'.
>
> It is my understanding from perusing this group's archives that I am
> using the proper syntax to specify 'mailfwd.muohio.edu' as the smtp
> server I want the script to use. Although my personal mail server is a
> fun toy, the script I'm writing is for work, and thus I must use the
> supported resources available.
>
> I'm using the following code:
>
> $mailer = Mail::Mailer->new('smtp',Server=>'mailfwd.muohio.edu');
> $mailer->open({ From => 'rosenbse@muohio.edu',
> To => 'rosenbse@muohio.edu',
> Subject => 'test',
> });
>
> Any suggestions?
>
You are indeed using the module correctly ?
have you thought that the server in question might not allowing relaying
for the host you are sending from ? What you might want to do is to
temporarily alter Mail::Mailer::smtp so that it turns the debugging on
for Net::SMTP - or you could use Net::SMTP directly to talk to the
server in question.
Actually could anyone see any virtue of having the facility in Mail::Mailer
to turn on debugging for Net::SMTP or sendmail ? (I dont think mail or
mailx have such a facility).
/J\
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Fri, 30 Jun 2000 04:06:31 GMT
From: anuragmenon@my-deja.com
Subject: Sybase and perl
Message-Id: <8jh6bv$fg8$1@nnrp1.deja.com>
I am utterly failing to understand what mistake I am making connecting
to a sybase database with a paramater (an input text from a form - the
whole thing is a perl CGI script) and executing an SQL statement and
retrieving the results and printing it out to another form. Thats all..
all the forms are fine and the parameter is passing right..but something
about the connection is not right. I followed the documentation for the
DBI module and yet it is so frustrating and I am running out of time.
Can anyone try to post a pseudocode or portion of script that connects
to a sybase database, uses a parameter from a form, executes the SQL and
retrieves the records that match that parameter - a very simple select.
I will also need to access the records and the individual values in
there.
I know the code is really short and not very complicated, but I am not
having any luck!
WOuld somebody have a basic piece of code to do this that I can
manipulate around? Please..
Thanks for all the help..
Vinod.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Jun 2000 09:49:46 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: two BEGINs ?
Message-Id: <8jhmva$f3s$1@orpheus.gellyfish.com>
On Wed, 28 Jun 2000 14:44:34 -0400 Jonah wrote:
> BEGIN {require "config.cgi" };
> use vars qw($password $idfile $errors);
>
> BEGIN
> {
> use CGI::Carp qw(carpout);
> open(LOG, ">>$errors") or die("Unable to open $errors: $!\n");
> carpout(LOG);
> }
>
> use strict;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI;
> use Time::Local;
> my $q = new CGI;
> print $q->header;
>
> #and so on
>
>
> The first BEGIN is to import the variables. I'm doing it this way because
> the script in which I'm importing has use strict, as you can see.
> I need to import variables to get the $errors variable for the second
> BEGIN.
>
> Anything wrong with this? It works, but something seems not right.
>
What do you mean 'something seems not right' ? this is perfectly fine -
the BEGIN blocks are evaluated in the order of the code - although I'm
not quite sure why you have CGI::Carp in there twice - why dont you just
have it in the once with both things in the import list ?
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Fri, 30 Jun 2000 15:13:32 +1000
From: "Geoff Toogood" <lbg-geoff@powerup.com.au>
Subject: using @_ with subs (Just a quickie from a Perl Wannabe :)
Message-Id: <395c2f5d@grissom>
Hi All,
CURRENT SYSTEM = x86 200mhz / 60mb RAM / Active PERL 5.6 & WIN98
I am using the @_ function in my code to pass variables to my subroutine.
########
open (FILE, '>>file.txt') || &error("CANT OPEN FILE");
sub error {
($string) = @_;
print "ERROR: $string";
}
########
Yet when I use this method for more than one subroutine in the same script,
I get a nasty "WINBLOWS ILLEGAL OPERATION ERROR" telling me some useless
error code that means bollocks to me, but mabey someone out there in
PERL/WIN32 land has had this before or knows what is the problem is?
WINBLOWS ERROR
------------------------
PERL caused an invalid page fault in
module <unknown> at 0000:1f42cf70.
Registers:
EAX=08aa0094 CS=0167 EIP=1f42cf70 EFLGS=00010202
EBX=08aa0340 SS=016f ESP=0853f8c4 EBP=0853f8e4
ECX=00000000 DS=016f ESI=08aa0a98 FS=4c0f
EDX=81630854 ES=016f EDI=00000001 GS=0000
Bytes at CS:EIP:
Stack dump:
1f4928b6 00000003 08555528 087e0000 087efe20 08a9a124 00000000 00000000
0853f914 1f49267d 08aa0a98 00000001 00000010 087efe20 087efe20 08a97151
Any Ideas?
Cheers
Geoff
------------------------------
Date: Fri, 30 Jun 2000 11:00:42 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: where did the email my perl script sent go?
Message-Id: <8jhnih$hu22@intranews.dresdnerbank.de>
Hi,
yoshi schrieb in Nachricht <20000629184956.02029.00001332@ng-md1.aol.com>...
>I am working on a very simple script to send an email to someone (to be
built
>upon later) through perl. It runs fine, and prints the blank screen, but
the
>email never arrives. How long should it take (I have included the script
>below)?
--snip--
>use Net::SMTP;
>
>my $subject = "Subject: My test message\n\n";
>my $message = <<EOM;
>Perl sent this message. Nifty, Eh?
>EOM
>
>$smtp = Net::SMTP->new('mailhost');
>$smtp->mail($ENV{USER});
>$smtp->to('datera@datera.com');
>$smtp->data();
>
>$smtp->datasend($subject);
and where are all the mail headers??? In particular
you are missing the 'To:' and 'From:' headers. No
MTA knows how to route your mail...
I expected something like
$smtp -> datasend( "To: datera@datera.com\n" );
$smtp -> datasend( "From: myemail@mydomain\n" );
$smtp -> datasend( "Content-type: text/plain\n\n" );
You had of course a look at your mailserver logfiles
What was in there???
Best regards,
Peter Dintelmann
------------------------------
Date: Fri, 30 Jun 2000 09:34:23 GMT
From: Andre van Straaten <andre@UltraShell.Net>
Subject: Re: where did the email my perl script sent go?
Message-Id: <zQZ65.26180$Q7.564184@news-east.usenetserver.com>
Looking at the script and your posting header, it looks like you're
running this script on a remote server, now or later as a CGI script.
It is possible, that this is a server config problem.
You know, that calling a script from the command line and from the Web has
the difference that in the first case you call the script with your user
name and permissions, and in the latter case the script is called by
"nobody" or "www" etc.
Execute your script from the command line, the print output will also be
there, and check the mail function.
If you receive an e-mail, then users like "nobody" might not be allowed to
send e-mail. Check your docs, faqs, or ask the server admin.
If no mail came through, start with sending an e-mail from the command
line, using mail for example.
This takes from a few seconds to max. 10 minutes, generally.
If this works but your script still doesn't, try to use the programs
"mail" or "sendmail" to execute the command line used before now from
inside of your script.
-- avs
yoshi <catgolf888@aol.com> wrote:
> Hello.
> I am working on a very simple script to send an email to someone (to be built
> upon later) through perl. It runs fine, and prints the blank screen, but the
> email never arrives. How long should it take (I have included the script
> below)?
> Thanks!
> yoshi
> datera@datera.com
> ===============================
> #!/usr/local/bin/perl -w
> print "Content-Type: text/html\n\n";
> use Net::SMTP;
> my $subject = "Subject: My test message\n\n";
> my $message = <<EOM;
> Perl sent this message. Nifty, Eh?
> EOM
> $smtp = Net::SMTP->new('mailhost');
> $smtp->mail($ENV{USER});
>
> $smtp->to('datera@datera.com');
> $smtp->data();
>
> $smtp->datasend($subject);
> $smtp->datasend($message);
> $smtp->dataend();
> $smtp->quit();
> ===============================
--
Andre van Straaten
http://www.vanstraatensoft.com
______________________________________________
flames please to /dev/null@vanstraatensoft.com
------------------------------
Date: 30 Jun 2000 09:38:59 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: where did the email my perl script sent go?
Message-Id: <slrn8loqli.20b.vek@pharmnl.ohout.pharmapartners.nl>
On Fri, 30 Jun 2000 11:00:42 +0200,
Dr. Peter Dintelmann <Peter.Dintelmann@dresdner-bank.com> wrote:
>>$smtp->datasend($subject);
>
> and where are all the mail headers??? In particular
> you are missing the 'To:' and 'From:' headers. No
> MTA knows how to route your mail...
> I expected something like
>
> $smtp -> datasend( "To: datera@datera.com\n" );
> $smtp -> datasend( "From: myemail@mydomain\n" );
> $smtp -> datasend( "Content-type: text/plain\n\n" );
>
> You had of course a look at your mailserver logfiles
> What was in there???
>
No MTA is using the To: header line for any routing purpose whatsoever.
The To: is of the benefit of the receiver and is compaired to the
receiving addres you type at start of a paper letter. The Postal service
can't read that address but uses only the address typed on the envelope.
>>$smtp = Net::SMTP->new('mailhost');
>>$smtp->mail($ENV{USER});
>>$smtp->to('datera@datera.com');
>>$smtp->data();
The $smtp->to(...) specifies the envelope destination address which is the
one used by the next SMTP server.
But of course a proper formatted mail message will include From: To:
Subject: and Date: headers, still for the benefit of the final recipient.
Villy
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3521
**************************************