[17467] in Perl-Users-Digest
Perl-Users Digest, Issue: 4887 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 14 14:10:54 2000
Date: Tue, 14 Nov 2000 11:10:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974229019-v9-i4887@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 14 Nov 2000 Volume: 9 Number: 4887
Today's topics:
Re: Problem with chomp and print <bart.lateur@skynet.be>
Re: Problems compiling DBI and HP-UX 11.0 (Jeff Kalchik)
Re: Problems compiling DBI and HP-UX 11.0 (Richard J. Rauenzahn)
Re: Pushing a hash on to a stack... <iltzu@sci.invalid>
Re: Random Array with Sort? (Abigail)
Re: ref & regexp's don't mix in 5.6? <ren.maddox@tivoli.com>
Remove comments in email addresses (Rafael Garcia-Suarez)
Re: Remove comments in email addresses (Randal L. Schwartz)
Re: retrieve URL from text file <jpmcgowan@ireland.com>
Re: retrieve URL from text file jpmcgowan@my-deja.com
script to print (part of) html page <larry.steinberg@verizon.com>
Re: script to print (part of) html page <adamf@box43.gnet.pl>
Simple If / else (Dennis)
Re: Simple If / else (John J. Trammell)
Re: Simple If / else <newshunter@knowhunter.cjb.net>
Re: Simple regex problem (G.A.D.Miles)
Re: Substitution help <geoff@800-800-cruise.com>
Re: Sysread and 0x0A <tim@ipac.caltech.edu>
trouble referencing constants defined in other packages <fulko@wecan.com>
Re: trouble referencing constants defined in other pack <jeffp@crusoe.net>
What's wrong with the script <irynam@3web.net>
Why doesn't this work? <dr@darkrabbit.com>
WIN version of "|$sendmail" ? <damir.boraska@hrt.hr>
Re: WIN version of "|$sendmail" ? <kstep@pepsdesign.com>
Re: WIN version of "|$sendmail" ? <dsimonis@fiderus.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 14 Nov 2000 14:52:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problem with chomp and print
Message-Id: <ucj21t89d9n0bhjkfj8q4fee6a1hper2ho@4ax.com>
Alan Melton wrote:
> chomp (@vals=@a[1,2,3,10,13,14,15]);
> print OUTPUT join (" ",@vals), "\n";
> chomp (@vals=@a[1,2,3,17,20,21,22]);
> print OUTPUT join (" ",@vals), "\n";
> print unless $a eq /^$/;
print what? $_? That will be undef. And: $a (or $a[22]) eq /^$/???
That will test the success of the regex match as a string ("1" or "")
against a string. I think you want $a[22] =~ /^$/
>How do I perform a next unless a certain field has a value
>or skip if there is no value in that field and go to the next record.
Now, let's examine your data. You seem to want to start at index 10,
print a few substrings, and loop after having incremented the start
index with 7. Am I close?
chomp(@a =<IN>); # chomp all at once, once and for all
for(my $i = 10; $i < @a; $i += 7) {
@vals= (@a[1..3], (@a[$i .. $i+5])[0, 3..5]);
print "@vals\n" if $vals[3];
}
>How do I perform a next unless a certain field has a value
>or skip if there is no value in that field and go to the next record.
As above, or with "next":
for(my $i = 10; $i < @a; $i += 7) {
@vals= (@a[1..3], (@a[$i .. $i+5])[0, 3..5]);
next unless $vals[3];
print "@vals\n";
}
>Also, the last two fields are numeric and can be 4, 5 or 6 characters
>(dollar amounts)
>but I want them right justified as the final result
>should printf or sprintf come into play here and how
Yes. You need a sprintf '%8.2f', $val[$i] for each of the numbers, for
example. Example:
for(my $i = 10; $i < @a; $i += 7) {
@vals= (@a[1..3, $i, $i+3],
map { sprintf '%8.2f', $_ } @a[$i+4, $i+5]);
next unless $vals[3];
print "@vals\n";
}
--
Bart.
------------------------------
Date: Tue, 14 Nov 2000 17:04:25 GMT
From: jeff.k.spam-me-not@mp.msl.com (Jeff Kalchik)
Subject: Re: Problems compiling DBI and HP-UX 11.0
Message-Id: <3a116fa7.8054968@news.iwc.net>
On Tue, 14 Nov 2000 02:33:58 GMT, quagly <quagly@home.com> wrote:
>Frank Harris wrote:
>
>> I'm having a heck of a time trying to get DBI to compile with my HP-UX
>> 11 system. I am guessing that the version of CC on the system isn't
>> exactly ANSI compliant, so I went ahead and installed GCC without any
>> troubles. Now I receive this message when I compile DBI using GCC:
>>
>> /opt/gcc/bin/gcc -c -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O
>> +Onolimit -DVERSION=\"1.14\" -DXS_VERSION=\"1.14\" +z
>> -I/opt/perl5/lib/5.6.0/PA-RISC1.1/CORE -DDBI_NO_THREADS Perl.c
>> gcc: +Onolimit: No such file or directory
>> gcc: +z: No such file or directory
>> *Initialization*:1: missing token-sequence in `#assert'
>> *** Error exit code 1
>>
>> Stop.
>>
>> -----------------------------------------
>> Any ideas how to fix this problem?
>>
>> Any help that can be provided on this issue would be greatly
>> appreciated.
>>
>> Thanks,
>> Frank
>
>This is a known HP/DBI problem. We had to link DBI/DBD statically to get
>it to work.
Minor caveat: I use HP's aCC, not gcc.
The static-link problem is peculiar to DBD::Oracle, not DBI. And it's
got a work around; see Christopher Caldwell and Jeff Okamoto's
excellent write-up on getting it to work.
After installing gcc, did you rerun the configure script? I'd suspect
you didn't; I don't think +Onolimit or +z are valid gcc options.
One other remark re: DBD::Oracle: At least Oracle 8.1.6.2 has a
library structure problem. Search Oracle Metalink 1189459 for a
workaround.
Jeff
---------------------
Jeff Kalchik
jeff - kalchik @mp.msl.com
mail address greeked to obfuscate spam; remove spaces
and change the - to .
------------------------------
Date: 14 Nov 2000 17:40:55 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Problems compiling DBI and HP-UX 11.0
Message-Id: <974223654.802389@hpvablab.cup.hp.com>
quagly <quagly@home.com> writes:
>Frank Harris wrote:
>
>> I'm having a heck of a time trying to get DBI to compile with my HP-UX
>> 11 system. I am guessing that the version of CC on the system isn't
cc, aCC, or CC? Does /opt/ansic exist? Does swlist tell you that you
have the C compiler installed?
>> exactly ANSI compliant, so I went ahead and installed GCC without any
>> troubles. Now I receive this message when I compile DBI using GCC:
>>
>> /opt/gcc/bin/gcc -c -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O
>> +Onolimit -DVERSION=\"1.14\" -DXS_VERSION=\"1.14\" +z
>> -I/opt/perl5/lib/5.6.0/PA-RISC1.1/CORE -DDBI_NO_THREADS Perl.c
>> gcc: +Onolimit: No such file or directory
>> gcc: +z: No such file or directory
>> *Initialization*:1: missing token-sequence in `#assert'
>> *** Error exit code 1
>>
>> Stop.
>>
>> -----------------------------------------
>> Any ideas how to fix this problem?
You'll need to change the HP compiler options to gcc options. +z is an
option to make relocatable objects that will work in shared libraries.
I'm not very familiar with gcc, but I think the equivalent gcc option
has the word 'PIC' embedded in it.
Rich
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
Date: 14 Nov 2000 14:45:39 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Pushing a hash on to a stack...
Message-Id: <974209789.897@itz.pp.sci.fi>
In article <8FEC4BFA3Craznar@24.192.1.17>, Christopher Burke wrote:
>
>I only post a request when I need to - that generally means that I post
>when I am unsure of something.
>
>That by definition will probably increase the odds of this sort of thing
>happening.
I see your point. I tend to think in much the same way, which is part
of the reason why I've only ever posted one question here that wasn't
related to an ongoing discussion, and that was after spending a few
days banging my head against what turned out to be a design flaw in a
part of Perl that made what I wanted to do impossible in general.
I would, however, having watched this thread and assuming that you do
not really want to repeat the experience, offer a modest suggestion.
\begin{offtopic}
It seems to me, though of course I cannot see into your head, that in
asking others after you have tried but failed to arrive at a solution
on your own, you nonetheless retain the incomplete conclusions you
have drawn as "your position" and argue with those who challenge them.
Any of us, quite understandably, would prefer to receive the missing
link to their own solution rather than a completely different and
perhaps contradictory answer to the original problem. Unfortunately,
even if that missing link existed, you would not be likely to find it
in a newsgroup. The people here stay around for their own reasons,
and while it is no great difficulty for some of them to remember and
type a known solution to a common task, it would take them far more
effort to analyse and them complete your own partial solution.
The situation is even worse when the original failure to arrive at a
solution is not in fact caused by the lack of some deductive leap, but
rather by a subtle error earlier in the reasoning. In this case, it
was an attempt to use knowledge of C to reason about Perl, when this
is one of the areas where those languages are fundamentally different
and any apparent syntactic similarity is merely superficial.
It has therefore been my experience that, when asking a question in a
newsgroup, one should rather expect the answer to be completely unlike
anything one would personally have come up with, and be prepared for
the shattering of quite a few firmly held preconceptions. In short,
one should keep an open mind.
In a newsgroup like this, levels of expertise vary wildly. For just
about anything you may ask, it is likely that for somebody on Usenet
the answer will be as obvious as 1+1=2. If the question is related to
Perl, that somebody may quite well read it here and reply. In fact,
for something as basic as your question that is almost a certainty.
If the answer does not match you expectations, arguing with it would
still be as pointless as trying to claim that 1+1 must in fact be at
least 3.
Of course, some people who answer your question may know nothing. The
point is that the only way to tell the two cases apart is by testing
the answers given in practice, not by comparing them to your original
idea of the solution, which, given that it has not succeeded, almost
certainly is not 100% correct.
--
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 clpm
------------------------------
Date: 14 Nov 2000 18:02:27 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Random Array with Sort?
Message-Id: <slrn912vhj.2la.abigail@tsathoggua.rlyeh.net>
On Sat, 11 Nov 2000 14:57:00 +0000, James Taylor (james@NOSPAM.demon.co.uk) wrote in comp.lang.perl.misc <URL: news:<ant111400d07fNdQ@oakseed.demon.co.uk>>:
++ In article <973937192.3210@itz.pp.sci.fi>, Ilmari Karonen
++ <URL:mailto:iltzu@sci.invalid> wrote:
++ >
++ > Fisher-Yates is O(n). You can't improve on that if you want to
++ > shuffle the whole array.
++
++ This is an interesting discussion and Fisher-Yates sounds like an
++ algorithm I ought to be aware of. I've checked the books I've got:
++ "Mastering Algorithms with Perl", Knuth vols.1-3, Sedgewick, and
++ others, but can't find any reference to it. Please could someone
++ explain Fisher-Yates or point me to a suitable URL. Thanks.
It's in Knuth.
Abigail
------------------------------
Date: 14 Nov 2000 10:21:30 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: ref & regexp's don't mix in 5.6?
Message-Id: <m3lmumh6d1.fsf@dhcp11-177.support.tivoli.com>
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> I thought this was fixed in 5.6.0, but apparently it was not. [my
> fault, btw. Wanted to fix all the glitches during the public
> beta-cycle, but there was not one...]
For sufficiently recent versions of 5.6.0, this appears to be fixed.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 14 Nov 2000 16:43:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Remove comments in email addresses
Message-Id: <slrn912qvr.iec.rgarciasuarez@rafael.kazibao.net>
Hi,
is there a module out there to remove comments in email addresses, e.g.:
'Foo <foo@bar.com>' --> 'foo@bar.com'
or, at least, is there a reliable regexp that does more or less the job?
(I don't need a whole ruleset that processes even pathological cases).
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 14 Nov 2000 09:14:45 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Remove comments in email addresses
Message-Id: <m13dgu327u.fsf@halfdome.holdit.com>
>>>>> "Rafael" == Rafael Garcia-Suarez <rgarciasuarez@free.fr> writes:
Rafael> (I don't need a whole ruleset that processes even pathological cases).
What you consider a "pathological case" might be what someone else
calls "my email address because of a stupid mail gateway", so watch
those words!
I believe Mail::Address is the module you're looking for.
use Mail::Address; print Mail::Address->new('Just another Perl hacker,')->phrase;
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 14 Nov 2000 14:37:20 -0000
From: "john" <jpmcgowan@ireland.com>
Subject: Re: retrieve URL from text file
Message-Id: <newscache$7ar04g$p1d$1@weblab.ucd.ie>
Sorry, here's a real example:
-----------------------------------
URL_1:35:http://www.dmoz.org/Sports/Hurling/ Title_1:39:Open Directory -
Sports: Hurling Rank_1:3:90%
LinkURL_1:86:/search?hl=en&lr=&safe=off&output=protocol2&num=30&q=link:www.d
moz.org/Sports/Hurling/ Level_1:1:1
CacheURL_1:58:/search?q=cache:www.dmoz.org/Sports/Hurling/+hurling&hl=en
CacheSize_1:2:6k
RelatedURL_1:89:/search?hl=en&lr=&safe=off&output=protocol2&num=10&q=related
:www.dmoz.org/Sports/Hurling/ Phrase_1:1:N Summary_1:142: ... the entire
directory. Top: Sports: Hurling (40). Associations (3);
Clubs (17); Coaching (1); Counties (6). ...
URL_2:41:http://www.rte.ie/sport/indexhurling.html Title_2:30:RTÉ Sport:
Hurling News Rank_2:3:80%
LinkURL_2:92:/search?hl=en&lr=&safe=off&output=protocol2&num=30&q=link:www.r
te.ie/sport/indexhurling.html Level_2:1:1
CacheURL_2:64:/search?q=cache:www.rte.ie/sport/indexhurling.html+hurling&hl=
en CacheSize_2:3:59k
RelatedURL_2:95:/search?hl=en&lr=&safe=off&output=protocol2&num=10&q=related
:www.rte.ie/sport/indexhurling.html Phrase_2:1:N Summary_2:136: ...
sportonline@rte.ie, Hurling News, GAA: Vincents clinch
Dublin club final spot 25/09/2000 St Vincents ...
------------------------------------
The first line shows the format of the line I am interested in
clearly...URL_ followed by a digit, followed by :digit: followed by a URL .
This text does not in general start at the beginnng of a line, and as I said
can have many slashes, periods and ampersands etc. There is plenty of other
text around it, and also the problem of things like LinkURL_**etc** which
look very similar, but I do not want these.
I would like to read in each digit and the URL, possibly into arrays.
Thanks,
J.
------------------------------
Date: Tue, 14 Nov 2000 17:11:03 GMT
From: jpmcgowan@my-deja.com
Subject: Re: retrieve URL from text file
Message-Id: <8urrmv$9e1$1@nnrp1.deja.com>
Sorry, here's a real example :
URL_1:35:http://www.dmoz.org/Sports/Hurling/
Title_1:39:Open Directory - Sports: Hurling
Rank_1:3:90% LinkURL_1:86:/search?
hl=en&lr=&safe=off&output=protocol2&num=30&q=link:
www.dmoz.org/Sports/Hurling/ Level_1:1:1
CacheURL_1:58:/search?
q=cache:www.dmoz.org/Sports/Hurling/+hurling&hl=en
CacheSize_1:2:6k RelatedURL_1:89:/search?
hl=en&lr=&safe=off&output=protocol2&num=10&q=relat
ed:www.dmoz.org/Sports/Hurling/ Phrase_1:1:N
Summary_1:142: ... the entire directory. Top:
Sports: Hurling (40). Associations (3);
Clubs (17); Coaching (1); Counties (6). ...
URL_2:41:http://www.rte.ie/sport/indexhurling.html
Title_2:30:RTÉ Sport: Hurling News Rank_2:3:80%
LinkURL_2:92:/search?
hl=en&lr=&safe=off&output=protocol2&num=30&q=link:
www.rte.ie/sport/indexhurling.html Level_2:1:1
CacheURL_2:64:/search?
q=cache:www.rte.ie/sport/indexhurling.html+hurling
&hl=en CacheSize_2:3:59k RelatedURL_2:95:/search?
hl=en&lr=&safe=off&output=protocol2&num=10&q=relat
ed:www.rte.ie/sport/indexhurling.html
Phrase_2:1:N Summary_2:136: ...
sportonline@rte.ie, Hurling News, GAA: Vincents
clinch
Dublin club final spot 25/09/2000 St Vincents ...
In general, the URL_digit does not start at the
beginning of a line...but the first line of this
example gives an indication of what I want to
extract - the URL number, followed by another
digit (e.g. here 35), followed by a url.
Thanks,
J.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 14 Nov 2000 12:13:48 -0500
From: "Larry Steinberg" <larry.steinberg@verizon.com>
Subject: script to print (part of) html page
Message-Id: <8urrvr$cmt$1@news.gte.com>
Hi,
Does anyone have or know of a perl script that will allow a user to print an
html page (or part of one). Thanks in advance.
ls
------------------------------
Date: Tue, 14 Nov 2000 19:47:27 +0100
From: Adam <adamf@box43.gnet.pl>
Subject: Re: script to print (part of) html page
Message-Id: <3A1188BF.51FD@box43.gnet.pl>
Larry Steinberg wrote:
>
> Hi,
>
> Does anyone have or know of a perl script that will allow a user to print an
> html page (or part of one). Thanks in advance.
whole line script! ;)
perl -MLWP::Simple -e 'getprint "http://site.to.print"'
look into:
# perldoc LWP::Simple
--
Adam.
------------------------------
Date: Tue, 14 Nov 2000 11:20:56 -0600 (CST)
From: dben1@webtv.net (Dennis)
Subject: Simple If / else
Message-Id: <18804-3A117478-13@storefull-243.iap.bryant.webtv.net>
Can someone tell me how to write something like this please?
If file extension equals .zip, do this, else do this.
I've read perldocs about regexp and string matching, but still can't
figure out how to write this.
Thanks,
dave
------------------------------
Date: 14 Nov 2000 17:47:31 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: Simple If / else
Message-Id: <slrn91249i.jqv.trammell@nitz.hep.umn.edu>
On Tue, 14 Nov 2000 11:20:56 -0600 (CST), Dennis <dben1@webtv.net> wrote:
>Can someone tell me how to write something like this please?
>
>If file extension equals .zip, do this, else do this.
if ($filename =~ /\.zip$/)
{
# filename ends in .zip
}
else
{
# filename doesn't
}
--
John J. Trammell
johntrammell@yahoo.com
------------------------------
Date: Tue, 14 Nov 2000 17:37:12 +0000
From: "The Know Hunter" <newshunter@knowhunter.cjb.net>
Subject: Re: Simple If / else
Message-Id: <8uru0u$csj$1@venus.telepac.pt>
In article <18804-3A117478-13@storefull-243.iap.bryant.webtv.net>,
dben1@webtv.net wrote:
> Can someone tell me how to write something like this please?
>
> If file extension equals .zip, do this, else do this.
>
> I've read perldocs about regexp and string matching, but still can't
> figure out how to write this.
>
> Thanks, dave
>
for (<*>) {
if (/\.zip$/) {
} else {
}
}
-- knowhunter --
--------------------------------------------------------------------------
Busco o conhecimento absoluto, para poder compreender a todos de igual
forma e de novo sentir-me plenamente parte de um todo harmonioso.
--------------------------------------------------------------------------
The Know Hunter - knowhunter@yahoo.com
------------------------------
Date: Tue, 14 Nov 2000 17:05:05 GMT
From: usad1@gadnet.com (G.A.D.Miles)
Subject: Re: Simple regex problem
Message-Id: <3a117074.118708608@news.newsguy.com>
Thanks all. It was a scalar I was taking about.
length($text)>= 1000
works fine.
------------------------------
Date: Tue, 14 Nov 2000 06:38:37 -0800
From: "GC" <geoff@800-800-cruise.com>
Subject: Re: Substitution help
Message-Id: <u5cQ5.11476$au.511840@nntp3.onemain.com>
> Could anyone point me in the richt direction.
> I would like to know, how a substitution is made if I want characters
like
> ',",@,...etc to succesfuly be handled by perl.
> I know for instance that \@ is the format needed by sendmail and
win:smtp
You've already got the answer...
Backslash '\' is the escape character you seek, as in:
\' \" etc.
HTH
Geoff
------------------------------
Date: Tue, 14 Nov 2000 11:34:07 -0800
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Sysread and 0x0A
Message-Id: <3A1193AF.F4494A1E@ipac.caltech.edu>
Richard Panman wrote:
>I'm having problems using sysread to read data from a file. The problem
>is that when sysread() encounters 0x0A it doesn't put it in the scalar.
[Meanwhile, in a subsequent post ...]
Richard Panman wrote:
> The fault was in the sysopen... as Tim said it should have been:
>
> sysopen(INPUT, $inputFile,0) or die $1;
>
> NOT
> sysopen(INPUT, $inputFile,">") or die $1;
>
(You mean $!, not $1.)
Can you explain how this causes your stated problem? It causes a warning, but
doesn't chop off the newline. I don't get it ...
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Tue, 14 Nov 2000 10:28:21 -0500
From: Fulko Hew <fulko@wecan.com>
Subject: trouble referencing constants defined in other packages
Message-Id: <3A115A15.41C6@wecan.com>
I'm trying to do something really simple,
but I'm obviously doing something wrong.
"I'd like to reference a constant that was defined in another class."
File "B.pm" -----------
package B;
use constant X => 1;
1;
File "test.pl" -----------
#! /usr/local/bin/perl
require "./B.pm";
package main;
$r = B::X;
print "$r\n";
-------- end of files ----------
What I get printed is the string "B::X" instead of '1'.
What am I doing wrong?
(Reply by mail (as well as posted) would be appreciated.)
--------------------------------------------------------------------
Fulko Hew, Voice: 905-333-6000 x 6010
Senior Engineering Designer, Direct: 905-333-6010
Northrop Grumman-Canada, Ltd. Fax: 905-333-6050
777 Walkers Line, Home: fulko%fkhew@wecan.com
Burlington, Ontario, Canada, L7N 2G1 Work: fulko@wecan.com
------------------------------
Date: Tue, 14 Nov 2000 11:39:35 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: trouble referencing constants defined in other packages
Message-Id: <Pine.GSO.4.21.0011141138020.25361-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 14, Fulko Hew said:
>package B;
>use constant X => 1;
>1;
>#! /usr/local/bin/perl
>require "./B.pm";
>$r = B::X;
>print "$r\n";
You're including the module at RUN-time, which is too late for Perl to
realize that B::X() is a function and not a bareword-type-thing. If you
did
BEGIN { require "./B.pm" }
then you'd be ok. The 'use constant' pragma needs to be seen at
compile-time.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Tue, 14 Nov 2000 13:19:06 -0800
From: iryna martynenko <irynam@3web.net>
Subject: What's wrong with the script
Message-Id: <3A11AC49.E941152E@3web.net>
--------------161E1607B7FD493E8CEDC4F9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Can anybody help me with this script.
When I launch it from the HTML page I got a message "the document
contain no data"
What's wrong with it.
I would appreciate it if your could give me a clue how to solve the
problem
Thank in advance
====================================================
#!/usr/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
if($FORM{'month'} eq "november" & $FORM{'year'} == 2000)
{print "Location: http://www.blabla.net/page2.html"}
elsif ($FORM{'month'} eq "december" & $FORM{'year'} == 2000)
{print "Location: http://www.blabla.net/page3.html"}
elsif ($FORM{'month'} eq "january" & $FORM{'year'} == 2001)
{print "Location: http://www.blabla.net/page4.html"}
elsif ($FORM{'month'} eq "february" & $FORM{'year'} == 2001)
{print "Location: http://www.blabla.net/page5.html"}
else {print "Location: http://www.blabla.net/page6.html"}
exit;
HTML codes
****************
<form method="POST" action="http://www.blabla.net/cgi-bin/menu.cgi">
<select name="month">
<option value="november">november
<option value="december">december
<option value="january">jenuary
<option value="february">february
</select>
<select name="year">
<option value="2000">2000
<option value="2001">2001
</select> <input type=submit value="Open">
</font>
</form>
--------------161E1607B7FD493E8CEDC4F9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<font size=-1>Can anybody help me with this script.</font>
<br><font size=-1>When I launch it from the HTML page I got a message "the
document contain no data"</font>
<br><font size=-1>What's wrong with it.</font>
<br><font size=-1>I would appreciate it if your could give me a clue how
to solve the problem</font><font size=-1></font>
<p><font size=-1>Thank in advance</font>
<br><font size=-1>====================================================</font>
<br><font size=-1>#!/usr/bin/perl</font>
<br><font size=-1>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});</font>
<br><font size=-1>@pairs = split(/&/, $buffer);</font>
<br><font size=-1>foreach $pair (@pairs) {</font>
<br><font size=-1> ($name, $value) = split(/=/, $pair);</font>
<br><font size=-1> $value =~ tr/+/ /;</font>
<br><font size=-1> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;</font>
<br><font size=-1> $FORM{$name} = $value;</font>
<br><font size=-1>}</font><font size=-1></font>
<p><font size=-1> if($FORM{'month'} eq "november" & $FORM{'year'}
== 2000)</font>
<br><font size=-1> {print "Location:
<A HREF="http://www.blabla.net/page2.html">http://www.blabla.net/page2.html</A>"}</font>
<br><font size=-1> elsif ($FORM{'month'} eq "december" &
$FORM{'year'} == 2000)</font>
<br><font size=-1> {print "Location:
<A HREF="http://www.blabla.net/page3.html">http://www.blabla.net/page3.html</A>"}</font>
<br><font size=-1> elsif ($FORM{'month'} eq "january" &
$FORM{'year'} == 2001)</font>
<br><font size=-1> {print "Location:
<A HREF="http://www.blabla.net/page4.html">http://www.blabla.net/page4.html</A>"}</font>
<br><font size=-1> elsif ($FORM{'month'} eq "february" &
$FORM{'year'} == 2001)</font>
<br><font size=-1> {print "Location:
<A HREF="http://www.blabla.net/page5.html">http://www.blabla.net/page5.html</A>"}</font>
<br><font size=-1> else {print "Location: <A HREF="http://www.blabla.net/page6.html">http://www.blabla.net/page6.html</A>"}</font>
<br><font size=-1>exit;</font><font size=-1></font>
<p><font size=-1>HTML codes</font>
<br><font size=-1>****************</font>
<br><font size=-1><form method="POST" action="<A HREF="http://www.blabla.net/cgi-bin/menu.cgi">http://www.blabla.net/cgi-bin/menu.cgi</A>"></font>
<br><font size=-1> <select name="month"></font>
<br><font size=-1><option value="november">november</font>
<br><font size=-1><option value="december">december</font>
<br><font size=-1><option value="january">jenuary</font>
<br><font size=-1><option value="february">february</font>
<br><font size=-1></select></font>
<br><font size=-1><select name="year"></font>
<br><font size=-1><option value="2000">2000</font>
<br><font size=-1><option value="2001">2001</font>
<br><font size=-1></select> <input type=submit value="Open"></font>
<br><font size=-1> </font></font>
<br><font size=-1> </form></font>
<br><font size=-1></font> </html>
--------------161E1607B7FD493E8CEDC4F9--
------------------------------
Date: Tue, 14 Nov 2000 08:59:32 -0600
From: Glenn Tillema <dr@darkrabbit.com>
Subject: Why doesn't this work?
Message-Id: <3A115354.6090209@darkrabbit.com>
Hi!
I'm stuck and I'm hoping someone here might have some constructive suggestions as to how I
can work my way out of this problem... you see, I need to bundle a bunch of tif files
together using a CGI program. Most of the program is already written but the routine I
use to concat the files together isn't working at all. I find this perplexing since I can
get the command to work via the command line without any problems!
Im basically putting all of my tif files into the /tmp directory of the server and then
making a system call to 'tiffcp' to concat them together.
system("/usr/bin/tiffcp $files /tmp/combined$$.tif");
The variable $files contains a space-seperated list of all of the files to be combined.
The only thing I can think of that might be going wrong is that perhaps my list of files
is too long ... except I have run this from the command line and didn't have a problem.
Any ideas anyone?
Glenn
------------------------------
Date: Tue, 14 Nov 2000 14:53:47 +0100
From: Damir Boraska <damir.boraska@hrt.hr>
Subject: WIN version of "|$sendmail" ?
Message-Id: <3A1143EB.CACE76B@hrt.hr>
Thanx everyone who might help me with this one:
I need to do something like this, but on Win NT/ or Win98:
-----------------------------------
$sendmail='/usr/sbin/sendmail';
open (SENDMAIL, "|$sendmail -oi -t") || die("Something wrong...$!");
print SENDMAIL <<QQ_EOF_QQ2;
To: $recipient
From: $name <$sender>
Subject: Whatever
QQ_EOF_QQ2
BODY OF THE MESSAGE... $message ... whatever
close (SENDMAIL);
--------------------------------------
Actually... the question could be what is the alternative
to "sendmail", that I can use on WIN platform?
How do I do it? I'd appreciate being put in Cc, thanx!
------------------------------
Date: Tue, 14 Nov 2000 09:43:54 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: WIN version of "|$sendmail" ?
Message-Id: <8urj0a$cdp$1@slb6.atl.mindspring.net>
"Damir Boraska" <damir.boraska@hrt.hr> wrote in message
news:3A1143EB.CACE76B@hrt.hr...
>
> << ... >>
>
> Actually... the question could be what is the alternative
> to "sendmail", that I can use on WIN platform?
> How do I do it? I'd appreciate being put in Cc, thanx!
There are several options for emulating or replacing sendmail on a Windows
platform. The easiest is probably Mail::Sender, which allows you to post
the message and any attachments to an external SMTP host. You can find this
module on CPAN.
Another alternative is to use MIME::Lite to compose the message and
Net::SMTP to send it. A little more work, but it will do it.
A third (and somewhat silly) option is to use Win32::OLE to create a CDO
object and send the message using its methods. This may be less silly if
you are already used to using CDO with ASP. Unlike the methods above, this
will not be portable if you plan to re-use your code un another platform.
Finallym there is Blat, a freeware sendmail replacement for Windows. Blat
supports a similar command line syntax, so if you're using a script that
calls sendmail, you may want to try it. If you are writing your own script,
you should probably go with Mail::Sender or one of the other methods above.
Take your choice, one of these should be right for you.
Kurt Stephens
Pepsdesign
------------------------------
Date: Tue, 14 Nov 2000 12:31:21 -0500
From: Drew Simonis <dsimonis@fiderus.com>
Subject: Re: WIN version of "|$sendmail" ?
Message-Id: <3A1176E9.66553CCC@fiderus.com>
Damir Boraska wrote:
>
> Actually... the question could be what is the alternative
> to "sendmail", that I can use on WIN platform?
> How do I do it? I'd appreciate being put in Cc, thanx!
Check out Blat, its a command line mailer for Win systems.
There are others as well, a quick web search should turn
them out.
------------------------------
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 4887
**************************************