[12158] in Perl-Users-Digest
Perl-Users Digest, Issue: 5758 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 23 14:07:16 1999
Date: Sun, 23 May 99 11:00:18 -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, 23 May 1999 Volume: 8 Number: 5758
Today's topics:
[Fwd: XS programming (HELP!) newbie...] <emilio_tunon@nl.compuware.com>
Bookmarking Favorites in Word aidancurrie@hotmail.com
Re: Bookmarking Favorites in Word <tchrist@mox.perl.com>
Creating index from html code (long) <cgaunt@umich.edu>
Don't understand ctime / stat[10] <hove@ido.phys.ntnu.no>
Re: Don't understand ctime / stat[10] <tchrist@mox.perl.com>
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (hymie!)
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (hymie!)
Re: Help with challenge script (anonymous)
NT null connections <carvdawg@patriot.net>
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl Tutorials billy_collins@my-dejanews.com
Puzzled? Subroutine Problem (BKrapf9811)
Re: Sorting is too slow for finding top N keys... - UPD (Marko R. Riedel)
trouble with constants declared in a module <jhilgedi@indiana.edu>
Re: trouble with constants declared in a module <uri@sysarch.com>
Re: wait(), zombies, and solaris: why won't my children (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 23 May 1999 11:14:08 +0100
From: Didimo Emilio Grimaldo Tunon <emilio_tunon@nl.compuware.com>
Subject: [Fwd: XS programming (HELP!) newbie...]
Message-Id: <780A83616B05D311968000204840250030A832@SEUBPEBAS54>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01BEA52C.6E6216BE
Content-Type: text/plain;
charset="iso-8859-1"
--
__o "Admit nothing, deny everything, demand proof. :)"
_`\<,_ -James Ebbs
___(*)/_(*)____.___o____..___..o...________ooO..._____________________
D. Emilio Grimaldo Tunon
http://www.iaehv.nl/users/grimaldo/
http://www.iaehv.nl/users/grimaldo/cv/
http://www.iaehv.nl/users/grimaldo/panama.html
http://www.iaehv.nl/users/grimaldo/Linux/
------_=_NextPart_000_01BEA52C.6E6216BE
Content-Type: message/rfc822
Path: EUBPEBAS.SONY.com!news-master.compuserve.com!arl-news-svc-7.compuserve.com!news.cis.ohio-state.edu!news.maxwell.syr.edu!newsgate.cistron.nl!het.net!news.IAEhv.nl!not-for-mail
NNTP-Posting-Host: pm13d33.iae.nl
Newsgroups: comp.lang.perl.modules
From: Didimo Emilio Grimaldo Tunon <grimaldo@iaehv.nl>
Subject: XS programming (HELP!) newbie...
Message-ID: <3746C222.6D3643F8@nl.compuware.com>
Sender: Didimo Emilio Grimaldo Tunon <grimaldo@iaehv.nl>
Date: Sat, 22 May 1999 15:41:38 +0100
MIME-Version: 1.0
Lines: 25
X-Newsreader: Microsoft (R) Exchange Internet News Service Version 5.5.2448.0
Organization: Internet Access Eindhoven, the Netherlands
Content-Type: text/plain
Hi XS*,
I am just beginning to get into Perl Extension programming (XS),
have read the various manual pages and have gotten something basic
working but I have the following questions:
1. The perlxstut man page says that during 'make install' it is
installed in the Perl's system directory (/usr/lib/perl5/...)
but what about being able to install it in 'user space'? say
$HOME/perllib/ ? is that possible? I would hope so, that way
one can try these binary modules before actually installing
them on the system (among other applications...)
2. I have a Perl function that I invoke like:
&SetRequest(\$var1, \@array, \%hash);
but I haven't figured out how to get the thing to either
let var1 be known to the caller or get elements (in the XS)
from the array. The array has strings.
Could somebody give me a short example of how to have the
proper XS stub for this function? what about getting the
string elements of the array? I figured out how to get the
length of the array but that's it :( and if it is not much
to ask (for the sake of an example) obtaining the key and
value of the hash. Both the array and the hash are actually
references-to..
I think that will give me a quick start, in the meantime
I will read the man pages again but I haven't found any
useful, practical example out of it...
TIA,
Emilio
--
__o "Admit nothing, deny everything, demand proof. :)"
_`\<,_ -James Ebbs
___(*)/_(*)____.___o____..___..o...________ooO..._____________________
D. Emilio Grimaldo Tunon
http://www.iaehv.nl/users/grimaldo/
http://www.iaehv.nl/users/grimaldo/cv/
http://www.iaehv.nl/users/grimaldo/panama.html
http://www.iaehv.nl/users/grimaldo/Linux/
------_=_NextPart_000_01BEA52C.6E6216BE--
------------------------------
Date: Sun, 23 May 1999 16:26:36 GMT
From: aidancurrie@hotmail.com
Subject: Bookmarking Favorites in Word
Message-Id: <7i9a7s$eb3$1@nnrp1.deja.com>
Hey there,
I was hoping somebody could give me some desparatel needed direction...
I have a five chapter word document saved as html. I would like to make
it so that when I open the doc in my browser, the five chapters
automatically appear in my Favorites menu.
Does anyone know how I could do this??!
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 23 May 1999 10:46:47 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Bookmarking Favorites in Word
Message-Id: <374830f7@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, aidancurrie@hotmail.com writes:
:I was hoping somebody could give me some desparatel needed direction...
:I have a five chapter word document
I'm sorry.
:saved as html.
I'm sorry again.
:I would like to make
:it so that when I open the doc in my browser,
I'm sorry yet again.
:the five chapters
:automatically appear in my Favorites menu.
:Does anyone know how I could do this??!
Probably someone not in the right newsgroup!
I can't imagine what you're thinking.
--tom
--
#else /* !STDSTDIO */ /* The big, slow, and stupid way */
--Larry Wall in str.c from the 4.0 perl source code
------------------------------
Date: Sun, 23 May 1999 13:03:47 -0400
From: Christine Gaunt <cgaunt@umich.edu>
Subject: Creating index from html code (long)
Message-Id: <Pine.SOL.4.10.9905231222460.3023-100000@stargate.rs.itd.umich.edu>
Hi,
I'd been working with a programmer to create an index from a portion of
the web site I co-compile. The programmer no longer has time to work on
this script, but the need for it is still there, and I've been trying to
fix the script myself. But I'm not a programmer, so you can imagine my
frustration.
The index is to be used as a lookup for surnames included in genealogy
mailing lists, and the cgi script to do that is yet to be written.
The surnames are included on the web pages as follows:
<li><a href="#BEAUCHAMP">BEAUCHAMP</a> (includes Beecham, Beauchamps)<br>
<li><a href="#BEAUDRY">BEAUDRY</a> (includes Baudry)<br>
<li><a href="#BEAUREGARD">BEAUREGARD</a> (includes Beauregard dit Jarret,
Beauregard dit Vincent,
Beauregard dit Davignon, Beauregard Toutant)<br>
<li><a href="#BEAUVAIS">BEAUVAIS</a> (includes Bauvais, Bova, St. Gemme,
St. Gem, St. James,
Vanesse dit Beauvais, Coderre dit Beauvais, Beauvet, Bauvet)<br>
<li><a href="#BECHTEL">BECHTEL</a> (includes Bechdol, Bachtel, Bechtold,
Bechthold, Beachtel, Bachtell, Bechtell, Buchtel, Beghtol, Bechtolt,
Bechtol, Baechtold, Bechdolt, Becktal, Bechtal, Bechtle, Bectal, Beghtel,
Beghtol, Beightol, Bachtold, Backtell, Bechtl, Becktel, Becthel, Bucktel,
Buechtel)<br>
[the html code is from
http://members.aol.com/gfsjohnf/gen_mail_surnames-b.html ]
The script is supposed to create a file separated by the verical bar, and
for the most part, does. A snippet of the index is below.
Fields are: Soundex code | surname | Listname | filename#Anchor
B251|BEAUCHAMPS|BEAUCHAMP|b.html#BEAUCHAMP
B360|BEAUDRY|BEAUDRY|b.html#BEAUDRY
B360|BAUDRY|BEAUDRY|b.html#BEAUDRY
B360|BEAUDRY|BEAUDRY|b.html#BEAUDRY
B365|BAUDRY INCLUDES BEAUREGARD DIT JARRET|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD DIT VINCENT|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD DIT DAVIGNON|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD TOUTANT|BEAUDRY|b.html#BEAUDRY
B360|BEAUDRY|BEAUDRY|b.html#BEAUDRY
B365|BAUDRY INCLUDES BEAUREGARD DIT JARRET|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD DIT VINCENT|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD DIT DAVIGNON|BEAUDRY|b.html#BEAUDRY
B626|BEAUREGARD TOUTANT JAMES|BEAUDRY|b.html#BEAUDRY
V523|VANESSE DIT BEAUVAIS|BEAUDRY|b.html#BEAUDRY
C363|CODERRE DIT BEAUVAIS|BEAUDRY|b.html#BEAUDRY
B130|BEAUVET|BEAUDRY|b.html#BEAUDRY
B130|BAUVET|BEAUDRY|b.html#BEAUDRY
B234|BECHTEL|BECHTEL|b.html#BECHTEL
B234|BECHDOL|BECHTEL|b.html#BECHTEL
For some reason the script is retaining the match on the BAUDRY surname
and combining it with the "(includes Beauregard dit Jarret" from the next
line. It is doing this with other lists with multiple word surnames as
well.
Here is the perl script:
#! /usr/local/bin/perl
# create-list-list.pl
use locale;
use LWP::Simple;
use Text::Soundex;
%mirrors = (
'http://members.aol.com/gfsjohnf/gen_mail_surnames-a.html' => 'a.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-b.html' => 'b.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-c.html' => 'c.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-d.html' => 'd.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-e.html' => 'e.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-f.html' => 'f.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-g.html' => 'g.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-h.html' => 'h.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-ij.html' => 'ij.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-k.html' => 'k.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-l.html' => 'l.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-m.html' => 'm.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-no.html' => 'no.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-p.html' => 'p.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-qr.html' => 'qr.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-s.html' => 's.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-t.html' => 't.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-uv.html' => 'uv.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-w.html' => 'w.html',
'http://members.aol.com/gfsjohnf/gen_mail_surnames-xyz.html' => 'xyz.html',
);
while (($url, $localfile) = each(%mirrors)) {
mirror($url, $localfile);
}
# remove ^Ms
system("tr -d '\015' < a.html | tr -d '\032' >a.temp");
system("rm a.html");
system("tr -d '\015' < b.html | tr -d '\032' >b.temp");
system("rm b.html");
system("tr -d '\015' < c.html | tr -d '\032' >c.temp");
system("rm c.html");
system("tr -d '\015' < d.html | tr -d '\032' >d.temp");
system("rm d.html");
system("tr -d '\015' < e.html | tr -d '\032' >e.temp");
system("rm e.html");
system("tr -d '\015' < f.html | tr -d '\032' >f.temp");
system("rm f.html");
system("tr -d '\015' < g.html | tr -d '\032' >g.temp");
system("rm g.html");
system("tr -d '\015' < h.html | tr -d '\032' >h.temp");
system("rm h.html");
system("tr -d '\015' < ij.html | tr -d '\032' >ij.temp");
system("rm ij.html");
system("tr -d '\015' < k.html | tr -d '\032' >k.temp");
system("rm k.html");
system("tr -d '\015' < l.html | tr -d '\032' >l.temp");
system("rm l.html");
system("tr -d '\015' < m.html | tr -d '\032' >m.temp");
system("rm m.html");
system("tr -d '\015' < no.html | tr -d '\032' >no.temp");
system("rm no.html");
system("tr -d '\015' < p.html | tr -d '\032' >p.temp");
system("rm p.html");
system("tr -d '\015' < qr.html | tr -d '\032' >qr.temp");
system("rm qr.html");
system("tr -d '\015' < s.html | tr -d '\032' >s.temp");
system("rm s.html");
system("tr -d '\015' < t.html | tr -d '\032' >t.temp");
system("rm t.html");
system("tr -d '\015' < uv.html | tr -d '\032' >uv.temp");
system("rm uv.html");
system("tr -d '\015' < w.html | tr -d '\032' >w.temp");
system("rm w.html");
system("tr -d '\015' < xyz.html | tr -d '\032' >xyz.temp");
system("rm xyz.html");
#######################################################
# #
# M A I N R O U T I N E S T A R T S H E R E #
# #
#######################################################
@files = `ls -1 *.temp`;
FILE:
foreach $file (@files) {
open(F, $file) || die "can't find file\n";
chop $file;
$* = 1;
while (<F>) {
$incomplete_flag = 1;
$skip = 0;
$line = $_;
# find all lines between <ul> and </ul>
$_ = $line;
if ( /URL: .+surnames-(.+\.html)/) {
$page_url = $1;
}
if ( m#<ul>#i ... m#</ul>#i ) {
$_ = $line;
# all the lines that have (includes
if(/<li><a href="(.+)">(.+)<..> \(includes (.+)\)<br>/) {
$tag = $1;
$list_name = $2;
$includes = $2 . ", " . $3;
$incomplete_flag = 0;
$skip = 1;
}
# all the lines that don't have includes
if(/<li><a href="(.+)">(.+)<..><br>/) {
$tag = $1;
$list_name = $2;
$includes = $2;
$incomplete_flag = 0;
$skip = 1;
}
# first of three cases to capture records that span
# multiple lines: capture first line
if(/<li><a href="(.+)">(.+)<..> \(includes (.+,)\Z/) {
$tag = $1;
$list_name = $2;
$includes = $2 . ", " . $3;
$incomplete_flag = 1;
$skip = 1;
}
# last of three cases to capture records that span
# multiple lines: capture last line
if(/([A-Za-z, ]+)\)<br>/) {
if ($skip == 0) {
$includes = $includes . " " . $1;
$incomplete_flag = 0;
$skip = 1;
}
}
# second of three cases to capture records that span
# multiple lines: capture any and all intervening lines.
if(/([A-Za-z, ]+)\Z/) {
if ($skip == 0) {
$includes = $includes . " " . $1;
$incomplete_flag = 1;
}
}
# last of three cases to capture records that span
# multiple lines: capture last line
if(/([A-Za-z, ]+)\)<br>/) {
if ($skip == 0) {
$includes = $includes . " " . $1;
$incomplete_flag = 0;
$skip = 1;
}
}
if ( $incomplete_flag == 0 ) {
@names = split(/,\s+/,$includes);
foreach $name (@names) {
$_ = $name;
#$NAME = uc($name); #per cookbook on page 19
tr/[a-z]/[A-Z]/;
s/\&OUML\;/\231/;
s/\&UUML\;/\232/;
s/\&EACUTE\;/\220/;
s/\&UACUTE\;/\125/;
$name = $_;
$code = soundex $name ;
if (! /SOUNDEX/ ) {
# print "$code|$NAME|$list_name|$page_url$tag\n";
print "$code|$name|$list_name|$page_url$tag\n";
}
}
}
}
}
next FILE;
close(F);
}
Sorry this is so long. Hope someone can help!
Thanks,
Chris
Christine Gaunt, cgaunt@umich.edu or gaunt@genealogy.org
Campbell-L and BTRVETC-L listowner
Co-compiler of Genealogy Resources on the Internet
http://www-personal.umich.edu/~cgaunt/gen_int1.html
------------------------------
Date: 23 May 1999 19:28:58 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Don't understand ctime / stat[10]
Message-Id: <k0npv3r66g5.fsf@ido.phys.ntnu.no>
Hello,
I have a program with the following main-loop:
while (1) {
[...Snip...]
open(FILE,">>$load_file") || die("Could not open $load_file $! \n");
printf(FILE "%10.0f %6.2f %6.2f %6.2f \n",time - $start_time ,
$1,$2,$3);
close(FILE);
sleep($sleep_time);
}
The file $load_file is created at the top of the program, and then in
the main-loop shown above one new line is added to this file for every
iteration in the loop.
In another program, which analyses this file, I would like to compare
the creation time, and the last modification time of this file. Now, I
do know that stat[10] gives the _inode_change_time_ which is different
from the creation time, however I thought the loop shown above would
not alter the ctime of $load_file, and hence in this particular case
ctime would equal creation time. However this seems to be wrong, for
every iteration ctime is updated, and ctime == mtime.
If someone could shed light on why this is so I would be very
grateful,
Joakim Hove
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / 352 GF | Skoyensgate 10D #
# N - 7034 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim #
=====================================================================
------------------------------
Date: 23 May 1999 11:57:11 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Don't understand ctime / stat[10]
Message-Id: <37484177@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Joakim Hove <hove@ido.phys.ntnu.no> writes:
:In another program, which analyses this file, I would like to compare
:the creation time,
Can't do that.
:and the last modification time of this file. Now, I
:do know that stat[10] gives the _inode_change_time_ which is different
:from the creation time, however I thought the loop shown above would
:not alter the ctime of $load_file, and hence in this particular case
:ctime would equal creation time. However this seems to be wrong, for
:every iteration ctime is updated, and ctime == mtime.
When you update the mtime (or atime), you have updated metadata and
thereby changed the inode. Since you've changed the inode, you of course
now have to update the ctime.
--tom
--
If I don't document something, it's usually either for a good reason,
or a bad reason. In this case it's a good reason. :-)
--Larry Wall in <1992Jan17.005405.16806@netlabs.com>
------------------------------
Date: 23 May 1999 17:18:28 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7i9d94$7j8$1@news.smart.net>
In our last episode, the evil Dr. Lacto had captured our hero,
tchrist@mox.perl.com (Tom Christiansen), who said:
> [courtesy cc of this posting mailed to cited author]
>
>Cursed by that miserable piece of crap, Mozilla/4.05 [en] (Win95; I)
>finsol@ts.co.nz writes in comp.lang.perl.misc:
>
>:Unfortunately, many of the Y2K problems in Perl applications *is* the
>:fault of the language.
>Thanks for spreading Fear and Ugliness and Deception.
I found a quote once ...
It's not Perl's fault if you don't know how to program. --Ronald J Kimball
... and kept it in my set of random sigs.
..hymie! http://www.smart.net/~hymowitz hymie@lactose.smart.net
===============================================================================
I believe I've passed the age of consciousness and righteous rage.
I've found that just surviving was a noble fight. --Billy Joel
===============================================================================
------------------------------
Date: 23 May 1999 17:23:04 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7i9dho$7js$1@news.smart.net>
In our last episode, the evil Dr. Lacto had captured our hero,
ilya@math.ohio-state.edu (Ilya Zakharevich), who said:
>I did not read the "critique" you are refering to, but a fact is a
>fact: there is no legal usage of $y = (localtime)[5] except as
>
> $y % 100;
>
>and
>
> 1900 + $y;
#!/usr/bin/perl -w
print "Here is my perl script to tell you how many years have passed since\n";
print "1 Jan 1900.\n";
$y = (localtime)[5];
print "\n$y years have passed since 1 Jan 1900.\n";
exit 0;
..hymie! http://www.smart.net/~hymowitz hymie@lactose.smart.net
===============================================================================
I gotta get my life some writers. -- Calvin (Bill Watterson)
===============================================================================
------------------------------
Date: 23 May 1999 16:14:30 GMT
From: anonymous@nouce.net (anonymous)
Subject: Re: Help with challenge script
Message-Id: <7i99h6$92f$1@owl.slip.net>
Thanks a lot for your response. You are correct that there are
lot of flaws in this script. I have basically rewritten the script
with lots of bug fixes. With this in mind I was just wondering if
you can help me out with my script or tell me where I can look for
a example on archiving a post automatically by the end of the months.
I know that cron can do what I want but I don't have access to it.
thanks
In article <7i8leq$4k6$1@gellyfish.btinternet.com>, Jonathan Stowe <gellyfish@gellyfish.com> says:
>
>On 23 May 1999 02:53:39 GMT anonymous wrote:
>> Right now I have Matts wwwboard2.0a
>> script
>
>Please dont do that. As has been discussed at length here recently this
>(ahem) 'program' is fundamentally flawed.
>
>To summarize:
>
> * It displays a total ignorance of the output of localtime and thus
> will cease to function properly in six and a bit months time.
>
> * It uses no locking on any of the files an thus will fail under
> concurrent access.
>
> * Either no checking of file opens is done or it simply dies in the
> face of a problem with a file - giving 500 error to user.
>
> * It uses a baroque and inefficient storage method - have you looked
> in those message files - how much of that is identical in each ?
>
>So no I am not inclined to help you with your problem. You would be
>better off writing the whole thing yourself from scratch. Sorry if this
>sounds harsh but I think it is better that we let this 'program' go off
>and die in the wilderness and helping you will only help perpetuate it.
>
>BTW please fix your newsreader so it wraps at an acceptable 75ish
>characters rather than the 80+ that it does now. Thank you.
>
>/J\
>--
>Jonathan Stowe <jns@gellyfish.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 23 May 1999 12:42:48 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: NT null connections
Message-Id: <3747E9B8.4E442E39@patriot.net>
What is the best way to check for null connections in Perl? I want to
write a script to ensure that the configurations haven't changed on a
bunch of NT boxes...checking for trojans is easy enough...but how to
check for the null connection?
thanks
Carv
------------------------------
Date: Sun, 23 May 1999 14:48:14 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7i94fe$ak2$1@nnrp1.deja.com>
In article <7HPvwEEXw-B@khms.westfalen.de>,
kaih=7HPvwEEXw-B@khms.westfalen.de (Kai Henningsen) wrote:
> armchair@my-dejanews.com wrote on 19.05.99 in
<7ht6uv$64l$1@nnrp1.deja.com>:
>
> > In article <7hrn8j$5q6$1@nnrp1.deja.com>,
> > John Porter <jdporter@min.net> wrote:
> >
> > >
> > > The NON-difference is that they are both pointers. Pointers hold
> > > one thing: an address. So let's hope your original complaint
> > > that "objects can hold only one thing" has been laid to rest.
> >
> > Both you and Russ Allberry misunderstood my complaint to thing
> > that I
> > didn't know a hash or array could hold references to other
> > hashes and
> > arrays. My complaint was that I had a hierchary of data that
> > starts out
> > at one variable at the highest level. In C++ I can have more
> > than one
> > variable at the highest level. But as what stated before: it's not a
> > brick wall.
>
> It's also completely false, as has been pointed out numerous times.
It's also completely true, as has been pointed out numerous
times.
>
> There is *one* thing that C++ has that Perl doesn't.
> In C++, you can have
> static objects - objects that don't reside on the heap.
subroutineNope {
myObject a; // a is not static, and does not reside on the heap
// when the subroutine ends, a goes away (destructs)
}
>
> Few other object oriented languages have this, because those types of
> objects are severely crippled with respect to inheritance. And there's
> nothing you can do with them, that you can't do with heap-allocated
> objects. It's purely a speed optimization feature.
One thing you can do with an object that was not created as part of a
"new" memory allocation statement is forget about doing a "delete". So
besides being slower, heap-allocation requires an extra statement (often
forgotten) and is done when an object is being allocated for use after
the subroutine exits. Which is usually not the case, at least not in my
shop.
>
> *All* "normal" objects in C++ (those you get from new) are
> accessed with a
> pointer.
I'm not sure why you say that C++ objects are created "normally" with
myObject *p = new myObject(var);
Not where I work - it's: myObject p(var);
I guess you want to call the first case normal so you can equate the
return of a reference in Perl with the construction of an object on the
heap and a return of it's address by new. Forcing the pointer to
always have to be dereference the way a Perl object reference must be
. But I would call the first case far less common for reasons given
above.
>
> *All* objects in Perl are accessed with a (blessed) reference.
But not all C++ objects are accessed via a pointer that was returned by
"new" as mentioned previously. In fact, most are not.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 23 May 1999 14:54:57 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7i94s1$au9$1@nnrp1.deja.com>
In article <927423683.649671@localhost>,
zenin@bawdycaste.org wrote:
> armchair@my-dejanews.com wrote:
> >snip<
> : For an example:
> :
> : int a = object.GetHooziwhatzit(); // C++
> :
> : my $a = $object->GetHooziwhatzit(); # Perl
>
> Or, much more accurately:
>
> Hooziwhatzit a = object.GetHooziwhatzit(); // C++
> my Hooziwhatzit $a = $object->GetHooziwhatzit(); # Perl
>
Hooziwhatzit was not an object, but "some information about some
attribute", represented by, in this case, a number.
what is
my Hooziwhatzit $a ....
Are you presenting that as a legal statement?
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 23 May 1999 15:07:08 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7i95is$bbr$1@nnrp1.deja.com>
In article <yl7lq1ofud.fsf@windlord.stanford.edu>,
Russ Allbery <rra@stanford.edu> wrote:
> armchair <armchair@my-dejanews.com> writes:
>
> > How do I know how tomorrow's date (GetDateTomorrow() )
> > is represented -
> > string, object reference, or number of days since an epoch?
> > I do know,
> > however that that method is returning me some representation of
> > tomorrow's date.
>
> How do you know that in C++? How do you know what the base of
> the epoch
> is, or what the format of the string is?
There were 3 possibilities given. Let's not forget that it could be
returned as a DateTime object. No ambiguity there. If an int, we not it
is represented by a delta since an epoch, but if a time_t it must be the
Unix/C epoch. I have never seen time_t used otherwise. I may not know
the string format, but know it is some string representation of a date,
which may help in understanding code that follows.
>
> > That's the point. I have to look into the object _every time_
> > to find
> > out what it's method returns. In C++ I can see that it
> > returns a string,
> > number or OBJECT OF SPECIFIC TYPE
>
> That's nice; it's worthless information.
No, I wouldn't say it's worthless, nor would I say it is a key that
unlocks the meaning of the program - it is somewhere in between.
>
> > And seeing the type will help me remember what I already
> > learned about
> > the method.
>
> If seeing the method name doesn't already do that, seeing the
> return type
> isn't going to help you any.
It might not help me any, it might help me some.
>
> > It's not worthless information to know that an object of
> > type DateTime
> > is being returned, versus a string that holds a date/time versus
> > an int
> > that is the seconds since 1/1/1970.
>
> That's correct, and a red herring. C++ doesn't tell you that.
>
If it returns a DateTime, it tells me that. Don't forget there were 3
possibilities given and choice (1.)can't be quibbled with. If it returns
a time_t I can safely assume 1/1/1970 as the epoch. But with an int I
don't know the epoch for sure, but I know the date/time is represented
as a delta from an epoch, and with a string I know how it is
represented, but not the exact format. Does the fact that I don't know
everything, mean I have not gained any knowledge from seeing the return
type - matter of opinion upon which we will just have to disagree.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 23 May 1999 16:41:48 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7i9b4c$epl$1@nnrp1.deja.com>
In article <927424370.54516@localhost>,
zenin@bawdycaste.org wrote:
> armchair@my-dejanews.com wrote:
> >snip<
> : That's the point. I have to look into the object _every time_
> : to find out
> : what it's method returns. In C++ I can see that it returns a string,
> : number or OBJECT OF SPECIFIC TYPE - not just (void *) which is
> : what a Perl
> : reference amounts to.
>
> Bullshit. One word, "typedef".
C/C++ have typedef. What of it? Programmers can create infinite classes,
structs, and even use typedef to give different names to built-in types
ala "typedef long time_t;". So there could potentially be so many types
that the return type is meaningless. But to say that that is the case,
is an overstatement.
>
> In any C, C++, Java, <insert any language here> app much larger then
> Hello World you'll need to look up the docs for the method in
> question.
I would like to try and glean as much as I can from looking at the
program that has failed and I am trying to immediately fix to quell some
irate users.
>
> : I still may have to look at the object to determine
> : (or remember what I
> : determined last week) what the method does, but maybe not.
> : And seeing the
> : type will help me remember what I already learned about the method.
>
> my Dog $spot = new Canine;
You'll have to exlain the above statement. What is Dog? I assume Canine
is a Perl module/class/package. I have not seen this code. I have
written my $spot = Canine->new() and have also seen:
my $spot = new Canine;
>
> :> So in other words, knowing *only* whether something is a number, a
> :> string, or a reference is worthless information by itself. There's
> :> therefore no reason to force it to be derivable from the semantics
of the
> :> language.
> :
> : It's not worthless information to know that an object of type
DateTime is
> : being returned, versus a string that holds a date/time versus an int
that
> : is the seconds since 1/1/1970.
>
> DateTime mytime = TimeObject.getTime();
>
> So tell me, is mytime now an int, pointer to a string, object, a
> slice of cherry pie? Is it really "safe" to ever use DateTime in a
> way that isn't documented in the API, regardless of how much you
> think you know about its current implementation? Hint: it isn't, in
> *any* language.
Why would DateTime not be an object? I am saying DateTime as in - the
object that our/this/their shop uses for storing date/times.
>
>:And when a type is declared, and it doesn't match the expected type -
> : compile error in many cases - versus runtime error or bad results.
>
> As I've stated in other posts, you'll need to justify this paranoia
> with hard, Real World experience before your theories mean anything.
> So far it's your (very) limited Perl experience vs the experience of
> *thousands* of long time Perl users. So far you're batting
> zero... ('0 zero', '', 0, '0 but true', undef, ?).
>
I did a wc the other day and I am up to 2000 lines (counting comments
and blanks and { } etc., of Perl. If it wasn't for this thread I would
be well over a 100,000 by now! As far as my batting average being zero,
evidently you didn't realize it was returned as a string, and you
handled it like a number. FYI the value was "one thousand percent".
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 23 May 1999 16:32:07 GMT
From: billy_collins@my-dejanews.com
Subject: Re: Perl Tutorials
Message-Id: <7i9ai8$edj$1@nnrp1.deja.com>
Shit Neil, you made me regret buying my shitty Perl book..this tutorial
is NEAT!
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 23 May 1999 15:43:12 GMT
From: bkrapf9811@aol.com (BKrapf9811)
Subject: Puzzled? Subroutine Problem
Message-Id: <19990523114312.23703.00004008@ng-ci1.aol.com>
For some reason (I hope someone can tell me why), I get an error when ever I
try to execute the following script.
====== Here's the Script ========
#!/usr/bin/perl
require("cgi-lib.pl");
&ReadParse(*input);
$first=$input{'first'};
$last=$input{'last'};
$status=$input{'status'};
print "Content-type: text/html\n\n";
print"<HTML><HEAD><TITLE>test page</TITLE></HEAD>\n";
print"<BODY><P><B>ASCE Reserver02</B>";
print"<P>Your entered the following values:";
print"<P>$first<BR>$last<BR>$status";
print"</BODY></HTML>\n";
======== End Script =============
===== Here's the error ========
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to
complete your request.
Please contact the server administrator, root@localhost and inform them of the
time the error occurred, and anything you might have done that may have caused
the error.
===== End Error ===========
The error is in some way associated with my use of the ReadParse subroutine
from cgi-lib.pl. Because the script works correctly when I append cgi-lib.pl
to the end of the above script. @INC contain the following paths:
/home/httpd/cgi-bin
/usr/lib/perl5/i386-linux/5.00404
/usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux
/usr/lib/perl5/site_perl
I have tried saving cgi-lib.pl in at least three of the above locations, and I
still get the same error message. I have cgi-lib.pl saved with exec.
permission across the board. Can anyone tell me why I may be getting the error
message?
Thanks in advance,
Brian
------------------------------
Date: 23 May 1999 19:13:49 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: Sorting is too slow for finding top N keys... - UPDATE
Message-Id: <lz1zg7d7zm.fsf@linux_sexi.neuearbeit.de>
mriedel@neuearbeit.de (Marko R. Riedel) writes:
> michel.dalle@usa.net (Michel Dalle) writes:
>
> [SNIP]
> >
> > I'm not up to fully understanding the different algorithms used, but could
> > Marko's quick select implementation be improved in the same way as
> > you described for quicksort ?
> >
> [SNIP]
>
> The code included below might be a step in the right direction.
>
[SNIP]
The routine that I posted cannot be used when different objects are to
be considered equal for the purposes of sorting. The version included
below corrects this problem. The two traces should help explain the
algorithm that is used.
Marko R. Riedel
[SNIP] > qselect7demo.pl 20 1 8 11
constructing permutation ... done.
> 8 1 3 20 9 13 19 18 15 7 5 16 17 12 11 10 2 4 6 14
. 1 2 3 20 9 13 19 18 15 7 5 16 17 12 11 10 8 4 6 14
> 20 9 13 19 18 15 7 5 16 17 12 11 10 8 4 6 14
. 9 6 4 8 10 7 5 11 12 13 17 16 15 18 19 20 14
> 9 6 4 8 10 7 5 11 12
. 5 4 6 8 10 7 9 11 12
> 8 10 7 9 11 12
. 7 8 10 9 11 12
> 10 9 11 12
< 9 10 11 12
< 7 8 9 10 11 12
< 5 4 6 7 8 9 10 11 12
< 5 4 6 7 8 9 10 11 12 13 17 16 15 18 19 20 14
< 1 2 3 5 4 6 7 8 9 10 11 12 13 17 16 15 18 19 20 14
result: 9 10 11 12
[SNIP] > qselect7demo.pl 4 5 8 11
constructing permutation ... done.
> 3 2 1 4 1 3 4 2 2 1 4 3 3 4 2 1 3 2 1 4
. 1 1 1 1 1 2 2 2 2 2 4 3 4 3 3 4 4 3 3 4
> 4 3 4 3 3 4 4 3 3 4
. 3 3 3 3 3 4 4 4 4 4
> 3 3 3 3 3
. 3 3 3 3 3
< 3 3 3 3 3
< 3 3 3 3 3 4 4 4 4 4
< 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4
result: 2 2 3 3
#! /usr/bin/perl -w
#
sub qsel {
local ($aref, $min, $max, $lower, $upper) = @_;
local ($temp, $pivot, $i, $j, $pivlower, $pivupper);
return $aref if($lower>=$upper);
if($upper-$lower<=3){
my $maxpos;
for($i=$upper; $i>$lower; $i--){
for($maxpos=$lower, $j=$lower+1; $j<=$i; $j++){
$maxpos=$j if $$aref[$j]>$$aref[$maxpos];
}
if($maxpos!=$i){
$temp=$$aref[$i];
$$aref[$i]=$$aref[$maxpos];
$$aref[$maxpos]=$temp;
}
}
return $aref;
}
my $c01=$$aref[$lower] <=> $$aref[$lower+1];
my $c02=$$aref[$lower] <=> $$aref[$lower+2];
my $c12=$$aref[$lower+1] <=> $$aref[$lower+2];
my $median=0;
if(($c01!=1 && $c12!=1) ||
($c01!=-1 && $c12!=-1)){
$median=1;
}
if(($c02!=1 && $c12!=-1) ||
($c02!=-1 && $c12!=1)){
$median=2;
}
if($median){
$temp=$$aref[$lower];
$$aref[$lower]=$$aref[$lower+$median];
$$aref[$lower+$median]=$temp;
}
$pivot=$$aref[$lower];
$pivlower=$lower; $pivupper=-1;
$i=$lower+1; $j=$upper;
while($i<=$j){
while($i<=$j){
$c01=$$aref[$i] <=> $pivot;
last if $c01==1;
if($c01==-1){
$temp=$$aref[$i];
$$aref[$i]=$$aref[$pivlower];
$$aref[$pivlower]=$temp;
$pivlower++;
}
$i++;
}
while($i<=$j){
$c01=$$aref[$j] <=> $pivot;
last if $c01==-1;
if(!$c01){
$pivupper=$j if $pivupper==-1;
}
else{
if($pivupper!=-1){
$temp=$$aref[$j];
$$aref[$j]=$$aref[$pivupper];
$$aref[$pivupper]=$temp;
$pivupper--;
}
}
$j--;
}
if($i<=$j-1){
$temp=$$aref[$i];
$$aref[$i]=$$aref[$j];
$$aref[$j]=$temp;
}
}
$pivupper=$i-1 if $pivupper==-1;
&qsel($aref, $min, $max, $lower, $pivlower-1)
if $min<$pivlower;
&qsel($aref, $min, $max, $pivupper+1, $upper)
if $max>$pivupper;
return $aref;
}
MAIN: {
local ($min, $max)=@ARGV;
local ($size, @perm);
$|=1; $,=' ';
for ($size=0; <STDIN>; ) {
my ($value, $number) = /(\d+)\s+(\d+)/;
$perm[$size++] = $value while $number--;
}
print "$size\n";
print "@perm\n" if $size<=256;
&qsel(\@perm, $min, $max, 0, $size-1);
print "@perm[$min..$max]\n";
}
------------------------------
Date: Sun, 23 May 1999 12:39:26 -0500
From: "John Hilgedick" <jhilgedi@indiana.edu>
Subject: trouble with constants declared in a module
Message-Id: <7i9e1d$m56$1@jetsam.uits.indiana.edu>
I have a module called A.pm with the following lines:
package A;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(CONST1, CONST2);
use constant CONST1 => scalar 17;
use constant CONST2 => 23;
I also have a script with the following lines:
$tmp1 = $A::CONST1;
$tmp2 = $A::CONST2;
print "$tmp1 $tmp2";
Which has the effect of printing out "0 0" when I was expecting "17 23".
Any ideas what I'm doing wrong?
Thanks,
-john
------------------------------
Date: 23 May 1999 13:46:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: trouble with constants declared in a module
Message-Id: <x7g14nhe5y.fsf@home.sysarch.com>
>>>>> "JH" == John Hilgedick <jhilgedi@indiana.edu> writes:
JH> I have a module called A.pm with the following lines:
JH> package A;
JH> use constant CONST1 => scalar 17;
JH> use constant CONST2 => 23;
JH> $tmp1 = $A::CONST1;
JH> $tmp2 = $A::CONST2;
JH> print "$tmp1 $tmp2";
JH> Which has the effect of printing out "0 0" when I was expecting "17 23".
JH> Any ideas what I'm doing wrong?
the constant pragma creates subs with those names and that return the
constant value. they are not scalar variables so remove the $ from
$A::CONSTx and you will get your constants back.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 23 May 1999 15:00:58 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: wait(), zombies, and solaris: why won't my children die?
Message-Id: <slrn7kg61a.nis.sholden@pgrad.cs.usyd.edu.au>
Peter McMorran <mcmorran@norfolk.infi.net> wrote:
>In <slrn7k8fsh.p75.charlie@cs.ed.datacash.com>, on 05/20/99
> at 04:59 PM, charlie@antipope.org (Charlie Stross) said:
>
>>Is there something really weird about the way SIGCHILD is
>>handled on Solaris? A preliminary look at the manpages suggests
>>that there's a lot of extra information transmitted with
>>signals, and I'm scratching my head over where to begin.
>
>Yes. Signal handlers on Solaris only fire once. So, you need some
>trickery to cause the handler to re-establish itself for the next
>signal. Otherwise, the second SIGCHILD will take you down. This
>should be in the FAQs or docs, since it's such a common
>annoyance.
You mean like in the perlipc documentation which has the following line in
the signal handler examples...
$SIG{CHLD} = \&REAPER; # loathe sysV
--
Sam
Every human culture has good and bad points. Every computer program has
Eveone more bug. Even Perl.
--Larry Wall
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5758
**************************************