[7359] in Perl-Users-Digest
Perl-Users Digest, Issue: 984 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 5 20:07:24 1997
Date: Fri, 5 Sep 97 17:00:35 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 5 Sep 1997 Volume: 8 Number: 984
Today's topics:
Re: "Odd number of elements in hash list": So? (Kevin)
Re: "Odd number of elements in hash list": So? <tom@mitra.phys.uit.no>
Re: </.*?> vs. </[^>]*> (Craig Berry)
Re: </.*?> vs. </[^>]*> (Tad McClellan)
Re: @INC and LWP Modules <rootbeer@teleport.com>
Re: Can you us DB_File or a DBM in Win95? <kermit@ticnet.com>
Re: complex pattern?!? it shouldn't be, i think :) (Tad McClellan)
Cookies and IE (David Waring)
Re: fcntl() and &F_GETLK (Charles DeRykus)
Re: finding/storing/removing a substring (Tad McClellan)
FreeBSD and perl <rojo@anet-stl.com>
Re: HELP! WinNT/perl cgi newbie (Parillo)
how access netscape' s dbm file? (Tony Reeves)
Re: INCLUDE <rootbeer@teleport.com>
Is it a module, or what? <jefpin@bergen.org>
Re: Is it a module, or what? (Tad McClellan)
Re: Is Perl for Win32 really as brain damaged as it see <jbolden@math.ucla.edu>
Re: Learning perl (Faust Gertz)
Re: Learning perl (Faust Gertz)
Re: MIME and perl <rootbeer@teleport.com>
Re: printing in the same place <rootbeer@teleport.com>
Re: Send multi-part MIME with BLAT for NT ? <mbennett@ideaeng.com>
Re: servername?? (Parillo)
Re: Shakespearian insult program <eric@semaphore.com>
Re: Shakespearian insult program (courtesy)
Re: Shakespearian insult program (Ilya Zakharevich)
Simple Question ? <rhritz@ix.netcom.com>
Re: SUID Problems <rootbeer@teleport.com>
Re: Win95 Com Port Programming? <charlie@flychina.com>
Re: Windows NT wrong address above (David D. Wertman)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Sep 1997 13:28:00 -0700
From: klander@primenet (Kevin)
Subject: Re: "Odd number of elements in hash list": So?
Message-Id: <34106aec.16955951@news.primenet.com>
On 05 Sep 1997 13:14:58 -0400, Kingpin <mthurn@irnet.rest.tasc.com>
wrote:
>klander@primenet (Kevin) writes:
>
>> >With -w and strict turned on, perl 5.004 warns me that I have an
>> >"Odd number of elements in hash list".
>>
>> This happens when you try to assign a list with an odd number of
>> elements to a hash
>
> Unfortunately, it also gives this warning if you assign undef to a
>hash. What's wrong with that? What's even potentially wrong with that?
>
>%hash = undef;
>
> Similarly, an array which has been assigned undef shows a length of
>1 (versus an empty array, which shows a length of 0):
>
>@a0 = (); print scalar(@a0); # prints 0 as expected
>@a1 = undef; print scalar(@a1); # prints 1! Why?!?
>
undef returns the undefined value. Even though it is undefined, it is
a value. So, '%hash = undef' gives the warning because the list of
elements is 1 (odd). '@a1 = undef' assigns the undefined value to
$a1[0]. Weird, huh?
--
Kevin -- klander at primenet dot com (add the .com in email replies)
http://www.primenet.com/~klander
--
------------------------------
Date: 05 Sep 1997 22:47:07 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: "Odd number of elements in hash list": So?
Message-Id: <nqo2033v67o.fsf@mitra.phys.uit.no>
Kingpin <mthurn@irnet.rest.tasc.com> writes:
> Unfortunately, it also gives this warning if you assign undef to a
> hash. What's wrong with that? What's even potentially wrong with that?
>
> %hash = undef;
You're providing a scalar to a LIST assignment. This will convert
your scalar to a list with your scalar as the (single) element of the
list. You're then saying
%hash = (undef);
Which is clearly a list with an odd number of elements
If you want to clear %hash completely, try
undef %hash;
%hash = ();
> Similarly, an array which has been assigned undef shows a length of
> 1 (versus an empty array, which shows a length of 0):
>
> @a0 = (); print scalar(@a0); # prints 0 as expected
> @a1 = undef; print scalar(@a1); # prints 1! Why?!?
That's right. The list with a single (undef) element is different
from the empty list. If you want an empty list, just say so. If you
want to clear the array completely from the symbol table, use undef
thus:
undef @a;
> - - Martin "Kingpin" Thurn mthurn@tasc.com
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 5 Sep 1997 20:08:08 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: </.*?> vs. </[^>]*>
Message-Id: <5upor8$39o$1@marina.cinenet.net>
kendall shaw (kshaw@plight.lbin.com) wrote:
: Duhhh. How come </.*?> doesn't do what I thought it did?
Well, that would depend on what you thought it did, right...?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 5 Sep 1997 15:18:22 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: </.*?> vs. </[^>]*>
Message-Id: <eeppu5.601.ln@localhost>
kendall shaw (kshaw@plight.lbin.com) wrote:
: Duhhh. How come </.*?> doesn't do what I thought it did?
I dunno.
Would you care to share with us what you thought it did?
What *is* it anyway?
A glob?
A regex?
Try writing a 10 line script that shows what you don't understand,
and post it here with a more complete question.
: I'm using perl 5.004 on solaris x86 2.4.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 5 Sep 1997 15:48:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Darryl Caldwell <darrylc@eznet.com>
Subject: Re: @INC and LWP Modules
Message-Id: <Pine.GSO.3.96.970905154232.24123K-100000@julie.teleport.com>
On Fri, 5 Sep 1997, Darryl Caldwell wrote:
> I am having trouble getting the LWP modules to work. I have program that
> uses LWP::Simple. The modules are within a personal directory and I have
> tried both of these methods:
>
> BEGIN { unshift (@INC, List }
>
> use lib List;
>
> But I am still getting "BEGIN can't find LWP/Simple in @INC..."
You need to actually tell Perl where to find the module. The word 'List'
is a placeholder for the real list of directories to use. The actual
directive might look like this.
use lib '/home/darrylc/bin';
(Was that the problem?)
> I have also commented out the use module directive to LWP::Simple to run
> test a snippet of the program in the debugger - -just to see if the
> correct path is showing up in the @INC list. It's there, but perl still
> isn't seeing the modules.
If you're still having trouble, try this code between the 'use lib' line
and the 'use LWP::Simple' line.
BEGIN {
print STDERR "\@INC is:\n", map("'$_'\n", @INC), "\n" ;
}
If that lists the directory in which the module should be found, check
that that dir (and every parent dir along that path) are readable to the
user-id under which your code is executing.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 05 Sep 1997 15:06:08 -0500
From: Kermit Tensmeyer <kermit@ticnet.com>
Subject: Re: Can you us DB_File or a DBM in Win95?
Message-Id: <34106630.7FF6895D@ticnet.com>
Michael R Ingenito wrote:
>
> Can someone please help me. I have a DBM database that works perfectly fine
> in Linux. But when I try to run it on Win95 it says that there is no DBM on
> this machine. If I add the "use DB_File" to the script it gives me this error
>
> Can't locate DB_File.pm in @INC at view.pl line 4.
> BEGIN failed--compilation aborted at view.pl line 4.
>
> Can some please help because I need to run a DBM in Win95. Thanks...
Sure, be glad to...
Get the source for perl at any of the Cpan areas. Take your copy of MS
C++ V5.0
and recompile the code to include the dbm database componenents.
You may have to port the UNIX BSD code section called DBM to work on
Win95, when
you finish, then you can include in your copy on Perl for Win95.
Besure to include the TCP/IP code in your version (make sure it links
properly
with the winsock.dll that are on the Win95 platform.
Are these instruction clear enough?
if you have any doubts, please be sure to read the FAQ, where this
Question get's asked by every frigging newbie.
Give your self a big Duhhhh HuHhhh..
--
-------
Kermit Tensmeyer
Kermit@ticnet.com
------------------------------
Date: Fri, 5 Sep 1997 14:47:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <dlnpu5.2r.ln@localhost>
Markus Moll (markus.moll@off1.siemens.de) wrote:
: Eli the Bearded wrote:
: > Have some more valid HTML comments to play with (each is single
: > line for readibility, do not assume it will be so in a web page):
[snip]
: > <!-- <-> -- -- <----< ---- >----> ---- <----< ---- >> -->
: Why that's cheating !What's that last line doing there? D'you know how
: Netscape Navigator 4.01 prints this ?
: It showed me :
: ---- <----< ---- >> -->
: in the browser window. So why should a small program/script treat this
: right if big Netscape
: can't !
Big does not equate to 'better' ;-(
Or even to 'correct' ;-)
: The only answer I can imagine is that this tag is NOT a valid
: HTML-tag !!!!!!!!!!
Are you implying that what Netscape says/does is the definition of HTML?
I thought that was defined by some kind of standards committee or something...
In the practical world you must use *defacto* standards, 'cause that is
where the market is.
But you should always keep in mind that is not really A Standard.
And also that a single company can change the definition anytime
they want to (like maybe fix their handling of comments ;-) ...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 05 Sep 1997 13:12:49 -0700
From: dwaring@fhcrc.org (David Waring)
Subject: Cookies and IE
Message-Id: <dwaring-0509971312490001@blv-pm108-ip11.halcyon.com>
I am using Matts Cookie Library to work with cookies on a web site.
Everything works great with Netscape but not with Internet Explorer. If I
look at the cookies in IE they are there but the script does not seem to
be able to retrieve them. This seems like a problem others may have faced
Any suggestions?
David Waring
dwaring@fhcrc.org
------------------------------
Date: Fri, 5 Sep 1997 18:12:58 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: fcntl() and &F_GETLK
Message-Id: <EG1rxo.IJn@bcstec.ca.boeing.com>
In article <Pine.GSO.3.95.970905135724.18728B-100000@solpipe.internal.pipex.net>,
Chuck Foster <Chuck.Foster@serendipity.drwho.org> wrote:
>Hi,
>
> I've been trying to retrieve the lock structure for an existing lock via
> the fcntl() call, and don't seem to be getting very far. If anyone could
> spot / correct what the problem might be, or if it simply isn't possible
> with the fcntl() function call within Perl, that would be great.
>
> I've included the test code, plus a C program I knocked up which worked
> first time (I did that to prove to myself that it did work and I wasn't
> going down a blind alley!).
>
>
> use FileHandle;
> use Fcntl;
>
> $pos = $ARGV[0];
>
> open X, "+< LOCK";
I'd check that the open returned for safety.
> ....
> my $lock = pack 'sslllsl', $type, $whence, $start, $len, 0, 0, 0;
You didn't elaborate on the specific error but did you double
check that the pack template for the flock struct is correct
for your OS? (The fcntl call is naturally much easier in C
because you just set the portable structure element names.)
For instance, on my AIX, the template is 'sslllii' and your
program works.
HTH,
--
Charles DeRykus
------------------------------
Date: Fri, 5 Sep 1997 14:56:10 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: finding/storing/removing a substring
Message-Id: <q4opu5.2r.ln@localhost>
Dustin Puryear (dpuryear@usa.net) wrote:
: Hi. I'm having a few problems in storing/removing substrings from a
: comma-delimited string. Basically:
: "string1,string2,string3,string5"
^
^ 4 ?
: should be parsed into:
: buf[0] = string1
: buf[1] = string2
: buf[2] = string3
: buf[3] = string4
^
^ 5?
: Now, it seems to me the best way to do this is to use a regex that
: finds a substring separated by comma's. I then create a backward
: reference to the substring, store it, and then remove it from the
: original string.
[snip]
@buf = split /,/, "string1,string2,string3,string5";
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 05 Sep 1997 14:59:47 -0500
From: Robert Roj <rojo@anet-stl.com>
Subject: FreeBSD and perl
Message-Id: <341064B3.4D01@anet-stl.com>
I've been trying to get a program called minivend (from minivend.com) to
work on my BSD machine. I've been told that I need to upgrade my
version of perl but i've been having problems with sockets....if anyone
could help I'd be most appreciative. The information I have is below...
Rob
my BSD version
'hpp: {4} % uname -a
BSD/OS hpp.hpp.net 3.0 BSDI BSD/OS 3.0 Kernel #0: Thu Jan 30 13:02:43
MST 1997
polk@demiurge.BSDI.COM:/rel/proto/3.0RC1-i386/usr/src/sys/compile/GENERIC
i3
86 '
my current perl version
'hpp: {7} % perl -v
This is perl, version 5.003_02
Copyright 1987-1996, Larry Wall
+ suidperl security patch
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.'
the error I get with 'make test' for perl5.004_01
'lib/io_sock.......IO::Socket::INET: Bad hostname 'localhost'
...propagated at
./lib/io_sock.t line 55.'
If you could help me that'd be awesome, but if you're too
busy....nevermind(but a hint would be nice;)
Rob
------------------------------
Date: 5 Sep 1997 22:14:51 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: HELP! WinNT/perl cgi newbie
Message-Id: <5uq08r$krp$1@news01.li.net>
I like to leave it in there so that if there is a -w at
the end the (activeware port, at least) interperter will
catch it.
lparillo at suffolk dot lib dot ny dot us
Marty Blase (mblase@ncsa.uiuc.edu) wrote:
: > - what do I put at the top instead of #!/usr/local/bin/perl ?
: Looks like I don't have to put anything up there at all; the WinNT
: registry identifies the .pl extension as a perl script automagically.
------------------------------
Date: Fri, 05 Sep 1997 21:32:14 GMT
From: areeves@goodnet.com (Tony Reeves)
Subject: how access netscape' s dbm file?
Message-Id: <5uptuh$hms$1@news.goodnet.com>
Hi..
I'm trying to access the password file that netscape uses for users,
it is based on Berkely DB file, and I have perl 5.004 and DB_File, and
DB from Berkely. All test fine in the make test...
yet, when I try to access the file in perl I can't open it..
netscape saves the file in two parts.. Users.db and Users.id
I thought it was standard hash for.. so I tryed the following tie:
tie %db, "DB_File", "proxyhome/authdb/Users", $DB_HASH;
yet this wont't open the file.. I've tryed others too.. db btree, and
different formats of the tie command in the perl book all fail..
what am I doing wrong?
---
Tony Reeves
N7SF - areeves@goodnet.com, tony@toners.com - HF: 14.242Mhz or 7.239Mhz
Homepage: http://www.toners.com - http://www.goodnet.com/~areeves
The secret to imortality: 4A 65 73 75 73
------------------------------
Date: Fri, 5 Sep 1997 15:55:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Manolis <manolis@cytanet.com.cy>
Subject: Re: INCLUDE
Message-Id: <Pine.GSO.3.96.970905155535.24123O-100000@julie.teleport.com>
On Fri, 5 Sep 1997, Manolis wrote:
> how do i include the vars+procedures of a perl file into another?
With modules. See the perlmod(1) manpage for more info. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 5 Sep 1997 15:43:11 -0400
From: Anagrams of the Word 'A' <jefpin@bergen.org>
Subject: Is it a module, or what?
Message-Id: <Pine.SGI.3.95.970905154105.272A-100000@vangogh.bergen.org>
I am creating a group of functions (factor,prime factor,greatest common
factor...) and I am putting them into MATH::. Is this put into a module,
or what? I can incorporate them using a push and require statement, but
what sort of file should it be... main point, factor is to be MATH::factor
and not main::factor.
Sorry if I've been unclear...
----------------
| "Shooting is NOT too good for my enemies!"
| - "The Overlord List"
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem? Let me know!
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>+++1094++++ L E--->---- W++++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
- geek code -
------------------------------
Date: Fri, 5 Sep 1997 15:12:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Is it a module, or what?
Message-Id: <v3ppu5.601.ln@localhost>
Anagrams of the Word 'A' (jefpin@bergen.org) wrote:
: I am creating a group of functions (factor,prime factor,greatest common
: factor...) and I am putting them into MATH::. Is this put into a module,
: or what? I can incorporate them using a push and require statement, but
: what sort of file should it be... main point, factor is to be MATH::factor
: and not main::factor.
: Sorry if I've been unclear...
Have a look at the
perlmod.pod - Perl modules (packages and symbol tables)
perlmodlib.pod - constructing new Perl modules and finding existing ones
man pages that are included with the perl distribution.
[ snip 15 line .sig on a 7 line article... ]
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 05 Sep 1997 13:52:54 -0700
From: Jeffrey Bolden <jbolden@math.ucla.edu>
Subject: Re: Is Perl for Win32 really as brain damaged as it seems?
Message-Id: <34107126.35E0@math.ucla.edu>
Jessica wrote:
>
> I'm attempting to write a script to run an external command for every
> file in a directory tree under Win95 and WinNT and presents the results.
>
> I tried using backticks to execute the command and it would run the
> command correctly and return the correct output to my script, but for
> no apparent reason, _it would access a:\ every time the external command
> was executed_. The external command doesn't reference a:\ and nothing
> in my path or environment references a:\. This made the drive grind
> noisily throughout the entire operation and was rather irritating to
> listen to. just the command print `dir c:\`; by itself accesses my
> floppy drive for no reason. This happens with both builds 110 and 307
> and when I mentioned it to a coworker, he claimed to have seen this
> problem before also.
Jessica -
type path at a command prompt. My guess is that you have a:\ before
c:\winnt\system, etc.... Computers do what you tell them to not what
you want them to :-)
------------------------------
Date: Fri, 05 Sep 1997 20:29:04 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Learning perl
Message-Id: <34106704.4657804@news.wwa.com>
On Fri, 05 Sep 1997 08:33:43 +0200, Erich Kreiselmaier
<erich@flm.mw.tu-muenchen.de> wrote:
>I am new to perl programming. Does anyone have a recommendation for
>free available documentation or a good book.
The Perl Reference Page has a list of some online tutorials at
http://reference.perl.com/query.cgi?tutorials
The best of the bunch, IMHO, are _Introduction to Perl Programming (
perl 5 )_ at http://www.erdw.ethz.ch/~kistler/perl/intro.html and
_Introduction to Perl or, Learn Perl in Two Hours_ at
http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html
Of course, the manual is free. It can be found in pdf format at
http://www.perl.com/CPAN/authors/id/BMIDD/perlbook-5.004_01.tar.gz in
german at http://www.phy.uni-bayreuth.de/~btpa25/perl/perl_main.html
and in other formats at
http://www.perl.com/CPAN-local/doc/manual/html/index.html
As far as books go, I like the recommendations in the FAQ
(http://language.perl.com/faq/index.html). I am learning perl by
reading Randal's _Learning Perl_ (I believe it to be the best possible
first contact.), Eric Johnson's _Cross-Platform Perl_ (As there is
more than one way to do things in perl, there is more than one way to
learn perl. I really like Eric's book for another way to look at
things.), _Programming Perl_ (to look at the stuff the intro books
don't cover), the FAQ (I learn a lot from just picking a section and
reading it), various and sundry articles in _Web Techniques_ and _The
Perl Journal_, and articles in comp.lang.perl.misc. You might try
looking at http://www.webdesigns1.com/perl/ for the experience of a
beginner who had trouble with Randal's book. While neither of us had
programmed before perl, my math, physics, and philosophy (logic and
philosophy of language) background may make learning perl easier for
me than for most other non-programmers.
At this point, I usually quote from the FAQ, but I'll let you look it
up on your own. The only other thing I'll mention is that _Camel
Critiques_, as mentioned in the FAQ, has moved from
http://www.perl.com/perl/critiques/index.html to
http://language.perl.com/critiques/index.html
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Fri, 05 Sep 1997 20:36:05 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Learning perl
Message-Id: <34136c73.6049384@news.wwa.com>
On Fri, 05 Sep 1997 18:02:54 GMT, ron@farmworks.com (Ronald L. Parker)
wrote:
>On Fri, 05 Sep 1997 14:51:39 GMT, I wrote:
>
>>Learning Perl, affectionately known as the Llama book for
>>the picture on the cover, is your best bet. It's written by Randal
>>Schwartz and published by O'Reilly and Associates, and is available at
>>any good bookstore (carrying O'Reilly books is the definition of a
>>good bookstore) See http://www.ora.com for more.
>
>And, as I was very gently reminded, also written by Tom Christiansen.
>Sorry, Tom.
Maybe you were only talking about the first edition. :-)
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"The large print giveth, and the small print taketh away" - Tom Waits
------------------------------
Date: Fri, 5 Sep 1997 15:41:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: weav@hursley.ibm.com
Subject: Re: MIME and perl
Message-Id: <Pine.GSO.3.96.970905154103.24123J-100000@julie.teleport.com>
On Fri, 5 Sep 1997, Nick Weavers wrote:
> [Part 1, Text/HTML 10 lines]
> [Cannot display this part. Press "V" then "S" to save in a file]
Please convert your question to type text/plain, and re-post it. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 5 Sep 1997 15:50:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Intesab N. Siddiqui" <intesab@bnr.ca>
Subject: Re: printing in the same place
Message-Id: <Pine.GSO.3.96.970905154925.24123M-100000@julie.teleport.com>
On 5 Sep 1997, Intesab N. Siddiqui wrote:
> i would like to know how to print in the same place...
If you want to move the cursor on the screen, try Curses. You can find it
on CPAN.
http://www.perl.com/CPAN/
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 05 Sep 1997 12:47:06 -0700
From: "Mark L. Bennett" <mbennett@ideaeng.com>
Subject: Re: Send multi-part MIME with BLAT for NT ?
Message-Id: <341061BA.1AC@ideaeng.com>
Mark L. Bennett wrote:
>
> I generate outbound email from Perl by calling the command
> line utility BLAT on Windows NT. Much of the Perl/smtp stuff
> I found on the net was quite Unix-centric, but this utility
> works really well on NT.
>
> Blat works great if I'm sending plain old ASCII files.
> And it has a switch for encoding 8 bit files.
>
> However, I'd also like to send HTML attachments.
> I can totally prepare the ASCII file that contains
> the multipart MIME headers and text for the attachement(s).
>
> However, Blat doesn't output the correct Mime header.
> It's "-mime" flag seems to want to encode the entire
> file as escaped charater sequences.
>
> Is there any way to send multi-part messages with BLAT?
>
> ( Basically, I want to have it look similar to if you email
> an HTML page from Netscape.
> In that case you get a small blurb, then multiple attachments.
> That's what I'm trying to emulate. )
>
> One way would be for BLAT to output the following
> headers:
>
> Content-Type: multipart/mixed; boundary="------------3B77249D2FD6"
>
> This is a multi-part message in MIME format.
>
> --------------3B77249D2FD6
>
> Then I could take over from here.
>
> Another way would be if BLAT would simply not output a
> blank line after it's last header field.
> I could easily add these headers to my file.
>
> But, once Blat sends it's X-Mailer: header line it outputs
> a blank line (as it normally should). After that point,
> any header fields in my file are considered plain old
> data.
>
> Suggestions?
>
> Mark
I have figured out how to do this.
It takes a little code, but no C compiler!
Basically, I create all the multi part mail headers inside the
text file I'm generating.
The trick is to get BLAT to NOT insert a blank line after it
outputs it's header; if it puts in a blank line then email
will ignore the MIME message headers in the text file.
Looking at the code, there is an undocumented -penguin switch.
What is penguin, you ask? It's a Perl/agent thing... long story...
type "perl AND penguin" in to your favorite search engine for
details.
Anyway, this switch suppresses the blank line after the headers.
This is RATHER DANGEROUS - this means you MUST have PROPPER email
headers in your text file, followed by a blank line (or just a
blank line at the top). This is probably why it's not documented.
I have included such headers and a blank line at the top
of my text file.
And what should those headers look like?
I went in to Netscape and found a small web page.
I then emailed it to myself, and did a view source.
That's how it should look - I mimicked what Netscape did.
One warning: My program didn't work at first. Netscape didn't
see the attachements. It turned out my Separator line
was wrong. It must START with two hypephens, "--".
And the last separator in the message must also end with
two hyphens.
Since Netscape uses hyphens in it's separator anyway, it was
easy to not notice that the ones inside the message had
two extra ones at the start.
Works great now. Hope this helps somebody else!
Mark
------------------------------
Date: 5 Sep 1997 22:25:56 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: servername??
Message-Id: <5uq0tk$mjc$1@news01.li.net>
The best I can come up with is a two-parter (Works on NT Activeware Port)
# Get IP address
$ipaddr = $ENV{REMOTE_ADDR};
#Resolve address (Only seems to work 10% of the time)
&dnslookup ($ipaddr);
sub dnslookup {
my (
@dotted_address # The DNS address split along dots
, $packed_address # The DNS address packed. Why?
, $name, $aliases, $addrtype, $length, @addr # From gethostbyaddr
) ;
my $address = shift;
@dotted_address = split (/\./, $address);
$packed_address = pack ("C4", @dotted_address);
return gethostbyaddr ($packed_address, 2);
}
lparillo at suffolk dot lib dot ny dot us
Danny LaPrade (dannyl@computize.com) wrote:
: I want to be able to find out on my webpage
: what people is viewing my page.
: I want to retrieve the servername of the each user
: that hits my site.
: How do I retrieve the servername?
: --
: --------------------------------------------------------------
: -- Danny LaPrade
: -- Advertising - Web Development
: -- 1030 Wirt Road #400
: -- Houston, Texas 77055-6849
: -- 713.957.0057
: -- 713.613.4812 Fax
: --
: -- http://www.computize.com/
: --------------------------------------------------------------
: "Hold on to your dreams while pulling
: through the present. "
------------------------------
Date: 5 Sep 1997 19:43:56 GMT
From: Eric Anderson <eric@semaphore.com>
Subject: Re: Shakespearian insult program
Message-Id: <5upnds$9l0$0@207.17.114.19>
Stuart, you are a PERL tyrannosaurus rex. I noticed some room for
improvement and some errors like the @column_1[] instead of $column_1[].
I often make that mistake and have to scan thru my code, searching for
@'s and making sure they are not on array-element references. anyway...
I've cut-and-pasted your suggestions into my version here. Now I can
rest easy knowing that every possible combination has a chance of
popping up. The 49.9999 rand thing is interesting, I didn't know that.
thanks!
Thou frothy base-court pumpion!
-eric
Stuart Cooper wrote:
>
> Your program could do with some improvement, Eric, Thou bootless folly-fallen
> mumble-news! Consider the guts of the code:
>
> # OLD GUTS
> srand;
> $word_1 = @column_1[int(rand(48))];
> $word_2 = @column_2[int(rand(48))];
> $word_3 = @column_3[int(rand(48))];
>
> print "\nThou $word_1 $word_2 $word_3!\n\n";
> #
>
> ... you've got the constant 48 hard-coded; giving you a random number between
> 0 and 48. You actually have 50 words in each array but no matter how many
> times you run it; your program will never use the last 2 values (array indexes
> 48 and 49) of your list. Your program will never tell you that you are
> Thou yeasty weather-bitten whey-face!
>
> So let's fix it. Use the array size to work out the range of the random number:
>
> if @column1 is 50 element array: $#column1=49.
> we want a random integer between 0 and 49.
> to do this; let's go for a random fraction between 0 and *50* and then apply
> int().
> why 0 and 50? because the biggest number you get out of rand(50)
> is 49.9999 which int() turns into 49.
>
> #
> # NEW GUTS
> srand;
> $word_1 = $column_1[int($#column_1+1)];
> $word_2 = $column_2[int($#column_2+1)];
> $word_3 = $column_3[int($#column_3+1)];
>
> print "\nThou $word_1 $word_2 $word_3!\n\n";
> #
>
> you can now add new words to the arrays and they'll get picked up by the
> program without having to change the 48 constant like you would have before.
> The three arrays can have different numbers of words in them too.
> Notice also that it's $column_1[] not @column_1[]; the program assigns to and
> uses a scalar, Eric, Thou ruttish elf-skinned miscreant!
>
> finally use qw in the array assignments.
>
> @column_1 = qw(
> artless
> bawdy
> beslubbering
> # etc etc etc
> yeasty
> );
>
> this makes it much easier to add new words without having to worry about
> double-quoting them and adding the comma at the end of each line. You
> could for example read in your favourite Monty Python insults; which for
> the most part sound pretty similar to the "Shakesperean" ones.
>
> Eric has this program in his .bashrc Unix startup file so he gets
> "the pleasure of a quality insult every time I login". I would
> say this is about as often as you need to run this program. If you
> feel like running it more often you don't need Perl help;
> you need Professional help.
>
> Cheers,
>
> Stuart Cooper.
> stuartc@ind.tansu.com.au
--
---------------------------------------------------------------
Eric Anderson Email: eric@semaphore.com
Software Developer URL : http://www.semaphore.com
Semaphore Corporation Voice: 206.443.0651
2001 6th Ave., Suite 400 Fax : 206.443.0718
Seattle, WA 98121
---------------------------------------------------------------
"We must be beautiful, powerful, and without regret."
------------------------------
Date: 5 Sep 1997 22:04:58 GMT
From: Bob Shair (courtesy) <rmshair@delphi.beckman.uiuc.edu>
Subject: Re: Shakespearian insult program
Message-Id: <5upvma$hgu$1@vixen.cso.uiuc.edu>
Bart Lateur <bart.mediamind@tornado.be> wrote:
> Stuart Cooper <stuartc@ind.tansu.com.au> wrote:
> In your haste, you have forgotten the rand call. Also, try @column_1
> instead of ($#column_1+1).
> $word_1 = $column_1[int(rand(@column_1))];
> HTH,
> Bart.
Better and better, but you guys haven't been doing enough rapidly-repeated
insults, or you'd have noticed problems with randomness not being random
enough.
># OLD GUTS
>srand;
>$word_1 = $column_1[int(rand(@column_1))];
>$word_2 = $column_2[int(rand(@column_2))];
>$word_3 = $column_3[int(rand(@column_3))];
This update (from the Perl book) fixes that:
# NEW GUTS
srand( time() ^ ($$ + ($$ << 15)) );
$word_1 = $column_1[int(rand(@column_1))];
$word_2 = $column_2[int(rand(@column_2))];
$word_3 = $column_3[int(rand(@column_3))];
--
Bob Shair rmshair@delphi.beckman.uiuc.edu
Open Systems Specialist Champaign, Illinois
/* Not employed by or representing the University of Illinois */
------------------------------
Date: 5 Sep 1997 22:28:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Shakespearian insult program
Message-Id: <5uq136$fqn@agate.berkeley.edu>
In article <5upvma$hgu$1@vixen.cso.uiuc.edu>,
Bob Shair (courtesy) <rmshair@delphi.beckman.uiuc.edu> wrote:
> Better and better, but you guys haven't been doing enough rapidly-repeated
> insults, or you'd have noticed problems with randomness not being random
> enough.
>
> ># OLD GUTS
> >srand;
> # NEW GUTS
> srand( time() ^ ($$ + ($$ << 15)) );
Upgrade instead.
Hope this helps,
Ilya
------------------------------
Date: Fri, 05 Sep 1997 16:11:34 -0700
From: Ronald Hritz <rhritz@ix.netcom.com>
Subject: Simple Question ?
Message-Id: <341091A6.5B8F@ix.netcom.com>
I am attempting to send e-mail from an HTML form to a Fax gateway
through Formmail.pl 1.6. I need to alter the From field to my
personal e-mail address so the fax server will process the message.
Currently, the e-mail header is "nobody@mimas.domain.com"
I've alter the PRINT MAIL From: my email address command in Formmail
but it doesn't work. Our webmaster says to change the Sendmail command
using the -f parameter. What would be the correct syntax ?
Currently the cammand is set as :
OPEN(MAIL,"|$mailprog -t");
Thanks for any help.
Ronald Hritz
------------------------------
Date: Fri, 5 Sep 1997 15:40:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: forster@na-cp.rnp.br
Subject: Re: SUID Problems
Message-Id: <Pine.GSO.3.96.970905153508.24123I-100000@julie.teleport.com>
On Fri, 5 Sep 1997 forster@na-cp.rnp.br wrote:
> I made a script that should be run via mail alias, and it works ok, but
> when I turn on the SUID, I receive a mail from mailer-daemon full of
> error messages.
That's a good sign that Perl is trying to keep you from trading the cow
for a fistful of magic beans. :-)
> I checked the script and I got this:
>
> unix# perl -c dispsol.pl
> Value of <HANDLE> construct can be "0"; test with defined() at dispsol.pl
> line 4.
Did you fix that? It's easy to do, and the error message is nearly telling
you everything you need to know. If you're still unclear, the perldiag(1)
manpage has more info.
> dispsol.pl syntax OK
> unix# chmod 6755 dispsol.pl
> unix# perl -c dispsol.pl
> Args must match #! line at dispsol.pl line 1.
When running a set-id script, Perl insists that you put any command-line
args into the file, where they can't be tampered with. So, if you want to
do the -c check, put that option onto the #! line.
You'll find more information in the perlsec(1) manpage. Essentially, you
should develop your script with Taint checks on (-T), and you should 'use
strict' as well. That way, Perl can help you make sure that you code does
what you want it to do, and nothing more.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 5 Sep 1997 20:20:29 GMT
From: "Charlie" <charlie@flychina.com>
Subject: Re: Win95 Com Port Programming?
Message-Id: <01bcba39$5e4df200$f45ae3c7@flychina>
Frank R. Anderson <frank_a1@sfov1.verifone.com> wrote
> #! /perl/bin/per -w
> # com2tst.pl - a simple string echo program
>
> system( "mode COM2: 96,n,8,1,n" );
> open( COM, "+>COM2" ) || die "could not open COM2 $!\n";
>
> while( <COM> ) {
> print COM $_;
> print STDOUT $_;
> }
> close( COM );
> exit;
I have been trying to access Modem port with similiar code,
open( COM, "+>COM2" ) || die "could not open COM2 $!\n";
print COM "AT\n";
$received=<COM>;
print "$received\n";
close( COM );
It hangs at the read command <COM>. It does not even send "AT" to modem.
It sends "AT" when close (COM) is executed.
Can anyone tell me what is wrong with above code? It suppose to work
according to the WIN32 Perl FAQ.
Thanks.
Charlie Li
------------------------------
Date: Fri, 05 Sep 1997 21:46:02 GMT
From: david@WebChamps.com (David D. Wertman)
Subject: Re: Windows NT wrong address above
Message-Id: <34107cd7.93239231@news-server.neo.lrun.com>
On 5 Sep 1997 18:32:46 GMT, carville@sprintmail.com (Mike Carville) wrote:
>Sorry for the double posting...above article has wrong email in it...
>should be carville@sprintmail.com
>
>Thanks
>
>Hi,
>
>I became involved with writing a script for someone, and did not know until all
>was done they are on Windows NT.
>
>The scripts were written on Unix, and do work properly...
What are they doing - o NOT doing that is improper??
>My question is...
>what needs to be done to make these work on NT and...
>
Most scripts will run fine on NT if Perl is properly installed, and the
permissions are properly set.
>Since the gentleman has just installed Perl into his system..Is there anything
>he needs to do...
>Thanks so much
>
I have ported almost all of the Selena Sol Scripts which were primarily
targeted to a UNIX platform, to NT 3.51 And 4.0 Servers.
Only a few items - flat dont work in NT. But there are usually workarounds
of some sort.
>Mike Carville
>Free Cgi Scripts
>Http://www.1-web-bazaar-plaza.com/help/cgi/
>
>
Tell a little about the probelm, and someone may be able to help.
David
Web Champs
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 984
*************************************