[7248] in Perl-Users-Digest
Perl-Users Digest, Issue: 873 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 15 11:08:58 1997
Date: Fri, 15 Aug 97 08:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 15 Aug 1997 Volume: 8 Number: 873
Today's topics:
Re: Begginner need simple script <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Re: Beginner...figured it out <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Binary I/O: simple question? (Peter E. Pulsifer)
Can you stop this leak?? (Jason A. Gibb)
Re: CGI.pm Button and Input text problems <vladimir@cs.ualberta.ca>
Re: Comma & Quotes delimited file (Aaron Sherman)
counter log <bja109@mail.usask.ca>
Re: emacs? No thank you (Chris Nandor)
Re: emacs? No thank you <clark@s3i.com>
Re: emacs? No thank you <kevinl@ascend.com>
File Locking... <dgm@globalnet.co.uk>
flushed exec termination (Robert Pepper)
fly, gd.pm help? <matt@geenite.demon.co.uk>
get a word from a file <bpatton@asic.sc.ti.com>
Re: Help with Regexp <jefpin@bergen.org>
Re: incredibly simple question (Nicholas J. Leon)
Re: Net::FTP documentation and examples <mb@sfb3.b.eunet.de>
Pass arguments to Perl (Wei Tang)
Re: Pattern matching problem (Aaron Sherman)
Perl 5.00[2 and 3] compile problems under SCO OSR 5.0.4 <scmckay@ix.netcom.com>
perl and oracle server <madernan@logica.com>
Re: perl output destroys hard drive ? (Bennett Todd)
piping process output to tk widget (John E. de Valpine)
Reading regexp from a file <M.Turcotte@icrf.icnet.uk>
Re: Seeking object enlightenment (Chris Nandor)
Re: We Need Help... (Bart Lateur)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Aug 1997 14:29:33 GMT
From: "Henry Wolff" <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Subject: Re: Begginner need simple script
Message-Id: <01bca987$34444620$b11de4cf@hatsoftnevada.lovelock.nv.us>
Thanks,
I had typed it in instead of cut-past so thats why the () instead of <> and
at 4am the old eyes are pretty bleary, brain too.
Your's looks 1000% better than what I finally figured out (two files). I
will go try it now.
Thanks again,
--
Henry Wolff
Star Trek Collectibles Trading Post
Free4All Classifieds, Clipart, Animations, Sounds, Fonts, Pictures and
more...
http://www.hatsoft.com/newtrek/index.html
------------------------------
Date: 15 Aug 1997 12:26:28 GMT
From: "Henry Wolff" <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Subject: Re: Beginner...figured it out
Message-Id: <01bca976$00b18400$b11de4cf@hatsoftnevada.lovelock.nv.us>
Well I used the ~= instead of EQ
I also made the 2 sets of variables into 2 files
and chopped the \n off and now it works fine
Thanks anyway,
Henry Wolff
Star Trek Collectibles Trading Post
Free4All Classifieds, Clipart, Animations, Sounds, Fonts, Pictures and
more...
http://www.hatsoft.com/newtrek/index.html
------------------------------
Date: 15 Aug 1997 10:23:09 -0400
From: pulsifer@ppdpi4.ppd.nrl.navy.mil (Peter E. Pulsifer)
Subject: Binary I/O: simple question?
Message-Id: <yat90y34jaq.fsf@ppdpi4.nrl.navy.mil>
As part of my intro to perl, I'm writing a Base64 decoder. The decoding
is easy, but now how do I get the results out? When I print, perl writes
the ASCII representation of the character, not the actual binary number.
That is, if the number I decode is 65, it writes '65', not 'A' as it ought.
I tried syswrite, but this does the same thing.
In desperation, I've tried masking each byte and concatenating into a string
using chr($num) - which I would think would be pretty slow. And perl 4
doesn't seem to recognize chr(). Is there a better/more universal way to
write in binary????
Thanks in advance for any assistance!
Peter Pulsifer [pulsifer@ppdu.nrl.navy.mil]
------------------------------
Date: Fri, 15 Aug 1997 09:24:11 -0500
From: jgibb@rrnet.com (Jason A. Gibb)
Subject: Can you stop this leak??
Message-Id: <jgibb-1508970924110001@news.rrnet.com>
The problem - An apparent memory leak in a non-forking perl chat server.
Every new client that connects increases sz by 1-2K, but this memory is
never released.
The diagnosis - My guess is that a new chatter object is being created by
Chatter->new() but is never actually destroyed when the client disconnects.
To test this theory I added a DESTROY method to print a message to stderr,
but it never gets called. Why this would be happening, I couldn't say.
Any ideas how to stop this leak?
The server code is below. (My thanks to Brian Slesinsky for coming up with
this code the first place.) Thanks for any help.
Jason A. Gibb
jgibb@rrnet.com
###########################################################################
#!/usr/local/bin/perl -w
# chat server - telnet to port 2323 to connect
require 5.002;
use strict;
use IO::Socket;
use IO::Select;
$| = 1;
my $listen = IO::Socket::INET->new( Proto => 'tcp',
LocalPort => 2323,
Listen => 1,
Reuse => 1) or die $!;
my $select = IO::Select->new($listen);
my @chatters;
$SIG{'PIPE'} = 'IGNORE';
open(STDERR, "> errorlog$$.txt") || die "cannot open error log: $!\n";
my @ready;
while(@ready = $select->can_read) {
my $socket;
for $socket (@ready) {
if($socket == $listen) {
my $new_socket = $listen->accept;
Chatter->new($new_socket, $select, \@chatters);
}
else {
my $chatter = $chatters[$socket->fileno];
if(defined $chatter) { &{$chatter->nextsub}(); }
}
}
}
package Chatter;
use strict;
sub new {
my($class,$socket,$select,$chatters) = @_;
my $self = { 'socket' => $socket,
'select' => $select,
'chatters' => $chatters };
bless $self,$class;
$chatters->[$socket->fileno] = $self;
$self->select->add($socket);
$self->ask_for_handle;
return $self;
}
sub socket { $_[0]->{'socket'} }
sub select { $_[0]->{'select'} }
sub chatters { $_[0]->{'chatters'} }
sub handle { $_[0]->{'handle'} }
sub nextsub { $_[0]->{'nextsub'} }
sub ask_for_handle {
my($self) = @_;
$self->write("choose a handle> ");
$self->{'nextsub'} = sub { $self->get_handle };
}
sub get_handle {
my($self) = @_;
my $handle = $self->read or return;
$handle =~ tr/ -~//cd;
$self->{'handle'} = $handle;
$self->broadcast("[$handle is here]");
$self->{'nextsub'} = sub { $self->chat };
}
sub chat {
my($self) = @_;
my $line = $self->read;
return if($line eq "");
$line =~ tr/ -~//cd;
my $handle = $self->handle;
$self->broadcast("$handle> $line");
}
sub broadcast {
my($self,$msg) = @_;
my $socket;
for $socket ($self->select->handles) {
my $chatter = $self->chatters->[$socket->fileno];
$chatter->write("$msg\r\n") if(defined $chatter);
}
}
sub read {
my($self) = @_;
my $buf="";
$self->socket->recv($buf,80);
$self->leave if($buf eq "");
return $buf;
}
sub write {
my($self,$buf) = @_;
$self->socket->send($buf) or $self->leave;
}
sub leave {
my($self) = @_;
print "leave called\n";
$self->chatters->[$self->socket->fileno] = undef;
$self->select->remove($self->socket);
my $handle = $self->handle;
$self->broadcast("[$handle left]") if(defined $handle);
$self->socket->close;
}
sub DESTROY {
# this is apparently never called...
print STDERR "DESTROY Method called.\n";
}
__END__
###########################################################################
------------------------------
Date: 13 Aug 1997 12:08:11 -0600
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: dcolli@casc.com wrote:
Subject: Re: CGI.pm Button and Input text problems
Message-Id: <omhgcu2bxx.fsf@tees.cs.ualberta.ca>
dcolli@casc.com wrote:
> > How do the variables get stored when reading input in the middle of a form
When the user calls your script with no params, presumably you output a form
and some fields. Then when the user submits the form, the params are gathered
by the browser and sent to the script mentioned in the ACTION of start_form
(by default, the same script). CGI.pm decodes these params and makes them
available to you in $query->param('foo') (or more conveniently, you can
import_names('Q') and then access them as $Q::foo). So it doesn't matter if
you mix up form output and param access, because you're getting the params
from the previous invocation, not from this one.
> > how do I make my buttons perform launching of other perl scripts ?
The easiest is to settle for simple URLs mentioning the other CGI script:
print a({href=>'http://foo.com/bar.cgi'},'Run bar');
If you really want to have buttons, put them in separate forms:
print startform(-action=>'http://foo.com/bar.cgi'),
submit(-name=>'Run bar'), endform;
(This code assumes you've done
use CGI qw(:all);
in which case you don't need to do "$query = new CGI" and don't need to
"$query->".)
------------------------------
Date: 15 Aug 1997 09:21:20 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Comma & Quotes delimited file
Message-Id: <5t1l4g$ar6@lorien.ajs.com>
David Phan <dphan@comsource.net> wrote:
>Hi,
>
>I need to translate a comma & quotes delimited file into a comma
>separated list.
Check out Text::ParseWords.
-AJS
------------------------------
Date: 15 Aug 97 14:33:17 GMT
From: "Bobbi Arlett" <bja109@mail.usask.ca>
Subject: counter log
Message-Id: <01bca987$a367cfe0$b1b853cc@mucc99>
Could anyone tell me how to change IP addresses to host names in a perl
script for windows NT? I tried nslookup but the version I have doesn't
work.
Please respond via e-mail.
Thanks,
Bobbi Arlett
bja109@mail.usask.ca
------------------------------
Date: Fri, 15 Aug 1997 08:12:48 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: emacs? No thank you
Message-Id: <pudge-ya02408000R1508970812480001@news.idt.net>
In article <33F37637.68D6@rkymtnhi.com>, Kenneth Vogt
<KenVogt@rkymtnhi.com> wrote:
# When I use the word ugly, I mean it is difficult to use. I did not mean
# that it is aesthetically unpleasant (although it is that too ;).
# Functionality and easy of use are not mutually exclusive. (In fact,
# they just might be the same thing!)
I was just arguing the opposite last night. No, functionality and ease of
use are usually NOT the same thing at all. Emacs is one of the most
powerful and functional programs in existence. You can use it for FTP,
gopher, WWW, mail, editing, compiling ... and it does it all well. But it
is hard to figure out how to do it all. Very functional, not very good UI.
A Microsoft employee must have written it.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: 15 Aug 1997 08:15:00 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: emacs? No thank you
Message-Id: <dzpqjtzgb.fsf@s3i.com>
Kenneth Vogt <KenVogt@rkymtnhi.com> writes:
> Gabor wrote:
> >
> > Kenneth Vogt (KenVogt@rkymtnhi.com) wrote:
> >
> > : Thanks to everyone that suggested emacs for Windows. However, it is one
> > : of the UGLIEST things I have ever seen! (I'm not trying to start an
> >
> > There are things in life that should be pretty. An editor is not one
> > of them. I expect an editor to be functional, don't you?
>
> When I use the word ugly, I mean it is difficult to use. I did not mean
> that it is aesthetically unpleasant (although it is that too ;).
> Functionality and easy of use are not mutually exclusive. (In fact,
> they just might be the same thing!)
Well, I'm responding to you in emacs, and I think it looks pretty, with all
the colors and stuff. I can do practically anything within my window, and
don't have to use the damn mouse very often.
emacs has a steep learning curve, tis true. But once you've learned
it, it will do everything but slice bread. And anything that it
doesn't do, you can teach it.
I have found emacs to be spectacular for programming perl, with it's
auto-indentation, coloring, and, especially, ability to match parens
and braces. When you add perldb, and the ability to see the code as
you're debuggin, it's indispensible.
--
Clark Dorman "Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html -Francis Crick
------------------------------
Date: 15 Aug 1997 08:56:27 -0400
From: Kevin Lambright <kevinl@ascend.com>
Subject: Re: emacs? No thank you
Message-Id: <yhfen7vd2pw.fsf@ascend.com>
Kenneth Vogt <KenVogt@rkymtnhi.com> writes:
>
> When I use the word ugly, I mean it is difficult to use. I did not mean
> that it is aesthetically unpleasant (although it is that too ;).
> Functionality and easy of use are not mutually exclusive. (In fact,
> they just might be the same thing!)
Ken,
This is definately my last attempt to try to sway you (obviously, I am
partial to emacs). Is emacs on Win95/NT any more difficult to use than
on [pick your flavor of] Unix?
Before you close your mind to emacs, try something. Pull a Perl script
into emacs (something of significance would work best, but anything will
do) and run the Perl debugger from Emacs (M-x perldb). Even if you don't
want to use emacs to edit the files (although, personally, I could not
live without it), this has to be one of the best features of the emacs/Perl
environment there is! I assume you have used the perl debugger before, if
not, type 'h' to get a list of all the commands. All debugger commands
are available. Plus, you now have just about everything you would want
in and IDE (because, that's really what emacs is, it just may not have
all the window dressing that some other IDE's do). If you have ever
used the Perl debugger from the command line (where it shows you one
line of source code at a time as you execute - although you can list
any portion of souce and get windows of code...), it is like the difference
between night and day.
Some features I like best about the Perl/emacs/debugger combination.
While editing:
- Performs proper indenting according to configurable rules.
- Key word highlighting and coloring in Perl mode.
- Brace, Paren, etc. matching - makes a big difference.
- probably some other things I can't think of right now.
While debugging:
- Pulls in source and, in a split screen shows the line of source
code while you step through it. It will automatically visit
all files necessary as you step through, so you really see what
is going on.
- Ability to search back in the debugger command stack and yank
whatever I need to back to the current command prompt.
- Using 'x' to view large data structure is easy because of emacs
search capabilities.
- Ability to immediatly edit the source file while still in the
debugger when I have found a problem.
- Setting breakpoints is trivial - find the line you want to
break on and type C-x <space>.
- other nifty features.
I'm sure there are editors for Win95/NT that have some of the same features
that I listed for editing files with emacs, but I doubt you will find one
that has the kind of seamless integration that emacs has with the Perl
debugger.
I know emacs is somewhat difficult to use in the beginning, but I believe
the rewards for some initial pain will be tremendous. Emacs also has one
of the best online help systems I have seen - not only info files that
go into great detail about the subject, but describing key combinations,
apropos help, etc. (I don't know how much of the info files are
avaible on Win95/NT).
Anyhow, good luck in your search for a better IDE on Win95. I jus wanted
to let you know some of the benefits of using emacs. Ultimately, you have
to feel comfortable with the editor you choose.
Sorry for the bandwidth, but I wanted to make sure you gave emacs a fair
shake before discarding it as a choice. If you already have, then my
apologies.
Kevin
--
------------------------------------------------------------------------------
Kevin Lambright email: kevinl@casc.com
Ascend Communications voice: 508-952-7407
1 Robbins Road fax: 508-692-1510
Westford, Ma. 01886
------------------------------
Date: 15 Aug 1997 12:50:15 GMT
From: "David Mellors" <dgm@globalnet.co.uk>
Subject: File Locking...
Message-Id: <01bca979$832af9e0$4f577ec2@interlink>
Does perl automatically lock files when writing to them?
If not, can anyone supply information on the best way of locking files
using Perl running under Linux and BSDI.
Many Thanks
Dave Mellors
dgm@globalnet.co.uk
------------------------------
Date: Fri, 15 Aug 1997 12:34:22 GMT
From: robert@netcat.co.uk (Robert Pepper)
Subject: flushed exec termination
Message-Id: <33f44adf.368115962@news.pi.net>
This code, run on my NT 4.0 SP3 server should fail the first time
round because I don't have a 'pwded' exe on my box:
exec("pwded");
print "\n\nResult1: $!\n\n";
exec("vol");
print "\n\nResult2: $!\n\n";
but it doesn't. Result1 is nothing. Or rather, it is buffered
because if I print it twice it comes out the second time. Setting
$|=1 at the top of the script hasn't made any difference, so I'm not
sure which filehandle I need to select. So that's my first question -
what do I need to unbuffer, and how do I do it ?
Incidentally, if I change the first print line to :
print "\n\nResult1:",$!,"\n\n";
then it prints $! as expected - because <theory>this actually prints
three seperate items, thereby forcing the buffer ?</theory>.
Secondly, the second exec doesn't terminate the script. The second
print statement is executed, and it shouldn't be because exec vol is
successful. I thought exec terminated the script when sucessful.
Anyone know why ?
I tried on an Irix box with pwd instead of vol and it behaved as
expected, terminating the script after the sucessful exec and not
needing $|=1.
Anyone got any idea what's happening here ?
tia
--
Robert Pepper <robert@netcat.co.uk>
http://www.netcat.co.uk/rob/
------------------------------
Date: Fri, 15 Aug 1997 15:21:10 +0000
From: Matthew Knight <matt@geenite.demon.co.uk>
Subject: fly, gd.pm help?
Message-Id: <33F473E6.71E4@geenite.demon.co.uk>
hi
can anyone who is familiar with gd.pm or fly give me a run down on how
to install it on a unix machine. i'm a mac user, and although i have
macperl running fine, there aren't ports to the mac for these - and i
need to work out how to use either module.
thanks
email me the address below
Matthew knight
matt@geenite.demon.co.uk
------------------------------
Date: 15 Aug 1997 12:54:19 GMT
From: Billy Patton <bpatton@asic.sc.ti.com>
Subject: get a word from a file
Message-Id: <5t1jhr$hi1$1@spock.asic.sc.ti.com>
need a subroutine that will get the next word from an ascii file
by passing it the file descriptor , starting delimiter and ending delimiter
does anyone have anything they wish to let me plagerize?
--
|+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
| "I don't have the chicken pox anymore daddy, see. They didn't |
| like me and flew away!" My daughter, age 3 |
| Billy N. Patton |
| bpatton@asic.sc.ti.com |
| 214-480-4455 |
| Texas Instruments, Inc. |
| Semiconductor Group |
| Application Specific Integrated Circuit (ASIC) |
| Hardware Engineering Services |
| Dallas Texas |
|+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
------------------------------
Date: Fri, 15 Aug 1997 08:12:23 -0400
From: Anagrams of the Word 'A' <jefpin@bergen.org>
To: Sajjad Lateef <sajjad@uic.edu>
Subject: Re: Help with Regexp
Message-Id: <Pine.SGI.3.95.970815081120.11143C-100000@vangogh.bergen.org>
>I thought that /(\w*:?\/?-?\s*)*/ would do the trick.
>I get a message (warning?) that it matches null strings many times.
>And, of course, it does not do what I want it to do.
The main problem I see is that you are using an asterisk, which matches
any number of matches (including 0), when you should be using a +, which
matches 1 or more hits.
----------------
| "Here we are now, entertain us!"
| - Nirvana
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem? Let me know!
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
------------------------------
Date: 15 Aug 1997 12:57:36 GMT
From: nicholas@neko.binary9.net (Nicholas J. Leon)
Subject: Re: incredibly simple question
Message-Id: <slrn5v8kht.aet.nicholas@neko.binary9.net>
>There's a space between = and ~ it's =~ You might want to say
>
> chomp ($resp = <STDIN>);
> if (lc $resp qe 'y') {
> # that's Y or y
> }
> else {
> # it's not
> }
>
>note that /^y+/i will allow them to enter anything beginning with a y and
>succeed.
Doesn't
$resp=~/^y+/i
actually mean any number of "y"s?? Such as "yyyy" or "yyyyyyy", but
not "yes". Wouldn't something like:
$resp=~/^y/i
be more appopriate?
------------------------------
Date: Fri, 15 Aug 1997 15:35:13 +0200
From: Mattias Brunschen <mb@sfb3.b.eunet.de>
Subject: Re: Net::FTP documentation and examples
Message-Id: <33F45B11.2AC38E9F@sfb3.b.eunet.de>
Parillo wrote:
> : For docs, try perldoc Net::FTP. Look for "Debug" in it. If that's
> : not enough, see my statement above.
I tried it, but the only response is
"No documentation found for 'Net::FTP'"
Could you please just post a www-link or something like that
where to find the docs ?
Thank you.
Mattias
------------------------------
Date: 12 Aug 1997 18:06:50 GMT
From: wtang@cs.ualberta.ca (Wei Tang)
Subject: Pass arguments to Perl
Message-Id: <5sq8nq$m2a$1@scapa.cs.ualberta.ca>
Hi,
Could someone tell me how to pass command-line arguments in Perl? Will
$ARGV work?
Please CC wtang@cs.ualberta.ca
------------------------------
Date: 15 Aug 1997 09:09:55 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Pattern matching problem
Message-Id: <5t1kf3$ap9@lorien.ajs.com>
Tom Phoenix <rootbeer@teleport.com> wrote:
>On 12 Aug 1997, CPT wrote:
>
>> if ($_ =~ /$dept/) {
>
>Did you mean to use the data read from the first file as a regular
>expression? Your code would be safer if you use index, if that will do
>what you need. (A badly-formed regular expression could crash your
>program. And this is slower and less efficient than using index.) But
>since I don't know what you're trying to do, I can't say exactly what you
>should do.
Index is the right thing here, but I should point out that "crash" is
probably the wrong word. Perl will give you an error, and exit, but it
does nto crash per se, if you, say, have unbalanced parens in the regex.
To be safe, you can always \Q. eg;
if (/\Q$dept/) {
}
------------------------------
Date: Fri, 15 Aug 1997 09:59:22 -0400
From: McKay <scmckay@ix.netcom.com>
Subject: Perl 5.00[2 and 3] compile problems under SCO OSR 5.0.4
Message-Id: <33F460B9.E32CD1F5@ix.netcom.com>
Has anyone attempted to compile Perl 5.003 with SCO Development
package. I actually run into the same problem when compiling 5.002.
This following are the last few lines before it fails:
cc -o miniperl miniperlmain.o libperl.a -lintl -lsocket -lnsl
-lndbm -
ldbm -lld -lm -lc -lcrypt -lPW -lx
./miniperl configpm tmp
sh mv-if-diff tmp lib/Config.pm
File lib/Config.pm not changed.
./miniperl -Ilib pod/pod2html.PL
*** Termination code 139 (bu21)
I do not know what the "*** Termination code 139 (bu21)" mean. Can
someone give me a hand or e-mail me their config.sh to address
scmckay@ix.netcom.com
Thanks in advance!
--
"GOD is dead
And no one cares
If the is a hell
I'll see you there" - NIN
------------------------------
Date: 15 Aug 1997 13:49:44 GMT
From: "Nicola Maderna" <madernan@logica.com>
Subject: perl and oracle server
Message-Id: <01bca982$13d68600$8c22ea9e@UKP013657.logica.co.uk>
Guess that I want to acces an oracle 7 dbase from some intranet pages.
I have 3 machines: a pc with a browser on, an HTTP server on a machine and
a oracle server on the 3rd one.
It's not a problem, right? since the browser is accessing the http server
with a script that is accessing the DB client that is accesing the db
server.
is it right, or it doesn' t work like that?
I hope someone can confirm it or tell me how it works.
bye
nicola
madernan@logica.com
------------------------------
Date: 15 Aug 1997 13:39:46 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: perl output destroys hard drive ?
Message-Id: <slrn5v8n0v.in2.bet@waltz.rahul.net>
On Thu, 14 Aug 1997 10:55:28 -0500, Thaddeus Wakefield Batt <thaddeus@activework.com> wrote:
>running perl 5.002 under RedHat Biltmore 4.2 [...]
Why use 5.002? The perl that comes with Red Hat 4.2 is 5.003; and a 5.004 RPM
is a piece of cake to create from the 5.003 SRPM; I'll append spec file diffs
for the SRPM I'm using now after my .sig.
>i have a script that looks to a very large raw file for it's source and from
>that file it parses out approximately 100,000 separate files and puts them in
>a directory structure [...] it mostly works, and the file permissions on 95%
>of the files are as follows:
>
>-rw-r--r-- 1 prodmgr users 681 Aug 13 18:03 100333.tag
>
>however, a *few* files show up with very bizare permissions such as:
>
>?--x--Sr-T 10 sync games 655380 Jan 1970 296601.tag
>br-xr-s--t 5 root root 30658 103, 97 Oct 8 2031 296701.tag
>drwxr-xr-x 2 prodmgr users 15360 Aug 13 14:18 295636.tag
>
>these files cannot be removed by root and when fsck is run it reports bad
>superblocks on the drive.
Yecch! If you're really using Perl 5.002, then you don't have a normal
up-to-date Red Hat 4.2; if I were you I'd back up the things I'd added to the
system, then do a complete reinstall from scratch.
If you can still reproduce this problem then I'd send off complete details to
Red Hat, and to <linux-kernel@vger.rutgers.edu> (from
/usr/src/linux/MAINTAINERS). Complete details would include your exact OS and
how you configured and installed it (e.g. kernel config file if you did a
custom kernel build), hardware platform, and example code that can reproduce
the problem. Sounds like there's a bug somewhere. But Linux is well-enough
tested that I'd 'spect the bug lies in your config --- especially since you
have perl 5.002 on a Red Hat 4.2 system.
Mean while, if you wanted to reduce the odds of this happening again, I'd say
tuck a coupe of hacks into your file-writing loop; maybe sync the filesystem
every hundred file writes or so? Maybe take a 100ms nap every once in a while?
If you have in fact stumbled across a reall filesystem implementation bug that
sort of thing should let you avoid tickling it. But it seems to me that your
I/O pattern (create a bunch o' directories then populate them with many
bunches o' files) is pretty common. Besides archive unpackers (e.g. tar,
cpio), there's writing the terminfo database by tic(1), populating compiled
man page heirarchies, and so on.
-Bennett
--- perl-5.003.spec Fri Aug 15 09:24:02 1997
+++ perl-5.004.spec Fri Aug 15 09:24:45 1997
@@ -1,80 +1,89 @@
Summary: Practical Extraction and Report Language
Name: perl
-Version: 5.003
-Release: 8
+Version: 5.004_01
+Release: 1
Copyright: GPL
Group: Utilities/Text
-Source: ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0/perl5.003.tar.gz
-Patch: perl-5.003-security.patch
+Source: http://www.perl.com/CPAN/src/5.0/maint/perl5.004_01.tar.gz
Requires: csh
+Packager: Timo Karjalainen <timok@iki.fi>
%description
Perl is an interpreted language optimized for scanning arbitrary text
-files, extracting information from those text files, and printing reports
-based on that information. It's also a good language for many system
-management tasks. The language is intended to be practical (easy to use,
-efficient, complete) rather than beautiful (tiny, elegant, minimal).
+files, extracting information from those text files, and printing
+reports based on that information. It's also a good language for many
+system management tasks. Perl is intended to be practical (easy to
+use, efficient, complete) rather than beautiful (tiny, elegant,
+minimal). It combines (in the author's opinion, anyway) some of the
+best features of C, sed, awk, and sh, so people familiar with those
+languages should have little difficulty with it.
%changelog
-* Tue Apr 22 1997 Erik Troan <ewt@redhat.com>
+* Tue Jun 17 1997 Timo Karjalainen <timok@iki.fi>
+ - Updated to 5.004_01
-- Incorporated security patch from Chip Salzenberg <salzench@nielsenmedia.com>
-
-* Fri Feb 07 1997 Erik Troan <ewt@redhat.com>
-
-1) Use -Darchname=i386-linux
-2) Require csh (for glob)
-3) Use RPM_ARCH during configuration and installation for arch independence
+* Sat May 24 1997 Manoj Kasichainula <manojk@io.com>
+ - Added optimization & perladmin
+ - Removed binary compatibility
+ - Added backreference regex patch from comp.lang.perl.announce
%prep
-%setup -n perl5.003
-%patch -p0 -b .security
+%setup -n perl5.004_01
%build
# Perl doesn't find dlopen() in /lib/libdl.so, so we have to force it to.
-sh Configure -des -Dprefix=/usr -Darchname=${RPM_ARCH}-linux -Dd_dosuid
+./Configure -des -Dprefix=/usr -Darchname=${RPM_ARCH}-linux -Dd_dosuid \
+ -Doptimize="$RPM_OPT_FLAGS" -Dperladmin='root+perl@localhost' \
+ -Ud_bincompat3
make
-# Strip binaries (done now rather than at install)
-strip perl
-strip suidperl
-strip x2p/a2p
-
%install
-
rm -rf /usr/lib/perl5
make install
-install -m 755 utils/pl2pm /usr/bin/pl2pm
-#install -s -m 6755 suidperl /usr/bin/suidperl
(cd /usr/include ; h2ph *.h sys/*.h linux/*.h asm/*.h)
# Fix the header file that declares NULL...
+
sed 's/( \&void \*) //' \
-/usr/lib/perl5/${RPM_ARCH}-linux/5.003/linux/posix_types.ph > /tmp/$$.change
-mv -f /tmp/$$.change /usr/lib/perl5/${RPM_ARCH}-linux/5.003/linux/posix_types.ph
+/usr/lib/perl5/site_perl/${RPM_ARCH}-linux/linux/posix_types.ph > /tmp/$$.change
+mv -f /tmp/$$.change /usr/lib/perl5/site_perl/${RPM_ARCH}-linux/linux/posix_types.ph
+strip /usr/bin/{a2p,perl5.00401,sperl5.00401}
+ln -sf perl5.00401 /usr/bin/perl
+ln -sf sperl5.00401 /usr/bin/suidperl
%files
-/usr/bin/sperl5.003
-/usr/bin/perl5.003
-/usr/bin/suidperl
+%doc Artistic Changes README Todo
+/usr/bin/perl5.00401
/usr/bin/perl
/usr/bin/a2p
/usr/bin/c2ph
-/usr/bin/pstruct
-/usr/bin/s2p
-/usr/bin/find2perl
-/usr/bin/h2xs
/usr/bin/h2ph
-/usr/bin/pl2pm
+/usr/bin/h2xs
+/usr/bin/perlbug
/usr/bin/perldoc
+/usr/bin/pl2pm
+/usr/bin/s2p
+/usr/bin/find2perl
/usr/bin/pod2man
/usr/bin/pod2html
/usr/bin/pod2latex
+/usr/bin/pod2text
+/usr/bin/pstruct
+/usr/bin/sperl5.00401
+/usr/bin/suidperl
+/usr/bin/splain
/usr/lib/perl5
-/usr/man/man1/a2p.1
-/usr/man/man1/s2p.1
/usr/man/man1/perl*.1
+/usr/man/man1/pl2pm.1
+/usr/man/man1/c2ph.1
+/usr/man/man1/h2ph.1
+/usr/man/man1/h2xs.1
+/usr/man/man1/s2p.1
+/usr/man/man1/a2p.1
+/usr/man/man1/pod2man.1
+/usr/man/man1/pstruct.1
+/usr/man/man1/xsubpp.1
------------------------------
Date: 15 Aug 1997 14:28:20 GMT
From: jedev@visarc.com (John E. de Valpine)
Subject: piping process output to tk widget
Message-Id: <5t1p24$vv@fridge-nf0.shore.net>
Hi:
I am trying to write a tool that will run several processess at the same
time, where the output for each process is then written to its own
personal tk "text" widget. The problem that I am currently having is that
once the processes finish the perl program seems to try to use as much
CPU as it can, and the interaction in the tk text widgets is very
sluggish. I wrote program in TCL/TK that does the same thing and it works
great.
I believe that the problem may be in the "fileevent" call (tk) which does
file event handling. This call waits for a pipe to be operated on and
then performs some task. If I understand correctly "fileevent" is a hook
into select. Could this type of file event handling be created by using
the four arg version of select()? If so can some one give an example?
Any help would be greatly appreciated.
-Jack de Valpine
Here is the code that I have created:
#!/usr/bin/perl
use Tk;
select(STDOUT); $| = 1;
my $top = MainWindow->new;
#Runs 2 copies of ls
&setupProcs("ls -1 /",2);
my $quit = $top->Button(-text => 'Quit', -command => \&exit)->pack;
MainLoop();
#builds enough text widgets for the number of procs being run
#then runs the procs
sub setupProcs {
local($command,$quantity) = @_;
local($count) = 0;
@text = ();
while ($count < $quantity) {
my $frame = $top->Frame->pack(-side => 'left');
my $proc = $frame->Text(-width => 15, -height => 4)->pack(-side
=> 'top');
my $data = $frame->Text(-width => 15, -height => 16)->pack;
$#text = $count;
$text[$count] = [$proc, $data];
$count++;
}
$count = 0;
@test = ();
while ($count <= $#text) {
print "$text[$count]\n";
$#test = $count;
$test[$count] = &startProc($command,$count,$text[$count]);
$count++;
}
$count = 0;
while ($count <= $#test) {
print "$test[$count]\n";
$count++;
}
print "DONE\n";
}
#starts the actual process with its own pipe
#creates a file event handler for the pipe
sub startProc {
local($command,$count,@text) = @_;
$pipe = join('_',"MAKE",$count);
$make = open($pipe, "$command|");
$proc = $text[0][0];
$proc->insert('end',"$make: $count");
$data = $text[0][1];
$top->fileevent($pipe,'readable',[\&printProc, $pipe, $data]);
return($make);
}
#prints output from the pipe to a text widget
sub printProc {
local($pipe,$frame) = @_;
$line = <$pipe>;
print $line;
$frame->insert('end', $line);
$frame->see('end');
}
------------------------------
Date: 15 Aug 1997 09:52:19 +0100
From: Marcel Turcotte <M.Turcotte@icrf.icnet.uk>
Subject: Reading regexp from a file
Message-Id: <y7wd8nfrfp8.fsf@fir.lif.icnet.uk>
Hello!
I wrote a gateway program and I would like to have a configuration
file containing a list of regular expressions that will serve to
filter incomming requests, so far I am able to pass a regexp as an
argument (see test 2) but can't read them from a file.
Any help would be greatly appreciated!
Here's the code:
----------------------------------------------------------------------
#! /usr/sbin/perl
($ip0) = @ARGV;
open(CONF, "< gw.conf") || die "Can't open gw.conf file $!";
while (<CONF>) {
next if (/^#/ || /^$/);
push(@filter,$_);
}
close(CONF);
$ip = "127.0.0.1";
print "test 1\n";
for (@filter) {
print $_ if $ip =~ /$_/;
}
printf "test 2\n";
print $ip if $ip =~ /$ip0/;
Here's gw.conf
----------------------------------------------------------------------
#
^127\.0\.0
^127\.227\.
----------------------------------------------------------------------
Cheers!
--
Marcel Turcotte Biomolecular Modelling Laboratory
[44|0]-171-269-3023/3479 Phone/Fax Imperial Cancer Research Fund
M.Turcotte@icrf.icnet.uk 44 Lincoln's Inn Fields (Room G17)
http://bonsai.lif.icnet.uk/people/turcotte London WC2A 3PX, England
--
Marcel Turcotte Biomolecular Modelling Laboratory
[44|0]-171-269-3023/3479 Phone/Fax Imperial Cancer Research Fund
M.Turcotte@icrf.icnet.uk 44 Lincoln's Inn Fields (Room G17)
http://bonsai.lif.icnet.uk/people/turcotte London WC2A 3PX, England
------------------------------
Date: Fri, 15 Aug 1997 08:25:01 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Seeking object enlightenment
Message-Id: <pudge-ya02408000R1508970825010001@news.idt.net>
In article <33f4d3ad.12401882@news1.radix.net>, scott@radix.net (Scott
Houck) wrote:
# Perhaps part of the obscurity (What? Perl obscure?) lies in the
# choice of the word "bless" to do this. Is this an OOP term? I never
# heard of it before. But you all act like this is the most natural
# association in the world! :-)
Well, I'd never done OOP before Perl, and I confess a certain personal
confusion surrounding all the elements of it: packages, classes, et al.
But now that I nearly fully understand the "magic," I now understand more
fully OOP of other languages (Java, NewtonScript, etc.).
Maybe the vocab is not what you expect or like. But the damage is done.
The best way to figure it out is as you would anything: dig in and learn
it. Once you "get it," it won't matter anymore. I don't know enough about
OOP and I wasn't around when it happened to Perl, so I can't give reasons
why. But I can say that I don't think that at this point it matters.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Fri, 15 Aug 1997 12:57:39 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: We Need Help...
Message-Id: <33f451fb.12830534@news.tornado.be>
Tom Grydeland <tom@mitra.phys.uit.no> wrote:
>jhurff@resourcecenter.com (James Hurff) writes:
>
>> to develop a Perl utility to make a socket connection with an NNTP
>> server and upload or download news articles to a specified NNTP sever.
>
>It should be fairly simple using Net::NNTP
>
>(I sincerely hope you're not going to use this for spamming.
> You're not going to spam us, are you?)
Maybe something could be included in the license agreement. "This
software may not be used for spamming purpouses.". Just a thought.
Bart.
------------------------------
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 873
*************************************