[8466] in Perl-Users-Digest
Perl-Users Digest, Issue: 2083 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 12 13:07:49 1998
Date: Thu, 12 Mar 98 10:00:35 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Mar 1998 Volume: 8 Number: 2083
Today's topics:
Re: Are There Any Snazzy Perl Editors for Windows? (Rob Wilson)
Re: array question jason@cimedia.com
Asynchronous/non-blocking socket read in win32 <hakon@netbureauet.dk>
Re: Asynchronous/non-blocking socket read in win32 <jay@rgrs.com>
Re: building perl on NCR svr4(at&t) (Mike Wescott)
Re: Can't find "from" and "subject" <chasecreek.systemhouse@usa.net>
Re: How to read text files that contains variables? jason@cimedia.com
Re: libwww WIN32 MODULE (David Grove)
Live in Chicago? Use GD with Win95? An Offer (N.A.F. McNelly)
Re: lower case fails on strings with newlines?? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: lower case fails on strings with newlines?? <jdf@pobox.com>
Re: mkdir() and umask (Jim Allenspach)
Re: mkdir() and umask <eike.grote@theo.phy.uni-bayreuth.de>
Re: Need help with PERL script <chasecreek.systemhouse@usa.net>
Newbie: Degugging Regexps? mpleone@ma.ultranet.com
Re: Newbie: Degugging Regexps? <jdf@pobox.com>
Oraperl -> DBI/DBD ? <dfetter@shell4.ba.best.com>
Parse::Lex docs in English, thanks to Altavista & Systr <nshah@gte.net>
Re: Perl and passwd <chasecreek.systemhouse@usa.net>
Re: PERL-MSQL :HOW CAN I MAKE A QUERY IN MSQL FROM A PE (David Griffis)
Q. Pls (Was -Re: HELP PLEASE) <chasecreek.systemhouse@usa.net>
Re: read() vs sysread() in Socket Library <doug@tc.net>
RegEx - Am I being ignored? <chasecreek.systemhouse@usa.net>
Re: replacing/removing a escape secquence (Chris Rouch)
Re: Running scripts under different user ID on UNIX <chasecreek.systemhouse@usa.net>
Re: Speed of sort routine vs. one-by-one compare (123 (Ken Fox)
Re: to: tom c. Re: splice -- useful uses? <chasecreek.systemhouse@usa.net>
Re: Win32 Perl and ODBC New User Problems (David Griffis)
Win32 registry functions - docs <rvega@hotmail.com>
You have 1 message(s) - how to print plurals? <spamfree@yahoo.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Mar 98 12:33:36 -0500
From: rwilson@cs.muohio.edu (Rob Wilson)
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <1998Mar12.123336.770@nntp.muohio.edu>
I would recommend textpad (http://www.textpad.com). This has a nice clip
library feature where you simply double-click the function you want (it even
lets you know what kind of arguments to use with the functions. Also, it
supports auto-indenting and other fun features. I regularly use this program
and recommend it highly.
Tommy (tkho@technologist.com) wrote:
: May be I don't know much about Multi-Edit, or Perl element is an extra,
: my Multi-Edit does not support Perl tag. However, it support BASIC, C,
: COBOL, and HTML. If you have the Perl's Tag file, could you send it to
: me. Thanks.
:
: BTW, I agree Multi-Edit is very well-developed authoring program. Its
: "Find and Replace", "Line Numbering", "Hex Mode", and "File Comparing"
: functions are superb. You may not find these function on other editors.
:
: scott@softbase.com wrote:
: >
: > Keith Turner (rkturner@us.ibm.com) wrote:
: > > Are there any text editors for windows that can recognize perl syntax and
: > > color code and such?
: >
: > Well, there's GNU Emacs. It's the best thing going for Perl on Windows.
: >
: > Multi-Edit is a great commercial editor that supports Perl syntax
: > highlighting. It has a very Windows look and feel, if you're not
: > used to Emacs. It also does really great printing, something
: > Emacs doesn't.
: >
: > For more on Windows editors, check out www.skwc.com/essent/cyberreviews.html
: > and look for the text editor review.
: >
: > Scott
:
: --
:
: Tommy Ho
:
: ---------------------------------------------------------------
: Email: tkho@technologist.com
: URL: http://www.geocities.com/ResearchTriangle/Lab/4670/
: WebPager: http://wwp.mirabilis.com/4763891
:
: Virtual Network and Conference available on Request
--
Rob Wilson
EH.Net Systems Administrator
rwilson@eh.net
------------------------------
Date: Thu, 12 Mar 1998 11:12:48 -0600
From: jason@cimedia.com
Subject: Re: array question
Message-Id: <6e9505$m2v$1@nnrp1.dejanews.com>
In article <6e4ei5$6up$1@nnrp1.dejanews.com>,
mchunziker@us.fortis.com wrote:
>
> Perhaps this can't be done since I can't find a reference in
> Camel, Llama or TYP 21 days......
>
> I would like to scan the /dev directory for vg?? and stuff them into
> an array or scaler....no problem so far...easy enough....but I also want to
> create a new array based on a variable...in other words if I find vg00
> I want to create a @vg00 array. Is there a way to create an array using
> a variable...I've been unable to figure out a way to do it without a bunch
> of if's and elsif's....I know something silly like @$VG= isn't going to
> get me very far! Thanks in advance....
Actually @{$VG} = qw(...) will work. It's called a soft reference. But, you
may be better off creating a hash of of anonymous arrays. Something like:
$vgs{$_} = ['fi', 'fo', 'fum'];
Then access it like:
print $vgs{$_}->[0]; # Prints 'fi'
--
Jason Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media -- Austin
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 12 Mar 1998 17:48:10 +0100
From: "Hakon Steinx" <hakon@netbureauet.dk>
Subject: Asynchronous/non-blocking socket read in win32
Message-Id: <350811C9.AC5BECCD@netbureauet.dk>
i am currently working on a network client, supposed to run under both
win32 and unix.
The unix part is no problem, but how can i read from a socket (or
another filehandle) without blocking.
It seems, that all of the techniques, one would usually use are disabled
under win32, as they involve multithreading (ie. fork, alarm et.al)
- Hakon
------------------------------
Date: 12 Mar 1998 12:18:34 -0500
From: Jay Rogers <jay@rgrs.com>
To: "Hakon Steinx" <hakon@netbureauet.dk>
Subject: Re: Asynchronous/non-blocking socket read in win32
Message-Id: <823egnesk5.fsf@shell2.shore.net>
"Hakon Steinx" <hakon@netbureauet.dk> writes:
> i am currently working on a network client, supposed to run under both
> win32 and unix.
> The unix part is no problem, but how can i read from a socket (or
> another filehandle) without blocking.
> It seems, that all of the techniques, one would usually use are disabled
> under win32, as they involve multithreading (ie. fork, alarm et.al)
select() works on MSWin32 machines
------------------------------
Date: 12 Mar 1998 11:25:51 -0500
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: building perl on NCR svr4(at&t)
Message-Id: <x41zw7x4ds.fsf@cygnus.ColumbiaSC.NCR.COM>
Justin Wills writes:
> anybody know where I can get a precompiled binary (of perl for NCR MP-RAS)
Try http://ncrinfo.ncr.com/pub/contrib/
--
-Mike Wescott
mike.wescott@ColumbiaSC.NCR.COM
------------------------------
Date: Thu, 12 Mar 1998 17:11:09 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
To: Kenneth Vogt <kenvogt@sni.net>
Subject: Re: Can't find "from" and "subject"
Message-Id: <350815E4.8C9BE434@usa.net>
Mailed and Posted:
See my changes to your code.
(PS - you may wish to look at the
mail tools via CPAN...)
Sneex :-)
Kenneth Vogt wrote:
> I have a perl script I am trying to use to send mail to a mailing list.
> When I send mail, sendmail leaves 'subject' blank and it does not use
> the 'from' address I specify. I cut the script down to the following
> bare essentials as a test. This script correctly fills the 'from'
> address and 'subject'. So something else in the script is messing me up.
>
> Can anyone suggest what I might look for?
>
> #!/usr/local/bin/perl
> $mail_program = '/usr/lib/sendmail';
> $to = 'kenvogt@sni.net';
> $from = 'test\@modernshopping.com';
> $subject = 'test subject';
> $body = 'test body';
> open (MAIL, "|$mail_program $to"); # You need a $to here...
> print MAIL "To: $to\n"; # This $to doesnot matter, it can be anything...
> print MAIL "From: $from\n"; # This $from does not matter, it can be
> anything...
> #Note: Sendmail will allow you to make up stuff. So much spam, so little
> time...
> print MAIL "Subject: $subject\n"; # Only 1 \n here...
> print MAIL "\n$body\n\n"; # Notice the beginning \n here...
> # Note, you can hide msg bodies by not using the 1st \n...
> print ".\n"; # A completely new line by Sneex :-)
> # Note: some sendmails need that '.' above...
> close MAIL;
Everything else looks OK.
The reason you would want to use
the MAILTOOLS available
via CPAN is primarily because
different versions sendmail, et al,
expect different parameters, etc.
So using a standard package will
help you avoid co-OpSys
sendmail dependencies.
My 2 cents.
------------------------------
Date: Thu, 12 Mar 1998 10:54:18 -0600
From: jason@cimedia.com
Subject: Re: How to read text files that contains variables?
Message-Id: <6e93tg$l4g$1@nnrp1.dejanews.com>
In article <6e3qob$mvr@news-central.tiac.net>,
mike@stok.co.uk (Mike Stok) wrote:
> If you're feeling like re-using someone else's work then CPAN has
>
> Text::Template - This module defines a "template" as a chunk of text with
> cute little Perl expressions embedded in it. You can use this module to
> replace the expressions with their values.
>
> according to ftp://ftp.iguide.com/pub/mirrors/packages/perl/CPAN/CPAN.html
Also take a look at ePerl and Apache::ePerl available from CPAN.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 12 Mar 1998 16:28:53 GMT
From: pete@dave-world.net (David Grove)
Subject: Re: libwww WIN32 MODULE
Message-Id: <35080d1c.989715@news.dave-world.net>
Is your problem installing perl or installing the module?
>Hi,
>
>I tried to install the Win32 module, but it doesn't work.
>
>I got the whole time :
>
>No perl script found in input ... Does anybody know what the problem is?
>
>I installed the version 5.004 like they said, then I set the PATH
>variable and then I typed install.bat, but then I got the error.
>
>Perl is installed under NT... Can anybody help me please?
>
>Thanks in advance
>
>Kris
>
>--
>Kris Van Gompel
>System Manager Net it be
>Posthoflei 3
>2600 BERCHEM
>-------------------------------------
>tel : 03/286.04.34
>fax : 03/286.04.70
>email : krisvg@netit.be
>url : http://www.netit.be
>-------------------------------------
>
>
------------------------------
Date: 12 Mar 1998 16:56:58 GMT
From: nmcnelly@bu.edu (N.A.F. McNelly)
Subject: Live in Chicago? Use GD with Win95? An Offer
Message-Id: <nmcnelly-1203981206290001@med-anat23.bu.edu>
A friend in Chicago is willing to pay to get help with installing
the 5.0004_2 version of perl, and is particularly interested in
getting GD properly configured.
Requirements are:
Someone in the Chicago area who has experience with
running both 5.0004_2 and the port of GD.pm that comes with it
on a Win95 box.
.................................................................
Nancy McNelly
http://www.halfmoon.org
------------------------------
Date: 12 Mar 1998 17:00:22 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: lower case fails on strings with newlines??
Message-Id: <7xzpivzyp5.fsf@beavis.vcpc.univie.ac.at>
Re: lower case fails on strings with newlines??, kevin
<kevin@cmhcsys.com> said:
kevin> $string = lc($string);
kevin> now, i'm reading in my data with $/ = "" and a line
kevin> like $string = <INFILE>. my problems start when i
kevin> read in something that's more than one line long.
kevin> in either of these cases where i've got multiline
kevin> data, lc returns zip. it's not that it doesn't do
kevin> lower-casing--- rather, $string now holds "".
Possibly something else is going wrong? The following
(horrible, hacked-up) script prints itself out in l.c. as
expected:
open(C, "$0"); # unchecked open
{
local $/ = "";
$str = <C>; # THIS COMment wiLL all be LOWER case
}
close C;
print lc $str;
hth
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"
------------------------------
Date: 12 Mar 1998 11:18:05 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: lower case fails on strings with newlines??
Message-Id: <vhtjsx1e.fsf@news.concentric.net>
kevin@cmhcsys.com writes:
> any thoughts? all that the blue camel says about the argument to lc is that
> "lc EXPR....returns a version of EXPR (or $_ if omitted)...." there's no
> stated requirement that EXPR not contain multiple lines.
The following program works just fine for me. Please try it and see
what happens for you.
#!/usr/bin/perl -w
require 5; #this line is rather important :-/
local $/ = ''; #paragraph mode
while (defined ($string = <DATA>)) {
print lc $string;
}
__DATA__
These two lines CAN be
considered to be ONE paragraph.
Here's another one, DUDE. I
hope you'll THINK it's cool.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 12 Mar 1998 10:10:35 -0600
From: jima@MCS.COM (Jim Allenspach)
Subject: Re: mkdir() and umask
Message-Id: <6e91dr$ilj@Mars.mcs.net>
>Now I tried both mkdir (testing, 0777) and mkdir (testing, 0755). Both
>produced the same permissions:
>drwxr-xr-x
>Why did that happen?
Probably because your umask is 022. The formula you're looking
for is
file_mode = create_mode & ~umask;
So, taking a look at your examples of 0777 and 0755,
0777 & ~022 ==> 0777 & 0755 ==> 0755
0755 & ~022 ==> 0755 & 0755 ==> 0755
See? Same results.
What you want to do is find yourself some Unix reference material
and look up umask. Really.
jma
--
jima at mcs dot com
Chicago, IL Perl programmers do it
http://www.streams.com/jima/ with one hump.
------------------------------
Date: Thu, 12 Mar 1998 17:20:52 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: mkdir() and umask
Message-Id: <35080B64.59E2@theo.phy.uni-bayreuth.de>
Hi,
Jeff Stewart wrote:
>
> Perl's mkdir() function requires a directory name and a "mode," which
> the manual says is modified with the umask() function. The mans for
> umask() just say, "Sets the umask for the process and returns the old
> one. If EXPR is omitted, merely returns current umask."
>
> So what's a umask? What process?
"umask" modifies the "mode": if "umask" is set to 022 and "mode"
equals 777 then the directory to be created will get 755 as a result
(difference in _octal_ base).
The effect of "umask" is limited to the running script - it will not
change the umask of the shell where the perl script is started from.
> I tried executing mkdir (testing, 777) and got a testing directory
> with or gx wx permissions set.
Remember: the usual notation '777' is meant to be an _octal_ number.
To tell Perl this you must say mkdir(testing,0777)
^
> I tried executing print umask(); and got 18.
18(decimal) is equivalent to 22(octal) - which means that your shell's
umask is set to 022.
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Thu, 12 Mar 1998 16:54:40 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
To: amin@wessels.com
Subject: Re: Need help with PERL script
Message-Id: <35081206.21368C12@usa.net>
Posted and mailed...
See the mail tools available via CPAN, also -
What, specifically is the problem? I would
hazard a guess, having done this myself,
that you are having trouble capturing the in-coming
e-mail(s)???
A hint would be (under Unix) set this in the
appropriate aliases or .forward:
usrid: "|/export/home/usrid/readmail.pl <$1"
(Where usrid is some Person real or not,
whom you wish to parse their mail...
Not that I would condone such an action.)
HTH,
Sneex :-)
amin@wessels.com wrote:
> Hey I need help.
>
> I am trying to write a PERL program that checks my email as it comes
> (on a UNIX machine), and clips the header and a number of lines from
> the message body. Then it resends the mail to another address. Then
> clips the remaining text of the message body. I prefer to put the
> lines to be re-mailed in the subject line, but not important.
>
> Example:
>
> header <--- ignore (will always be the same)
> message body line1 <--- ignore (will always be the same)
> message body line2 <--- ignore (will always be the same)
> message body line 3 <--- ignore (will always be the same)
>
> message body important line 1 <--- resend to new email address
> message body important line 2 <--- resend to new email address
> message body important line 3 <--- resend to new email address
>
> message body line 4 <--- ignore (will always be the same)
> message body line n <--- ignore (will always be the same)
>
> Any ideas? Can you help me??
>
> Many thanks!
------------------------------
Date: Wed, 11 Mar 1998 11:20:23 -0500
From: mpleone@ma.ultranet.com
Subject: Newbie: Degugging Regexps?
Message-Id: <mpleone-1103981120230001@news.ma.ultranet.com>
Hi,
I am trying to match a string and would like to print out the part I have
successfully matched so I know that I have been correct up to that point.
Is there a simple way to do this? It would be much easier if I could do it
this way instead of trying to match the whole line at once (I'm having no
luck now). Any suggestions would be very much appreciated.
Thanks,
Matt
Here's a sample line that I am working on:
$line = '171-0190 Type A Line Guard Rope Screw $1.75';
if ($line =~ m/^\s+([d\-\]*)\s+(.*)(\b|\))\s+\$([\d.]+)\s$/)
{
print "Part No. = $1, Description = $2, Price = $4\n";
}
else
{
print "Can't match line $line";
}
--
Matt Leone
mpleone@ma.ultranet.com
------------------------------
Date: 12 Mar 1998 12:00:43 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Newbie: Degugging Regexps?
Message-Id: <u393sv2c.fsf@news.concentric.net>
mpleone@ma.ultranet.com writes:
> I am trying to match a string and would like to print out the part I have
> successfully matched so I know that I have been correct up to that point.
This is addressed in the perl docs. See perlvar and perlre for a
thorough discussion of Perl's special variables and Perl regular
expressions. From perlvar:
$&
The string matched by the last successful pattern match (not
counting any matches hidden within a BLOCK or eval() enclosed by the
current BLOCK). (Mnemonic: like & in some editors.) This variable is
read-only.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 12 Mar 1998 16:54:08 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Oraperl -> DBI/DBD ?
Message-Id: <6e93vh$s1h$1@nntp1.ba.best.com>
Kind people,
Is there somewhere a FAQ on how to migrate legacy oraperl code to the
DBI/DBD scheme?
Any and all references would be greatly appreciated.
Thanks in advance,
Dave.
--
David Fetter 888 O'Farrell Street Apt E1205
shackle@ren.glaci.com San Francisco, CA 94109-7089 USA
http://www.best.com/~dfetter +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)
The idea that an arbitrary naive human should be able to properly use
a given tool without training or understanding is even more wrong for
computing than it is for other tools (eg automobiles, airplanes, guns
or power saws).
Nathan Hand (nathan.hand@anu.edu.au)
------------------------------
Date: Thu, 12 Mar 1998 11:28:47 -0500
From: Nandu Shah <nshah@gte.net>
Subject: Parse::Lex docs in English, thanks to Altavista & Systrans
Message-Id: <6e91ma$jub$1@gte2.gte.net>
I recently downloaded the Parse::Lex (v1.19) bundle from CPAN, and was
dismayed to learn that the documentation was only in French. Now, I
haven't
studied French in over 10 years, but between my lousy French reading
skills
and my excellent Perl reading skills, I puzzled through the docs with
few
problems. Nevertheless, I wanted documentation in English for future
reference. I handed HTML docs over to
http://babelfish.altavista.digital.com/
and was rather pleased with the results. I had to patch up some of the
HTML
so the code samples looked nice, but that's okay; HTML isn't one of the
languages babelfish supports.
See for yourself.
The original documentation in French:
http://www.cise.ufl.edu/~nandu/babelfish/Lex.fr.html
http://www.cise.ufl.edu/~nandu/babelfish/Token.fr.html
The translated docs:
http://www.cise.ufl.edu/~nandu/babelfish/Lex.html
http://www.cise.ufl.edu/~nandu/babelfish/Token.html
Nandu
------------------------------
Date: Thu, 12 Mar 1998 17:32:26 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
To: Santi <santi@gallet.udg.es>
Subject: Re: Perl and passwd
Message-Id: <35081AE1.240104DA@usa.net>
Mailed and Posted:
See http://www.perl.com then Search on Security (See WebPass)
Also see other security realted stuff and issues.
See several problems you will most likely have, then see a solution...
HTH,
Sneex
(Yes, I play a consultant on daytime,
but I am also the WebPass author :-)
Santi wrote:
> Hi,
>
> Ther question is on Perl 5.004, Solaris and password change.
> I'm root (of course) and want to change user passwords from a file.
> I think that the best way was via passwd, to avoid locking trouble and
> shadow sync.
> I've tried openenig a pipe, but...
>
> Can anyone help me.
>
> Please send me private e-mail at santi@si.udg.es
>
> Thanks
------------------------------
Date: Thu, 12 Mar 1998 16:09:13 GMT
From: davidg@teleprompt.com (David Griffis)
Subject: Re: PERL-MSQL :HOW CAN I MAKE A QUERY IN MSQL FROM A PERL SCRITP?
Message-Id: <35080824.129795025@news.infinex.com>
On Mon, 09 Mar 1998 13:32:46 +0100, Josi <agro@xures.ei.uvigo.es>
wrote:
>MY QUESTION IS:
> FROM A PERL SCRIPT , HOW CAN I MAKE A QUERY TO A MSQL DATABASE ?
You get the activeware Perl and Win32 ODBC. I found the links from
www.perl.com FAQ's and database. Haven't gotten it working but heard
many that have. Apparently it's important which Perl build you have
to work with the ODBC software.
David Griffis
------------------------------
Date: Thu, 12 Mar 1998 16:32:02 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Q. Pls (Was -Re: HELP PLEASE)
Message-Id: <35080CB9.1F49A55F@usa.net>
OK.
Question, please.
C'Ya,
Sneex :-)
Waseem B Sayegh wrote:
------------------------------
Date: 12 Mar 1998 11:17:28 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: read() vs sysread() in Socket Library
Message-Id: <m2pvjrdgtj.fsf@ono.tc.net>
UCE-trap_synic@omen.net.au (Peter Caffin) writes:
> Hi. Reading the Pelican Book, it suggested that to read data from a socket
> connection, you should use sysread() rather than read().
>
> However, when I used sysread, no matter the number of bytes I requested, the
> maximum I'd receive would be 1460 bytes, no matter what number I requested or
> what webpage I asked for. Once I changed my script to use read(), I got the
> correct result.
Sounds like a TCP MSS to me. It looks like the read() system call is
returning once there is a full packet in the input buffer. This is
not actually incorrect as far as I know (I don't have Stevens to
hand). You'll need to call sysread() in a loop until you have
everything you're looking for.
I'm guessing that Perl's read() code calls sysread() in a loop (or
relies on stdio to do so).
Your application as written is fine without sysread(). It's really
when you start multiplexing on sockets and using the four-argument
select() that stdio buffering will bite you.
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: Thu, 12 Mar 1998 16:35:21 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: RegEx - Am I being ignored?
Message-Id: <35080D81.77178D7E@usa.net>
OK, I feel like I have totally
alienated the group, so, hell why not...
Is there a way to do the following in one shot?
$file =~ tr/A-Z/a-z/; # Upper to lowercase
$file =~ s/(?:%20)+/_/g; # One or more spaces to "_"
$file =~ s/%2525/-/g; # Convert all "%" to "-"
$file =~ s/%252f/-/g; # Convert all "/" to "-"
$file =~ s/%[\da-fA-F]{2}/-/g; # Remove all %xx
$file =~ tr/a-zA-Z0-9_.-/-/cs; # Convert others to "-"
$file =~ tr/././s; # One or more periods
to "."
$file =~ s/_-_/_/; #
$file =~ s/-_-/-/; #
$file =~ s/_-/_/; #
$file =~ s/-_/_/; #
$file =~ tr/_/_/s; # Serialized _ to single
"_"
$file =~ tr/-/-/s; # Serialized - to single
"-"
$file =~ s/_\././g; # Remove _ either side of
"."
$file =~ s/-\././g; # Remove - either side of
"."
Thx,
Sneex :-)
------------------------------
Date: 12 Mar 98 17:08:59 GMT
From: chrrouch@isoit201.bbn.com (Chris Rouch)
Subject: Re: replacing/removing a escape secquence
Message-Id: <350816ab.0@isoit370.bbn.hp.com>
In article <35055E44.A6ABAF3F@charlestoncounty.org>, Peter Shankey <shankeyp@charlestoncounty.org> writes:
> I have a file which has been moved to a unix system from a dos system.
> The file contains a ^M or I should say a "ESC M". I know it a escape
> sequence because I see it in vi but not with a cat command.
>
I Picked this up from usenet years ago - no idea who was originally responsible. It removes all
control characters.
# this matches on \n \t and all characters between space and ~ and then
# deletes everything else
tr/\n\t -~//cd;
Chris
------------------------------
Date: Thu, 12 Mar 1998 16:46:22 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
To: joe.tully@virgin.net
Subject: Re: Running scripts under different user ID on UNIX
Message-Id: <35081015.BEF6DA02@usa.net>
Mailed and Posted:
The only way I have been able to
successfuly make it work (as a CGI)
create a secure ID which owns the web server
and everyone runs it that way; or if it isn't a CGI,
create a secure group which all potential users
are a part of and run it that way; but 'suid' on Perl
is not a good thing - stickyness should and can be
avoided.
My 2 cents worth,
Sneex :-)
Joe Tully wrote:
> I've written a UNIX database program using a number of Perl
> scripts.
>
> I now want to set up the database securely. My intention was
> to have the database directory owned by a specific user and then
> set the sticky bit on the top level Perl script so that it runs
> under that users ID.
>
> However, on trying to do this I am getting problems relating to
> data tainting. I looked at the "perlsec" part of the manual and
> this suggested writing a C "wrapper" program (running under the
> user ID) to call the perl. I tried this, but I get the same problem.
>
> Help! Does anyone have any idea on how to get around this problem?
>
> Thanks,
>
> Joe Tully
------------------------------
Date: 12 Mar 1998 16:47:19 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <6e93in$j0f2@eccws1.dearborn.ford.com>
matija@rzenik.arnes.si (Matija Grabnar) writes:
> Nick Halloway <snowe@rain.org> wrote:
> > Yes, the database gets used between updates and needs to be kept
> > sorted. It's updated one record at a time.
>
> I think you would be best off using DB_file. It will keep the file
> sorted for you (or it will keep an index, which is just as good).
This feature is rather unique to Berkeley DB. Most (all?) of the
other dbm implementations use hashes which won't be ordered. An
index isn't the same as a sort, but *some* indexes also happen to be
sorted. ;)
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: Thu, 12 Mar 1998 17:25:03 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: to: tom c. Re: splice -- useful uses?
Message-Id: <35081925.2DC3446F@usa.net>
WOW! And I am on MediaOne.net (sometimes...)
Make a body go Hmmm...
:-)
Uri Guttman wrote:
> tom,
>
> i tried replying to you but you filter out mediaone.net. might you add
> my address in a pass through filter.
<Snip other stuff.>
------------------------------
Date: Thu, 12 Mar 1998 16:03:49 GMT
From: davidg@teleprompt.com (David Griffis)
Subject: Re: Win32 Perl and ODBC New User Problems
Message-Id: <3508060d.129260636@news.infinex.com>
On Sun, 08 Mar 1998 15:11:50 GMT, keefner@visi.com (keefner) wrote:
>On Wed, 04 Mar 1998 05:37:05 GMT, davidg@teleprompt.com (David
>Griffis) wrote:
>
>>I'm trying to get Activeware Win32 Perl 5.003 build 315 and Dave
>>Roth's ODBC extention working with my NT 4.0 ODBC for Oracle 733 but
>>I'm getting a 'parse error'. What could I have done wrong?
>
>You likely have the stock odbc driver for Oracle installed
>and there is a documented problem with it. Make sure
>you get the latest from Oracle.
>
>Depending on how you want to access the Oracle
>db (stored functions/procedures/etc) you may want
>to consider the DBI/DBD modules and the perl port
>for it.
>
>Craig
I heard the DBI port comes from the ODBC one but will give it a try.
Right now I'm trying to get ODBC working with anything. I got access
and am having the same problem. It appears to work fine but doens't
fetch any data.
The Windows NT 4 odbc drivers appear to be ok.
I have Perl 5 build 115 from activeware and the ODBC build 970208.
Do they work together. Does anyone have the precise URL's to download
both the perl and Win ODBC 32 that they have got working. That would
help a lot.
Thanks,
David Griffis
------------------------------
Date: 12 Mar 1998 15:26:21 GMT
From: "Rigel Vega" <rvega@hotmail.com>
Subject: Win32 registry functions - docs
Message-Id: <01bd4dca$4c8ec740$e488b3cc@pmadden-lt>
With a little help from some web pages, especially
http://www.inforoute.cgs.fr/leberre1/main.htm, i was able to do a few
things i needed to do with the Win95 registry. Said page points out that,
for example, to query a registry value, one must use the
Win32::RegQueryValueEx function instead of the function QueryValue from
Win32::registry. The page also states that, for this and other functions
used as alternatives to those in the Win32::registry module, "the arguments
are the same as those in the original API."
My question: Where can i find these functions documented? "Real"
documentation would be best, but i'd be content just to read the code -- if
i could find it. I searched around through the code in the Perl for Win32
package but didn't find it. I'd like to know the full description not of
the functions i've discovered so far, but also what other reigistry-related
functions may be available.
------------------------------
Date: Thu, 12 Mar 1998 11:30:21 -0500
From: Dave Bushong <spamfree@yahoo.com>
Subject: You have 1 message(s) - how to print plurals?
Message-Id: <35080D9C.A9491BC7@yahoo.com>
I have a pet peeve about having a ten thousand dollar computer telling
me "1 file(s) copied", when it's a matter of checking whether or not the
count is one. In 'C', there is usually something in the printf that
uses the ternary operator, e.g., prinf ("%d file%s\n", count,
count==1?"":"s");
That works if you know that you will be using the word "file", for
example, but is not a general solution. I looked for a "pluralize"
function in the Text modules (#11), but not exhaustively.
I came up with this, and would like comments about my implementation.
Specifically, it seems a little clumsy to say
print ("I have ", pluralize($quantity, $nouns), "\n");
but I can't think of a more elegant way.
Here is the code; please followup here, and/or to my email address (yes,
it's really spamfree@yahoo.com). I hope my cut and paste worked.....
Thanks,
Dave
################### first line in source file
%endings = qw(
loaf loaves
child children
woman women
mouse mice
man men
person people
sheep sheep
fish fish
deer deer
species species
Chinese Chinese
alumnus alumni
alumna alumnae
datum data
medium media
crisis crises
index indices
appendix appendices
);
# add singular and plural forms there
# that are different from predictable
# formats
sub pluralize
{
my ($quan, $word) = @_;
my ($pluralform, $lastletter, $lastletters);
return ("1 " . $word) if $quan == 1;
return ($quan . ' ' . $word . '\'s') if $word =~ /\d+/;
if($endings{$word}) {
$pluralform = $endings{$word};
} else {
$lastletter = substr($word, -1);
$penultimateletter = substr($word, -2, 1);
if(($lastletter eq 's')||($lastletter eq 'x') ||
(($lastletter eq 'h') && ($penultimateletter =~
/[cs]/))) {
$pluralform = $word . "es";
} elsif(($lastletter eq 'y') && ($penultimateletter =~
/[^aeiou]/)) {
$pluralform = $word;
substr($pluralform, -1) = "ies";
} else {
$pluralform = $word . 's';
}
}
return ($quan . " " . $pluralform);
}
###############################################
#
# the following is used only to test the routine
#
###############################################
my $quantity;
for $quantity (1 .. 2) {
for $things ('sheep', 'car', 'family', 'house', 'file',
'10', 'fly', 'Cray', 'bush',
'datum') {
print ("I have ", pluralize($quantity, $things), "\n");
}
}
############# last line in source file
------------------------------
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 2083
**************************************