[9997] in Perl-Users-Digest
Perl-Users Digest, Issue: 3590 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 30 14:04:05 1998
Date: Sun, 30 Aug 98 11:00:19 -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 Sun, 30 Aug 1998 Volume: 8 Number: 3590
Today's topics:
Re: even or odd (hymie!)
gethostbyaddr doesn't work <Jan.Ekvall@ehpt.com>
Re: gethostbyaddr doesn't work (Mike Stok)
Re: How to extract first letter in string? (Mike Stok)
How to unpack utmp file..... sn0opy@my-dejanews.com
How to unpack utmp file... sn0opy@my-dejanews.com
Memory Problem, Please Help. chad@gurucom.net
PASSME (EkimicraD)
Re: Perl compiler (Snowhare)
Re: Perl Script to Retreve HTML Files from the Internet <arunas@a!nm.org>
Problem compiling GTK/Perl 0.2.04 on solaris <ehendam@mailexcite.com>
Re: Problem with a package <maryesme@localaccess.com>
Re: Random Numbers in Range? (Matthew Bafford)
Re: Random Numbers in Range? (M.J.T. Guy)
Re: Random Numbers in Range? (Larry Rosler)
regex help, again?? <skidmore@musc.edu>
Re: thank you (mt) (Jonathan Stowe)
Re: trouble writing 2 files in subroutines (M.J.T. Guy)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Aug 1998 14:39:18 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: even or odd
Message-Id: <6sbo6n$be$1@news.smart.net>
As much as I hate to have to disagree with Abigail...
In our last episode, the evil Dr. Lacto had captured our hero,
abigail@fnx.com, who said:
>Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCXXIII September
>MCMXCIII in <URL: news:6s7es8$mcl$1@csnews.cs.colorado.edu>:
>++
>++ The question ``Is a number even'' means ``Is a
>++ number an even multiple of 2''. In fact, once you do that, you can
>
>ITYM: "an even multiple of 1".
Every (integer) is an even multiple of 1, because 1 divides evenly into
them all with no remainder.
9 is an even multiple of 3, because 3 divides into it evenly.
On the other hand, 6.25 is a multiple of 2, because 2 * 3.125 = 6.25;
however, 6.25 is not an even multiple of 2.
..hymie! http://www.smart.net/~hymowitz hymie@lactose.smart.net
===============================================================================
I'm just a soul whose intentions are good.
Oh, Lord, please don't let me be misunderstood. --Nina Simone
===============================================================================
------------------------------
Date: Sun, 30 Aug 1998 17:59:49 +0200
From: Jan Ekvall EHS/SKA 83455 62186 <Jan.Ekvall@ehpt.com>
Subject: gethostbyaddr doesn't work
Message-Id: <35E976F5.A9DDA31A@ehpt.com>
Why doesn't this work?
Guess I must have gotten something terribly wrong.
$name = gethostbyaddr("193.181.246.221", AF_INET);
print $name;
The addresses I'm using as arguments are all the same subnet
as the machine I'm running the script on.
Cheers,
Jan Ekvall, EHPT
------------------------------
Date: 30 Aug 1998 16:18:04 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: gethostbyaddr doesn't work
Message-Id: <6sbtvs$4j9@news-central.tiac.net>
In article <35E976F5.A9DDA31A@ehpt.com>,
Jan Ekvall EHS/SKA 83455 62186 <Jan.Ekvall@ehpt.com> wrote:
>Why doesn't this work?
>Guess I must have gotten something terribly wrong.
>
>$name = gethostbyaddr("193.181.246.221", AF_INET);
>
>print $name;
>
>The addresses I'm using as arguments are all the same subnet
>as the machine I'm running the script on.
have you tried something like
use Socket;
$name = gethostbyaddr (inet_aton ('209.61.81.40'), AF_INET);
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 30 Aug 1998 14:31:04 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to extract first letter in string?
Message-Id: <6sbnn8$dk@news-central.tiac.net>
In article <35E7FE89.B3A45F81@email.sps.mot.com>,
Tk Soh <r28629@email.sps.mot.com> wrote:
>Mike Stok wrote:
>> >> Are there anyone, who can tell me how to extract the first letter in a
>> >> string..
>> >
>>
>> Might something like
>>
>> ($firstLetter) = $string =~ /([^\W\d_])/;
>>
>> be better if the original poster really wanted the first letter, not the
>> first character?
>
>You mean first 'letter', as in /([a-zA-Z])/, right?
>I have difficulty in translating /([^\W\d_])/ into English - perhaps
>the problem is with my English lang. :)
If your only concern is ASCII then you'll be OK assuming [a-zA-Z] covers
all the letters, but the perllocale man page says this:
These are important issues, especially for languages other
than English--but also for English: it would be naieve to
imagine that A-Za-z defines all the "letters" needed to
write in English.
\w and \W are locale aware, so the set of characters matched by
[\W\d_]
are any characters which aren't alphabetic, numeric or _ in the current
locale (\W), any characters which are numeric (\d) and the _. That's
everything *except* alphabetic characters, so [^\W\d_] matches just
alphabetic characters.
If you'll forgive the "non word" in the example (assuming you're reading
on an ISO8859-1 display):
#!/usr/local/bin/perl -w
use locale;
use POSIX qw/locale_h/;
$string = 'tne';
($firstLetter) = $string =~ /([^\W\d_])/;
print "$firstLetter\n";
setlocale (LC_CTYPE, 'fr_FR.ISO8859-1') || die "selocale ($!)\n";
($firstLetter) = $string =~ /([^\W\d_])/;
print "$firstLetter\n";
__END__
produces
n
t
which seems reasonable, my default setup uses ASCII which doesn't consider
o-circumflex a letter. This may or may not be useful considering the
original questioner's email address was thomas@provideo.dk...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Sun, 30 Aug 1998 16:11:28 GMT
From: sn0opy@my-dejanews.com
Subject: How to unpack utmp file.....
Message-Id: <6sbtjg$k1q$1@nnrp1.dejanews.com>
Hello!
This is fragment of mine utmpbits.h concerning utmp structure:
#define UT_LINESIZE 32
#define UT_NAMESIZE 32
#define UT_HOSTSIZE 256
struct utmp
{
short int ut_type; /* Type of login. */
pid_t ut_pid; /* Pid of login process. */
char ut_line[UT_LINESIZE]; /* NUL-terminated devicename of tty. */
char ut_id[4]; /* Inittab id. */
char ut_user[UT_NAMESIZE]; /* Username (not NUL terminated). */
#define ut_name ut_user /* Compatible field name for same. */
char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
struct exit_status ut_exit; /* The exit status of a process marked
as DEAD_PROCESS. */
long ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
int32_t ut_addr_v6[4]; /* Internet address of remote host. */
char pad[20]; /* Reserved for future use. */
};
I tried to use followed sheme to unpack: 's l A32 A4 A32 A256 s s s s L s s s
s L A20', but no success....
What's wrong with my method?
BTW, What is record size for such structure -374?
Serge.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sun, 30 Aug 1998 16:05:09 GMT
From: sn0opy@my-dejanews.com
Subject: How to unpack utmp file...
Message-Id: <6sbt7l$jj6$1@nnrp1.dejanews.com>
Hello!
This is fragment of my utmpbits.h file, concerning utmp structure:
#define UT_LINESIZE 32
#define UT_NAMESIZE 32
#define UT_HOSTSIZE 256
struct utmp
{
short int ut_type; /* Type of login. */
pid_t ut_pid; /* Pid of login process. */
char ut_line[UT_LINESIZE]; /* NUL-terminated devicename of tty. */
char ut_id[4]; /* Inittab id. */
char ut_user[UT_NAMESIZE]; /* Username (not NUL terminated). */
#define ut_name ut_user /* Compatible field name for same. */
char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
struct exit_status ut_exit; /* The exit status of a process marked
as DEAD_PROCESS. */
long ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
int32_t ut_addr_v6[4]; /* Internet address of remote host. */
char pad[20]; /* Reserved for future use. */
};
I trying to use the followed sheme to unpack: 's L A32 A4 A32 A256 s s s s L
s s s s L A20', but no success....
What's wrong?
BTW, what's size of the record for such structure, 374?
Serge
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sun, 30 Aug 1998 17:18:54 GMT
From: chad@gurucom.net
Subject: Memory Problem, Please Help.
Message-Id: <6sc1ht$o8m$1@nnrp1.dejanews.com>
Hi,
I have been writing perl scripts for many years but still consider myself a
newbee, there are just so many things you can do with it, i'm still learning.
So I need alittle help. I have this script that runs for a very long time as
it should except it eating up memory and it should'nt. Is there away besides
looking at 'ps' or 'top' to figure out better what's going on? Does perl
have a 'special variable' that tell about memory usage of the running script?
Please advise,
thanks chad
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sun, 30 Aug 1998 16:43:06 GMT
From: EkimicraD@xxx.xxx (EkimicraD)
Subject: PASSME
Message-Id: <35e9841a.0@news.wgn.net>
text
------------------------------
Date: 30 Aug 1998 09:32:56 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Perl compiler
Message-Id: <6sbrb8$sl5$1@xmission.xmission.com>
Nothing above this line is part of the signed message.
In article <1defqa1.1u1u3aj1c2yjw5N@roxboro0-025.dyn.interpath.net>,
John Moreno <phenix@interpath.com> wrote:
>In comp.lang.perl.misc I R A Aggie <fl_aggie@thepentagon.com> wrote:
>
>> Ah, security by obscurity.
>>
>> James - hint: it ain't secure just 'cause you don't think anyone knows
>> about the security hole in your system...
>
>No, but it secure as long as you are correct.
That depends on the security hole. I once worked for a company that wrote
their own (extremely brain-dead) operating system as a junior systems
programmer. After I started there, I discovered that the system
'maintainence mode' was invokable from *any* terminal port with one
keystroke - and that a certain 3 byte sequence fed to it would wipe
the boot block - no questions asked.
This was in the days when *non-error-correcting* 2400 bps modems were
considered fairly high-end for dial up non-dedicated service. And were
connected to terminal ports for remote maintainence of client's systems.
No one knew about it. No one *needed* to know about it. Yet, it takes
little intelligence to to predict that *eventually* it was going to blow
the boot sector on a client's system - via simple random line noise.
Some security holes are so bad you can fall through them by *accident*.
Benjamin Franz
Version: 2.6.2
iQCVAwUBNelwoujpikN3V52xAQHhSAQAnQxOzEbF+OGBZ1iBsDxZUa/VN90RLFBz
GeZUisibywpjZaNfM9PGZ1dY04lKg5EmQoIqXMqZZc8DLA6996JYzL5b4N8XL8Q2
nq0t42GBq3eq9HHRm67gOKngbHUub7OI3tHW/TOZQpuMDb/9pn5oKVSbAbxrWlRh
+T6aZ9Cw28s=
=frU4
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 29 Aug 1998 12:34:54 -0600
From: "Arunas Salkauskas" <arunas@a!nm.org>
Subject: Re: Perl Script to Retreve HTML Files from the Internet
Message-Id: <35e8499b.0@news.cadvision.com>
A text editor usually works well.
Or was that not your question? You'd have to be more specific I think.
--
- Arunas Salkauskas
High Point Designs
http://www.highpointdesigns.com/
Brian Zuill wrote in message ...
>How do I compose a perl script file to get an HTML File from the Internet?
>
>Thanks,
>
>Brian Zuill
>
>
------------------------------
Date: Sun, 30 Aug 1998 16:02:19 GMT
From: "Mohamed Hendawi" <ehendam@mailexcite.com>
Subject: Problem compiling GTK/Perl 0.2.04 on solaris
Message-Id: <fIeG1.92041$Xy6.13806919@news.rdc1.ct.home.com>
I cannot compile GTK/Perl 0.2.04 on Solaris 2.51 with perl 5.004_04. I get
the following
error:
ld: fatal: too many symbols require "small" PIC references:
have 4543, maximum 2048 -- recompile some modules -K PIC.
Any idea what this could mean? I have tried this with all permutations of
GTK/Perl 0.2.04 and 0.3 and GTK 1.0.5 and 1.1.1.
One thing I find suspicious is the fact that I am using gcc as the compiler
and /usr/ccs/bin/ld to link. That seems fishy. Shouldn't gcc be using it's
own linker? It's possible that my system has been configured incorrectly.
One additional note: I tried hacking the CCFLAGS in the Makefile to include
"-fpic". I still get the same problem though.
Thanks for any help
Moe - ehendam@mailexcite.com
------------------------------
Date: Sun, 30 Aug 1998 09:15:51 -0700
From: Mark Lybrand <maryesme@localaccess.com>
Subject: Re: Problem with a package
Message-Id: <35E97AB7.1A40@localaccess.com>
> I think you want:
>
> $q= new CGI::Multiple;
That did it. Thanks.
> Your module does not make every CGI object know how to do
> CGI::Multiple methods. Inheritance works the other direction.
I think this last bit is going to prove to be a very important lesson
for this functionally-oriented programmer stumbling into an
object-oriented world.
Thanks again.
Mark :)
------------------------------
Date: Sun, 30 Aug 1998 10:41:54 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Random Numbers in Range?
Message-Id: <MPG.10532eb85984e468989681@news.south-carolina.net>
In article <6sbnd7$s30$1@pegasus.csx.cam.ac.uk> on 30 Aug 1998
14:25:43 GMT, M.J.T. Guy (mjtg@cus.cam.ac.uk) pounded in the
following text (give or take a quote or two):
> In article <35E6C145.631F@min.net>, John Porter <jdporter@min.net> wrote:
> >Matt Knecht wrote:
> >>
> >> $num = rand_range(97 => 122);
> >
> >I don't understand why people do this.
> >It forces an unnecessary stringization of a number.
>
> Eh? Why should it? It doesn't on any version of Perl I have installed.
>
>
> Mike Guy
>
I imagine he (John Porter) is referring to the following from
perlop:
...The => digraph is mostly just a synonym for the comma
operator. It's useful for documenting arguments that come
in pairs. As of release 5.001, it also forces any word to
the left of it to be interpreted as a string....
Now the question is, what exactly is a word (in this case)? Is
it the first set of non-whitespace characters to the left of the
'=>'?
But then, considering how numbers and strings convert back and
forth as needed, I doubt this matters much. It might be slightly
more efficient to use the ',' in this case, but I would imagine
the efficiency benefit would be very small indeed.
Plus, IMHO, it's more readable with the '=>' than the ','.
Hmm...
--Matthew
------------------------------
Date: 30 Aug 1998 14:54:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Random Numbers in Range?
Message-Id: <6sbp2j$t48$1@pegasus.csx.cam.ac.uk>
Matthew Bafford <dragons@scescape.net> wrote:
>
>I imagine he (John Porter) is referring to the following from
>perlop:
>
> ...The => digraph is mostly just a synonym for the comma
> operator. It's useful for documenting arguments that come
> in pairs. As of release 5.001, it also forces any word to
> the left of it to be interpreted as a string....
>
>Now the question is, what exactly is a word (in this case)? Is
>it the first set of non-whitespace characters to the left of the
>'=>'?
What a "word" always is Perl, of course. I.e. [^\W\d]\w* .
Mike Guy
------------------------------
Date: Sun, 30 Aug 1998 08:18:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random Numbers in Range?
Message-Id: <MPG.10530d116c99518c989817@nntp.hpl.hp.com>
In article <MPG.10532eb85984e468989681@news.south-carolina.net> on Sun,
30 Aug 1998 10:41:54 -0400, Matthew Bafford <dragons@scescape.net>
says...
...
> I imagine he (John Porter) is referring to the following from
> perlop:
>
> ...The => digraph is mostly just a synonym for the comma
> operator. It's useful for documenting arguments that come
> in pairs. As of release 5.001, it also forces any word to
> the left of it to be interpreted as a string....
...
> Plus, IMHO, it's more readable with the '=>' than the ','.
I have found '=>' useful also for documenting arguments where the first
argument is different from, and in some sense applies to, the remaining
arguments. For example,
grep EXPR => LIST
join EXPR => LIST
map EXPR => LIST
pack EXPR => LIST
split EXPR => SCALAR
sprintf EXPR => LIST
unpack EXPR => SCALAR
The visual distinction of the => from succeeding commas is very useful,
IMO. It can be read as '[verb] EXPR applied to LIST'...
These are a bit odder, but still sensible:
chown EXPR, EXPR => SCALAR
utime EXPR, EXPR => SCALAR
Basically, it separates the operator(s) from the operand(s).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 29 Aug 1998 14:23:22 -0400
From: "josh skidmore" <skidmore@musc.edu>
Subject: regex help, again??
Message-Id: <6s9gvv$6jl$1@supernews.com>
ok...i am tring to post the business news from wired on my site...i am using
LWP (simple) to do it, but how exactly do I get a regex to get the line
labeled **LINE**?? There is nothing similar?
<font face="Arial, Helvetica, sans-serif" size=3>
<a href="/news/news/business/story/14705.html"><b>Intuit: Cost-Cutting
Pays Off</b></a></font>
<br>
<font color=#ff0000 face="Verdana, Arial, Geneva, sans-serif"
size=1><b></b><!br>Thursday</font>
<font face="Verdana, Arial, Geneva, sans-serif" size=2>
**LINE** The maker of personal finance software says its close eye on
expenses helps account for its better-than-forecast fourth-quarter earnings.
</font>
--
Josh Skidmore
ICQ: 16589193
http://www.skidcom.net
josh@skidcom.net
"Out of the many things in life that you can acomplish, the thing that
really matters is what you can't even see . . ."
-Josh Skidmore
------------------------------
Date: Sat, 29 Aug 1998 21:55:58 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: thank you (mt)
Message-Id: <35e842da.29941375@news.btinternet.com>
On Sat, 29 Aug 1998 11:19:05 +0800, Cattle wrote :
>
>
Thats gratitude for you - he's speechless with appreciation (or could
it be BSE)
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 30 Aug 1998 14:51:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: trouble writing 2 files in subroutines
Message-Id: <6sbou8$st4$1@pegasus.csx.cam.ac.uk>
Peter Bismuti <bismuti@dirac.scri.fsu.edu> wrote:
>
>HI, I've noticed that if I open a file to write and then enter
>into a subroutine, I can no longer write to this file.
>Is this a bug?
Without code, who can tell what's happening?
Perhaps your subroutine is in a different package from the open()?
So you're trying to write to Mypack::FH instead of main::FH ?
Mike Guy
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3590
**************************************