[19514] in Perl-Users-Digest
Perl-Users Digest, Issue: 1709 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 7 09:05:31 2001
Date: Fri, 7 Sep 2001 06:05:10 -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: <999867909-v10-i1709@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 7 Sep 2001 Volume: 10 Number: 1709
Today's topics:
Re: \n doesn't translate to %0A with s/(.)/uc(sprintf(" <krahnj@acm.org>
\n doesn't translate to %0A with s/(.)/uc(sprintf("%%%0 <perrot@NOSPAM.fluxus.net>
Re: \n doesn't translate to %0A with s/(.)/uc(sprintf(" (Villy Kruse)
Re: Baiting Gozilla to obtain quality code for nothing! (Helgi Briem)
Re: build DBI module for Perl on NT box (Helgi Briem)
Re: can this perl script be more elegant/shorter ? <goldbb2@earthlink.net>
Re: Can't call method "uri"? (Helgi Briem)
Re: File::Find not recursing on Win32 Perl 5.001 (Phil Hibbs)
Re: File::Find not recursing on Win32 Perl 5.001 <dtweed@acm.org>
Generating a 'reversable' code... <junkmail@nawebspam.com>
Re: Generating a 'reversable' code... <junkmail@nawebspam.com>
Re: HASH question (Abigail)
Re: HASH question <iltzu@sci.invalid>
How can I catch unimplemented options, using Getopt::Mi (Stan Brown)
Re: I get all links, but no not want the picture links <iltzu@sci.invalid>
Re: Open 2 exes from Perl <goldbb2@earthlink.net>
Re: OT: urgent reponse <iltzu@sci.invalid>
Re: Pause for time. <em@online.no>
Re: Perl/CGI Script <bart.lateur@skynet.be>
POST form data from e-mail client <miked@rdi-clear.com>
Re: Problem with mail module (Tad McClellan)
Re: Regular Expression puzzle... <Laocoon@eudoramail.com>
SNMP.so? <josef.moellers@fujitsu-siemens.com>
Re: SQL question <justin.devanandan.allegakoen@intel.com>
Re: SQL question <nobody@nowhere.com>
Re: Timezone offset news@roaima.demon.co.uk
Re: Timezone offset <sh@planetquake.com>
Re: Timezone offset news@roaima.demon.co.uk
Re: Undef'ing multiple variables (Rafael Garcia-Suarez)
Re: Undef'ing multiple variables <nobody@nowhere.com>
Re: Undef'ing multiple variables (Anno Siegel)
Using OLE with Perl <justin.devanandan.allegakoen@intel.com>
Wierd: SUN problem or Perl problem ? <koff@nospam.pop.jaring.my>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 Sep 2001 10:14:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: \n doesn't translate to %0A with s/(.)/uc(sprintf("%%%02x", ord($1)))/eg ?
Message-Id: <3B989E8F.44AD3DAC@acm.org>
Gildas PERROT wrote:
>
> Sorry for the subject but at least it is going to be clear for certains ;-)
> In fact, I don't understand why "\r" is correctly translated to 0D and not
> "\n" to 0A.
Well you've got two problems. The main problem is that the period (.) in
a regular expression will match any character _except_ a newline. To
match a newline you need the /s modifier. The other problem, which might
not effect you, is that the \n is different on different operating
systems. If you want the characters 0D and 0A then just use those
characters.
> Here is my code :
>
> $texte = "BEGIN\r\n";
my $texte = "BEGIN\x0D\x0A";
> $texte =~ s/(.)/uc(sprintf("%%%02x", ord($1)))/eg;
^^
No need for uc() here, let sprintf() do it.
$texte =~ s/(.)/sprintf '%%%02X', ord $1/seg;
# The upper case X in the format will create upper case hex digits
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 7 Sep 2001 11:00:50 +0200
From: "Gildas PERROT" <perrot@NOSPAM.fluxus.net>
Subject: \n doesn't translate to %0A with s/(.)/uc(sprintf("%%%02x", ord($1)))/eg ?
Message-Id: <9na2hd$iec$1@wanadoo.fr>
Hi,
Sorry for the subject but at least it is going to be clear for certains ;-)
In fact, I don't understand why "\r" is correctly translated to 0D and not
"\n" to 0A.
Here is my code :
$texte = "BEGIN\r\n";
$texte =~ s/(.)/uc(sprintf("%%%02x", ord($1)))/eg;
print $texte;
I have :
%42%45%47%49%4E%0D
Any idea about that problem and how to solve it ? Thanks in advance for your
help. Gildas.
------------------------------
Date: 07 Sep 2001 09:44:31 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: \n doesn't translate to %0A with s/(.)/uc(sprintf("%%%02x", ord($1)))/eg ?
Message-Id: <slrn9ph5nv.p1n.vek@pharmnl.ohout.pharmapartners.nl>
On Fri, 7 Sep 2001 11:00:50 +0200,
Gildas PERROT <perrot@NOSPAM.fluxus.net> wrote:
>Hi,
>
>Sorry for the subject but at least it is going to be clear for certains ;-)
>In fact, I don't understand why "\r" is correctly translated to 0D and not
>"\n" to 0A.
>Here is my code :
>
>$texte = "BEGIN\r\n";
>$texte =~ s/(.)/uc(sprintf("%%%02x", ord($1)))/eg;
>print $texte;
>
>I have :
>
>%42%45%47%49%4E%0D
>
>Any idea about that problem and how to solve it ? Thanks in advance for your
>help. Gildas.
>
Probably because (.) doesn't match the trailing \n character and therefore
not converted by the regular expression.
$texte = "BEGIN\r\n";
$texte =~ s/(.|\n)/uc(sprintf("%%%02x", ord($1)))/eg;
print $texte;
%42%45%47%49%4E%0D%0A
Villy
------------------------------
Date: Fri, 07 Sep 2001 09:53:44 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Baiting Gozilla to obtain quality code for nothing!!
Message-Id: <3b9898ba.753992293@news.isholf.is>
On Thu, 06 Sep 2001 14:12:52 +0100, Paul Boardman
<peb@bms.umist.ac.uk> wrote:
>Matt Garrish wrote:
>
>> And all this time I thought he was Don King's hideous love child...
>
>What's all this 'he' business. If you'd all been reading as many of
>Kiras posts as you imply I would have thought it obvious that *he* is a
>*she*.
>
>Godzilla! Queen Of Cream Pi.
>Godzilla! Queen Of Semantic Guerrillas.
>Godzilla! Queen Of Perl Heretics.
>Godzilla! Queen Of Realitia.
>Godzilla! Queen Of Consistent Erronia.
>Godzilla! Queen Of Sky Pilots.
>Godzilla! Queen Of Coherentia.
>Godzilla! Queen Of Decimalatia.
Lot's of guys call themselves "Queens".
Godzilla is definitely related to, or educated by Don King.
Its day job might be Don King impressionist.
Regards,
Helgi Briem
------------------------------
Date: Fri, 07 Sep 2001 09:58:05 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: build DBI module for Perl on NT box
Message-Id: <3b98997d.754187374@news.isholf.is>
On 6 Sep 2001 08:50:33 -0700, jwang@maill.com (Jiqun Wang)
wrote:
>Hi,
>
>What I am doing is to build a DBI module for the core perl
>distribution on
>my NT box.
>> During the "nmake" process, I met this error:
>> D:\perl\5.00503\bin\mswin32-x86\perl.exe -ID:\perl\5.00503\lib\MSWin32-x86
>> -ID:\perl\5.00503\lib -e "system qq[pl2bat.bat ].shift" blib\script\dbish
>> The name specified is not recognized as an internal or external command,
>> operable program or batch file.
>> ---------- end of msg ------------------
>I am using core Perl distribution (5.00503) coming with Oracle9i App
>Svr. NT4.0, Visual C++ 6.0 installed.
>Could anyone give me some tips on how to solve this problem?
>Thanks in advance.
Don't use nmake. Install Activestate Perl and
then use the bundled program PPM to install
DBI with the command:
ppm install DBI
Hey presto. You will probably have to set
your HTTP_proxy environment variable to
http://yourproxy.yourdomain:PORTNUM
Regards,
Helgi Briem
------------------------------
Date: Fri, 07 Sep 2001 03:24:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: can this perl script be more elegant/shorter ?
Message-Id: <3B987625.9CF6F0E2@earthlink.net>
John W. Krahn wrote:
[snip]
> This program produces the same output as yours (and is definitely
> shorter.)
>
> #!/usr/local/bin/perl -w
>
> my $output = qw( OUT );
> open OUTPUT, "> $output" or die "Cannot write to $output: $!\n";
>
> __END__
Umm, I guess I should have said, caevat emptor: this code untested?
Anyway... what'd I do wrong? Is my code utter nonsense, or is almost
right, but with some dumb bug like a broken regex?
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Fri, 07 Sep 2001 10:03:53 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Can't call method "uri"?
Message-Id: <3b989af0.754558898@news.isholf.is>
On Thu, 6 Sep 2001 19:14:03 -0400 (EDT),
soulsescape@hotmail.com (Souls Escaped) wrote:
>Has anyone ran into this problem?
>
>[Can't call method "uri" on an undefined value at
>/usr/local/lib/perl5/site_perl/5.6.1/HTTP/Response.pm line 173]
Yep.
>How can I fix this problem??
Define the value you are passing to Response.pm
Seriously, if you want any help here, your post
has to be a lot more informative than this.
Pare your code down to the minimum that
still exhibits the error. By then you will probably
have found the error. If not post your snippet
and ask for advice.
Regards,
Helgi Briem
------------------------------
Date: 7 Sep 2001 05:01:42 -0700
From: phil@snark.freeserve.co.uk (Phil Hibbs)
Subject: Re: File::Find not recursing on Win32 Perl 5.001
Message-Id: <979ae699.0109070401.3ceb8a98@posting.google.com>
Dave Tweed <dtweed@acm.org> wrote in message news:<3B977EDA.62B755E4@acm.org>...
> Try this. It's code that I've used, with minor tweaks, on DOS and Windows
> platforms since Perl4 days.
Thanks, that works!
What does this mean:
local (*DIR);
Phil.
------------------------------
Date: Fri, 07 Sep 2001 12:39:26 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: File::Find not recursing on Win32 Perl 5.001
Message-Id: <3B98BEE6.714300DE@acm.org>
Phil Hibbs wrote:
> What does this mean:
> local (*DIR);
Well, assuming you know what local does in general (create a local value
of a global variable), it does that for the entire glob associated with
the name 'DIR'. It's a big hammer, but this is the only way to create a
local value for a filehandle. It allows the subroutine to work correctly
even if the caller has an filehandle named 'DIR' open across the call.
It isn't required for the recursive calls, however, since the subroutine
doesn't keep the filehandle open across the recursive calls. If you know
that that caller doesn't have such a filehandle, you can leave the
statement out altogether.
-- Dave Tweed
------------------------------
Date: Fri, 07 Sep 2001 05:26:03 -0700
From: Imran <junkmail@nawebspam.com>
Subject: Generating a 'reversable' code...
Message-Id: <qaehptcgp0ip12t6jqvipajc9e8r19hv8q@4ax.com>
Hi,
New to this NG. Looks very interesting, and hopefully I may
contribute to the answers. but for now, trying to figure couple of
things out.
I want to take a number and generate a string (of like maybe 8 or 10
characters... it could vary, but shouldn't get too big, i guess). and
then in reverse, i want to be able to specify the string and generate
the number back. And a given number or string would always generate
the same result (back or forth).
(basically trying to hide a numeric value from the user) There
probably is a simple solution involving pack/unpack. but reading
couple of books (Prog Perl, Perl Cook), i just can't seem to grasp the
function.
any pointers, or examples?
Thanks for any help.
Imran
rm 'spam' from mailaddy
------------------------------
Date: Fri, 07 Sep 2001 05:50:16 -0700
From: Imran <junkmail@nawebspam.com>
Subject: Re: Generating a 'reversable' code...
Message-Id: <gfghpto9q2c8c3stk3ltv9icf3jqjuu19h@4ax.com>
Ooops, i forgot to say, that the string looks like random text, and
the string made up of [a-zA-Z0-9]
sorry.
Imran
On Fri, 07 Sep 2001 05:26:03 -0700, Imran <junkmail@nawebspam.com>
wrotd:
>Hi,
>
>New to this NG. Looks very interesting, and hopefully I may
>contribute to the answers. but for now, trying to figure couple of
>things out.
>
>I want to take a number and generate a string (of like maybe 8 or 10
>characters... it could vary, but shouldn't get too big, i guess). and
>then in reverse, i want to be able to specify the string and generate
>the number back. And a given number or string would always generate
>the same result (back or forth).
>
>(basically trying to hide a numeric value from the user) There
>probably is a simple solution involving pack/unpack. but reading
>couple of books (Prog Perl, Perl Cook), i just can't seem to grasp the
>function.
>
>any pointers, or examples?
>
>Thanks for any help.
>
>Imran
>
>rm 'spam' from mailaddy
------------------------------
Date: 7 Sep 2001 07:35:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: HASH question
Message-Id: <slrn9pgu61.kbr.abigail@alexandra.xs4all.nl>
peter pilsl (pilsl_@goldfisch.at) wrote on MMCMXXVI September MCMXCIII in
<URL:news:3b94e8ae@e-post.inode.at>:
""
"" hand on the heart: did you never post a question to comp.something at 5am
"" cause you needed the project be finished at 8am and simply didnt have
"" enough time and power left to do deeper researchs on your own.
No. There are faster ways of getting that information.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: 7 Sep 2001 10:44:57 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: HASH question
Message-Id: <999857271.4163@itz.pp.sci.fi>
In article <3b94b6c0@e-post.inode.at>, peter pilsl wrote:
>Ilmari Karonen wrote:
>>
>> The correct answer is in the Perl documentation. By all means look into
>> the modules and documentation pages recommended in this thread, but do
>> not actually believe any advice given in it. Most of it is wrong.
>
>This is the advice of the real guru:
>"other people dont telling you the truth, they lie at you. I know the
>truth, but I wont tell you, cause you need to learn by finding out on your
>own"
Actually, that was not the reason I gave such an indirect answer, though
if it made someone read docs they wouldn't otherwise have read, that's
certainly a bonus. :-)
The real reason was that, on Usenet, everyone is equal in the eyes of
the newbie. Presumably there are people reading this group who will
consider my posts a more reliable source of information than, say, the
local troll's, but the OP may not have been around long enough to tell
reliable and unreliable posters apart. (Not to even mention occasional
wrong information posted by a generally reliable poster, and those posts
that contain about half useful advice and half nonsense.)
What good would it have done for me to assert the answer I believe to be
correct, when there were already several posts in the thread asserting
the opposite? If I was saying the sky is green, and you were saying it
was blue, we could argue about it all day and anyone else listening
would be none the wiser. But if you told everyone to look up and see
for themselves, they'd all *know* the truth.
Assuming they did bother to look up. And assuming it was sunny.
What I actually gave was the advice of the paranoid: "Don't trust anyone
you meet here. That includes me. Don't trust me. If two people don't
agree, both are probably wrong. Including me. Don't trust anyone here,
see for yourself. The docs could be wrong too, but they're more likely
to be right than anyone on Usenet. If in doubt, test."
>> (And no, of course I'm not going to post an answer, after I've just told
>> the OP that nothing in this thread should be trusted. I will, however,
>> point him at the perldsc manual page and the Data::Dumper module.)
>
>I recommended the Dumper-module to the OP ages ago and I recommended
>reading the perldoc and I posted a small codeexample for him.
>So whats your problem about it ??
Nothing, at least as far as recommending Data::Dumper and the perl docs
goes. (I can't say anything about the code without looking it up, and
I'm a bit too busy right now to do that.) There were several other
pretty good answers in the thread too. Unfortunately, there were also
several pretty bad ones.
Misinformation is a bit like tainting in Perl. If I have a tainted
string, adding untainted data to it isn't going to untaint it. A
pointer to the docs is like a regex match, to stretch the analogy...
Of course, it's quite possible that the original poster has already read
the relevant docs and is now wondering why the hell we're still beating
this dead horse. On the other hand, we've (or at least I've) seen more
than enough newbies seize the first answer they get that seems to work,
and ignore the later, *correct*, information. I just want to avoid that
happening this time, if it's at all possible.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: 7 Sep 2001 07:41:03 -0400
From: stanb@panix.com (Stan Brown)
Subject: How can I catch unimplemented options, using Getopt::Mixed ?
Message-Id: <9nabof$8al$1@panix3.panix.com>
In C I usually put in a "catch all" option in the getopt parser. That is,
if it's not a recognized option, I print out a ussage message for the
program in question.
I'm using Getopt::Mixed in my perl scripts.
Is there a way to do this using this module? Note command line arguments
that don't begin with "-" or "--" should pass through without triggering
this message. Handling them is doen later.
------------------------------
Date: 7 Sep 2001 11:23:09 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: I get all links, but no not want the picture links
Message-Id: <999859839.6086@itz.pp.sci.fi>
In article <53a7a4f1.0108311722.72b47e41@posting.google.com>, confused wrote:
>I am using the code below to get a random link from a webpage. The
>problem is that this gives any random link, pictures or to html. How
>do i use this to only get links to other text pages?
[snip code using HTML::LinkExtor]
my %ok_attrs;
undef @ok_attrs{qw(
a.href area.href frame.src iframe.src
)};
my %seen;
>foreach my $linkarray (@links) {
> my @element = @$linkarray;
> my $elt_type = shift @element;
> while (@element) {
> my ($attr_name, $attr_value) = splice(@element, 0, 2);
next unless exists $ok_attrs{"$elt_type.$attr_name"};
> $seen{$attr_value}++;
> }
>}
>my @links=keys %seen;
>my $erer = $links[rand @links],"\n";
>print $erer;
Besides the added lines, I took the liberty of adding some "my" keywords
directly into your quoted code. Those will help it pass strict syntax
checks, by making the variables lexically scoped. Read the docs to find
out just what that actually means.
There's still a chance the link you'll get points to an image, if the
original document contains something like:
<a href="big-image.jpg">larger version of image above</a>
If you don't want these, you can start with a heuristic: Ignore any
links matching /\.(jpe?g|gif|png)$/. The next step is to do a HEAD
request using LWP and see what the content type is. (Even then, there
is no guarantee that a URL that once resolved to a text resource will
continue to do so, but the odds are it will.)
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Fri, 07 Sep 2001 08:06:51 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Open 2 exes from Perl
Message-Id: <3B98B85B.C6D35FDD@earthlink.net>
Chris Harris wrote:
>
> On Wed, 05 Sep 2001 08:38:13 GMT, Bart Lateur <bart.lateur@skynet.be>
> wrote:
>
> >Helgi Briem wrote:
> >
> >>To summarise, there are three ways:
> >>
> >>system ('start notepad')
> >>system(1, 'notepad');
> >>use Win32::Process;
> >
> >Four. There's the ShellExecute API call, through Win32::API.
> >
> >--
> > Bart.
>
> Here is another way.
>
> use Win32;
> my $App = "c:\\windows\\notepad.exe";
> my $Args = "notepad e:\\perl\\temp.txt";
> if(Win32::Spawn( $App, $Args, $Pid ))
> {
> print "$App was successfully created with PID $Pid \n";
> }
You could consider open3 to be a sixth, if you ignore that it uses
system(1, @args).
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: 7 Sep 2001 10:07:11 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: OT: urgent reponse
Message-Id: <999857105.4023@itz.pp.sci.fi>
In article <sacl7.3$cx6.60476@news.interact.net.au>, Tintin wrote:
>"peter pilsl" <pilsl_@goldfisch.at> wrote in message
>news:3b94b6c0@e-post.inode.at...
>> Ilmari Karonen wrote:
..none of what was quoted. The paragraph below is Peter's.
>> And - the last one -it must also be a place where I can ask urgent
>> questions and hopefully get a quick answer with a hint.
>
>Usenet is the last place to go for urgent questions and fast answers. Much
>quicker to read the supplied documentation, or do a google search.
Agreed completely. Now where was that .sig file...
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Usenet is a lousy way to get quick service. It's even worse if you want
quick and *correct* answers." -- David Cassell in comp.lang.perl.misc
------------------------------
Date: 07 Sep 2001 11:57:06 +0200
From: Espen Myrland <em@online.no>
Subject: Re: Pause for time.
Message-Id: <87sndz2uj1.fsf@espenboks.ws.nextra.no>
Julia Kempe <kempe@uclink4.berkeley.edu> writes:
> How do I make perl pause between steps in a program?
>
> For example, I want it to output a series of notices, but with a, say,
> one or two second pause in between. Is there some sort of pause for time
> funtion I can invoke, or any module I can use??
sleep(); #perldoc -f sleep;
--
espen
------------------------------
Date: Fri, 07 Sep 2001 09:55:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl/CGI Script
Message-Id: <616hpt8ub2qf47p60n7uf3d4q2l01jcnq3@4ax.com>
Caroline Jacinta Tsay wrote:
>I am able to run a Perl/CGI script from the Windows command line on my
>Windows Advanced Server OS. It uses CGI to get the values from a HTML
>form, an$
>module to take that information and create a new user using CreateUser().
>When I run the script after clicking submit on the web page, the script
>won't
>create the user. Does anyone have any idea why?
Works on the command line, not as CGI? The common reasons for this are:
* different user: CGI runs as "nobody" (or such like), command line as
yourself. Think of (file) permissions.
* different environment: paths, environment variables etc. are
different. Find out which ones the workings of your script depends on.
Oh ,and this is a FAQ. "The idiot's Guide to solving Perl CGI problems"
on <http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html> can give you a
more complete checklist, although aimed at Unixy servers. But, your
script "runs", does it not? It just doesn't do what is wanted.
Permissions or environment, that's my bet.
--
Bart.
------------------------------
Date: Fri, 7 Sep 2001 12:16:07 +0100
From: "Mike Dobson" <miked@rdi-clear.com>
Subject: POST form data from e-mail client
Message-Id: <b02m7.1421$Rd5.10452@NewsReader>
Hi there,
I have an "E-mail this Vote Poll to a friend" set up on a site which send a
copy of the poll to their e-mail so they can vote directly from their e-mail
client (HTML enabled), similar to the www.devx.com e-mails I get.
The problem I'm having is that the form is current set to method="POST"
which doesn't seem to pass on the form data but does using method="GET"
(which makes sense). DevX use POST but send the data to ASP.
Before I make alterations to the script is it possible the receive POST form
data from an e-mail client to the Perl/CGI script.
Cheers in advance for any advice/comments
Mike D - www.votesite.co.uk (Plug, Plug :-) )
------------------------------
Date: Fri, 07 Sep 2001 12:57:34 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem with mail module
Message-Id: <slrn9phe38.8or.tadmc@tadmc26.august.net>
John@home.net <John@home.net> wrote:
>Ok, I'm psyched that someone is reading this. But I don't understand
>what you mean by:
>
>Test your open (and close) for failure here.
>i.e. open MAIL, "|$config{'mailprog'}" or die "Unable to open mail
>handle:
>$!\n";
>close(MAIL) or die "Unable to close mail handle: $!\n";
>
>Please explain what you mean by the previous statement.
You should read the documentation for the functions that you use.
perldoc -f open
"Open returns nonzero upon success, the undefined value otherwise."
Functions have return values that indicate success or failure. If
you want to know if you got what you asked for (success) you
need to test the return value (true=success, false=failure).
The docs for open() _show_ how to check return values, so that
is what you should do.
And, since you are using a pipe open, it is even harder to verify
that you actually got what you asked for:
perldoc -q pipe
"Why doesn't open() return an error when a pipe open fails?"
>I am a complete novice. I think
"I think" is not sufficient in troubleshooting machines. They do
exactly as instructed. If they are not doing the Right Thing,
then you must examine (all) of the instructions to find the problem.
If your problem is in a subroutine whose code we do not have,
then you are on your own, we cannot help you.
>emailad is something to do with it
>emailing an ad. As opposed to emailing a password or a
>recommendation.
>
[snip backwards-time quoted text, please don't do that]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 7 Sep 2001 13:24:25 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Regular Expression puzzle...
Message-Id: <Xns911589C17AE3Laocooneudoramail@62.153.159.134>
tadmc@augustmail.com (Tad McClellan) wrote in
news:slrn9pfon4.666.tadmc@tadmc26.august.net:
> Fred <fredcoyoteno@spamgo.com> wrote:
>>Laocoon wrote:
>>>
>>> 1 while $test =~ s/ ([\w&]\s)/$1/;
>>>
>>> Note that the first character in the match is a space and not \s
>>> because \s will also match \n (and its shorter).Hope this helps..
>>
>>ahh... that works very well...
> ^^^^^^^^^^^^^^^
>
>
> You mean you _want_
>
> YYYYY X X X
>
> to be transformed to
>
> YYYYYX X X
>
> ??
>
> I don't remember you specifying that behavior...
>
>
If u read his post u will notice he has no data in that format..
------------------------------
Date: Fri, 07 Sep 2001 09:22:46 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: SNMP.so?
Message-Id: <3B9875C6.9C7182EF@fujitsu-siemens.com>
Hi,
I'm trying to get mib2c to work, but it requires SNMP.so which I can't
find on my system, neither is it built under ucd-snmp-4.1.2.
Where do I get SNMP.so from?
TIA,
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 7 Sep 2001 15:19:13 +0800
From: "Just in" <justin.devanandan.allegakoen@intel.com>
Subject: Re: SQL question
Message-Id: <9n9sdl$ibt@news.or.intel.com>
You can use one of the date modules to do the date addition
then you can UPDATE the value through SQL
I'm assuming you're using Windoze to run this program, if so
you can download the following modules . . .
to do the SQL uploading use :-Win32::ODBC (which I think
you have already)
and to do the year addition use :- Date::Calc - this has some date add
functions in there
for the latter you can get the binary distribution from ActivePerl
The former I'm not sure - try Dave Roth's site - can't remember where
"Matthew Frick" <mfrick@chariot.net.au> wrote in message
news:3b9843ee$1_5@news.chariot.net.au...
> Probably not the right newsgroup but this is a problem I've got to solve
to
> complete the perl script so sorta alright I hope.
>
> perl script is connecting with an oracle db where I need to update a
> timestamp element of the db. To set the initial value I have been using
{fn
> NOW()}. But inorder to basically suspend a user I need to increment the
time
> by a year. Does anyone know of a simple command for this or is it one of
> those fiddley things where I will have to reset it by hand.
>
> Thanks in advance.
>
> --
> ___________________________________________________________
> - l e a r n . e d s o l u t i o n s p t y l t d -
>
> Matthew Frick Systems Administrator /
Programmer
> www.learnedsolutions.com mfrick@learnedsolutions.com
>
> Level 1, 214 Greenhill Road, EASTWOOD, South Australia 5063
> Phone: +61 8 8272 3111 (Ext. 643) Fax: +61 8 8272 3211
> ___________________________________________________________
> E-mail Disclaimer:
> http://www.learnedsolutions.com/disclaimer.html
> ___________________________________________________________
>
>
>
------------------------------
Date: Fri, 7 Sep 2001 17:36:17 +1000
From: "aL" <nobody@nowhere.com>
Subject: Re: SQL question
Message-Id: <9n9tlj$l9$1@perki.connect.com.au>
> perl script is connecting with an oracle db where I need to update a
> timestamp element of the db. To set the initial value I have been using
{fn
> NOW()}. But inorder to basically suspend a user I need to increment the
time
> by a year. Does anyone know of a simple command for this or is it one of
> those fiddley things where I will have to reset it by hand.
Be warned: this is my first "answer" post (as opposed to my many previous
"help! why does this fail / not work / make me go crazy?" posts).
I'm assuming you're asking more of an SQL question rather than a Perl
question, i.e. how to add 1 year to the date from within an UPDATE query.
(Hey, it's slightly off topic, but I won't tell if you don't). I'm not sure
about Oracle's SQL implementation, but with PostgreSQL databases (which I'd
think would be fairly similar), you can add and subtract time 'intervals'
(intervals are just another sort of data type). See the following example:
UPDATE table_name
SET field_name = ( field_name + CAST('1 year' AS interval ))
WHERE ....
;
You can see we just tell SQL to take the current timestamp and add '1 year'
to it (although you have to tell SQL to treat the '1 year' value as an
interval rather as a text string using the CAST function.
Hope that works for you under Oracle as well. If not, have a look around in
your DB documentation for details on Oracle's implementation of the interval
data type.
aL
------------------------------
Date: 7 Sep 2001 09:41:23 GMT
From: news@roaima.demon.co.uk
Subject: Re: Timezone offset
Message-Id: <3b988831@news.netserv.net>
Sean Hamilton <sh@planetquake.com> asked:
> How can I find:
> - The current time zone offset.
> - The daylight savings delta.
1. localtime - gmtime (gives a signed result, in seconds)
2. Depends on the time of year.
You may be trying to solve the wrong problem if you need this regardless
of time of year.
Chris
------------------------------
Date: Fri, 07 Sep 2001 08:58:22 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Re: Timezone offset
Message-Id: <O_%l7.10698$Gi6.1104848@news0.telusplanet.net>
> 1. localtime - gmtime (gives a signed result, in seconds)
> 2. Depends on the time of year.
localtime - gmtime will give (in my case) a 7 hour difference during DST,
and an 8 hour difference during the rest of the year.
What I was looking for is a constant GMT offest (In my case, PST, so -8),
and then a DST offset (+1, again, in my case), constant regardless of time
of year. (application of offset would be determined by whether or not isdst
from localtime is set).
sh
------------------------------
Date: 7 Sep 2001 13:54:15 GMT
From: news@roaima.demon.co.uk
Subject: Re: Timezone offset
Message-Id: <3b98c376@news.netserv.net>
I wrote,
> 1. localtime - gmtime (gives a signed result, in seconds)
> 2. Depends on the time of year.
Sean Hamilton <sh@planetquake.com> returned:
> localtime - gmtime will give (in my case) a 7 hour difference during DST,
> and an 8 hour difference during the rest of the year.
You didn't actually specify /what/ you wanted the offset from, so I
assumed UTC since that's the base from which all time zones are derived.
> What I was looking for is a constant GMT offest (In my case, PST, so -8),
> and then a DST offset (+1, again, in my case), constant regardless of time
> of year. (application of offset would be determined by whether or not isdst
> from localtime is set).
Make your times relative to UTC and knowing whether to add the offset
or not becomes a moot point, as the library routines will do it for
you. Then check out localtime to see how to tell whether daylight savings
time is in use, or not, at your given UTC date/time.
If you really want to solve the problem as stated, you may find Date::Calc
helps.
Along with your other assumptions, you can always look up the
localtime/gmtime delta at 1st January <any_year> and compare it to the
same on 30th June. This would probably give your offset between winter
and summer times.
However, I'm pretty certain you /are/ trying to solve the wrong problem.
Chris
------------------------------
Date: 7 Sep 2001 07:25:46 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Undef'ing multiple variables
Message-Id: <slrn9pgtk4.bru.rgarciasuarez@rafael.kazibao.net>
Tassilo von Parseval wrote in comp.lang.perl.misc:
> But as for LVALUE: How can I create a ref to that? I don't think I have
> ever seen it before.
Not difficult :
perl -le '$x="a";print ref \substr($x,1);'
--
Twas brillig, and the Protocols
Did USER-SERVER in the wabe.
All mimsey was the FTP,
And the RJE outgrabe. -- RFC 0527
------------------------------
Date: Fri, 7 Sep 2001 17:44:36 +1000
From: "aL" <nobody@nowhere.com>
Subject: Re: Undef'ing multiple variables
Message-Id: <9n9u57$18m$1@perki.connect.com.au>
"Mark Jason Dominus" <mjd@plover.com> wrote in message
news:3b965bf5.53b5$209@news.op.net...
> Does that help?
Thank you to everyone who posted replies to this query. You'll all be glad
to know that the intense, high-level (at least for me) discussion of Perl's
intricacies that's been going on in response to my post has thoroughly
scared the bejesus out of me ... enough so, in fact, that I'm now been
motivated to take everybody's advice and rewrite my volumous code so that I
won't need undef in the first place. :)
Thanks again for all your help.
aL
------------------------------
Date: 7 Sep 2001 08:57:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Undef'ing multiple variables
Message-Id: <9na26b$elq$1@mamenchi.zrz.TU-Berlin.DE>
According to Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca>:
> Tassilo von Parseval (Tassilo.Parseval@post.rwth-aachen.de) wrote:
> : Tina Mueller wrote:
> : > Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:
>
> : >>not to talk about GLOB, CODE, LVALUE, ...
> : >>
> : >
> : > okay, ignore CODE and LVALUE... it's just GLOB...
> : > i'm typing quicker than thinking i guess... :-/
>
> : No, CODE is in fact a valid ref-type so that's one more that should be
> : taken into account when rolling one's own undef() function.
>
>
> I liked Rafael Garcia-Suarez's suggestion best.
>
> Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> > eval "undef $_" for qw/$s @a %h/;
>
>
> You could put it in a function if you like
>
> sub my_undef { eval "undef $_" foreach @_ }
>
> but you have to remember to call it with qw or such like
>
> my_undef(qw( $s @a %h )) ;
>
You can put it in a sub, but you can't (usefully) put that sub in a
module. If you did, eval() would be compiled in the context of the
module and my_undef() could only undef lexicals in that scope.
Anno
------------------------------
Date: Fri, 7 Sep 2001 15:37:14 +0800
From: "Just in" <justin.devanandan.allegakoen@intel.com>
Subject: Using OLE with Perl
Message-Id: <9n9tfc$iv7@news.or.intel.com>
Hello,
I've got the ActivePerl distribution of the
FAQ/Documentation. Under the Using OLE with Perl
it says I can convert a VBA macro to Perl.
To quote:-
If you record a macro in Microsoft Office, this can often
be translated directly into Perl. In Visual Basic for Applications
(VBA) the syntax is like this:
object.method(argument).property = value
In Perl this becomes
object->method(argument)->{property} = value;
Fair enough - everything I wanted to do works with
the Perl version I created. However I'm not sure what to do
with this though:-
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
I won't hazard a guess, but does anyone have any ideas?
Thanks
------------------------------
Date: Fri, 07 Sep 2001 16:06:42 +0800
From: koff <koff@nospam.pop.jaring.my>
Subject: Wierd: SUN problem or Perl problem ?
Message-Id: <3B988012.9963C200@nospam.pop.jaring.my>
Hi,
I just reinstall my SUN 2.6 and reinstall back Perl using
perl-5.6.1-sol26-sparc-local.gz binary. It's work find and without
hasle.
But I encounter a problem to install DBI and Data-Show-Table module (And
of course DBD) . For instance during "make" DBI-1.18 I got this err msg:
------8<------- snip ---
# make
gcc -c -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O -DVERSION=\"1.18\" -DXS_VERSION=\"1.18\"
-fPIC -I/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE -Wall -Wno-comment
-DDBI_NO_THREADS Perl.c
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:426: sys/types.h: No
such file or directory
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:457: ctype.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:465: locale.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:482: setjmp.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:488: sys/param.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:493: stdlib.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:498: unistd.h: No
such file or directory
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:519: string.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:649: netinet/in.h:
No such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:653: arpa/inet.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:663: sys/stat.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:692: sys/time.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:699: sys/times.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:706: errno.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:713: sys/socket.h:
No such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:740: netdb.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:807: sys/ioctl.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:830: dirent.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:863: sys/mode.h: No
such file or directory
In file included from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include/syslimits.h:7,
from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include/limits.h:11,
from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1127,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include/limits.h:117:
limits.h: No such file or directory
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1130: float.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1137: float.h: No
such file or directory
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1158: float.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1182: ieeefp.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1527,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/handy.h:118: inttypes.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1665,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/unixish.h:93: signal.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/iperlsys.h:300,
from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:1947,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perlsdio.h:5: stdio.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:2215,
from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include/math.h:5:
math.h: No such file or directory
In file included from DBIXS.h:19,
from Perl.xs:1:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:3340: sys/ipc.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:3341: sys/sem.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:3372: fcntl.h: No
such file or directory
make: *** [Perl.o] Error 1
Any idea to solve this ? Is it because of my Perl or my Sun ?
Thanks in advance.
Rgds,
--koff
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 1709
***************************************