[6699] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 324 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 17 13:17:45 1997

Date: Thu, 17 Apr 97 10:00:27 -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           Thu, 17 Apr 1997     Volume: 8 Number: 324

Today's topics:
     Re: [Q] How to capitilize beginning of words <dorman@s3i.com.anti-spam>
     Re: Bug in Regexp? (Bob Wilkinson)
     Re: Change password in /etc/shadow via script <minaret@sprynet.com>
     client timing out (Jeff Stampes)
     Re: Code without comments (Was: Re: Unix and ease of us carsonw@technologist.com
     Re: display local directory (ALASTAIR AITKEN CLMS)
     Re: display local directory (Bob Wilkinson)
     Re: exec "exit" <minaret@sprynet.com>
     Re: Good editor for W95? (Dave Thomas)
     Re: Good editor for W95? <emehenk@rioja.ericsson.se_nojunk_>
     Re: Good editor for W95? <emehenk@rioja.ericsson.se_nojunk_>
     Re: Good editor for W95? ()
     Re: How do I randomly re-order the lines of a file? <merlyn@stonehenge.com>
     Re: How to prevent DOS box from Win32 perl? (Eric Bohlman)
     Re: How to set the time? <minaret@sprynet.com>
     HTML Parser anywhere ? <emehenk@rioja.ericsson.se_nojunk_>
     Re: Inseting into a specific part of text.. <minaret@sprynet.com>
     Re: Looking for a flexible string substitution script (Andrew Allen)
     Re: Newbie Question: regexp email address.. <seay@absyss.fr>
     NT Administration question <Regis.Cosnier@irisa.fr>
     Re: NT heart characters? (Eric Bohlman)
     Re: Ousterhout and Tcl lost the plot with latest paper (ozan s. yigit)
     Re: Ousterhout and Tcl lost the plot with latest paper (Mike Meyer)
     Re: Palindromic words search??? (David Alan Black)
     Re: Palindromic words search??? (ALASTAIR AITKEN CLMS)
     Re: Palindromic words search??? (David Alan Black)
     Re: perl and multithreading <scottg@fusionmm.com>
     Re: Printing X amount of lines from begining/middle of  (ALASTAIR AITKEN CLMS)
     Re: Q:calling perl script into JavaScript? ()
     Re: Strings as a uniform representation & tcl (Charles Lin)
     Re: Transliterate from a pattern? <tchrist@mox.perl.com>
     Re: Unexpected Behavior using open () (Andrew M. Langmead)
     Re: Unix and ease of use  (WAS: Who makes more ...) (James Youngman)
     Re: Unix and ease of use  (WAS: Who makes more ...) (James Youngman)
     Re: What does "UNIX" stand for.. <seay@absyss.fr>
     Re: What does "UNIX" stand for.. (Ralph Silverman)
     Re: XS and C structures... <minaret@sprynet.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 17 Apr 1997 11:35:19 -0400
From: Clark Dorman <dorman@s3i.com.anti-spam>
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <div1laci0.fsf@s3i.com>


Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc, brian@brie.com (Brian Lavender) writes:
> :On 15 Apr 1997 16:59:59 GMT, Tom Christiansen <tchrist@mox.perl.com>
> :wrote:
> :
> :>You have asked a question or talked about an issue that's specifically
> :>addressed in the Perl Frequently Asked Questions list.
> :>
> :>    http://www.perl.com/perl/faq/
> :>
> :>Here's just the list of questions:
> :>
> :>--> How do I capitalize all the words on one line? <=== This is a hypertext link in the faq
> :
> :I followed Tom's advice regarding your answer to this question and I
> :have to say my search led me nowhere. When you click on this question
> :it leads you to
> :
> :http://www.perl.org/CPAN/doc/manual/html/pod/
> :
> :at the top of the page. 
> :
> :Needless to say I could keep on reading, but the answer seems quite
> :buried making this faq rather useless. It would be nice to see a
> :simple code example. 

Well, it is a long document.  Most browsers have a "Find" button that
does searches for you.

[snip]
> 
> Start at 
> 
>     http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq.html
> 
> and figure it out.  I'm really tired of doing everyone else's
> homework for them.   Why do you think I wrote the FAQ, just
> so you don't have to read it?
> 
> Wrong.

Tom,
	The location 

	http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq.html

works great.  

But, I thought you should know that when you go to:

	http://www.perl.com/perl/faq/

and hit the "html format", you (at least I) go to

	http://www.perl.org/CPAN/doc/FAQs/FAQ/PerlFAQ.html

[This single page nicely contains all the information from all the
faqs.  Thank you, it is very good and helpful.  Please don't think you
are not appreciated.  Brian could have done a word search, and quickly
and easily found his answer.]

However, the links on this page, i.e. at 

	http://www.perl.org/CPAN/doc/FAQs/FAQ/PerlFAQ.html

do not work properly, as they link to the page 

	http://www.perl.org/CPAN/doc/manual/html/pod

and the specific question "How do I capitalize all the words ..."
links to

http://www.perl.org/CPAN/doc/manual/html/pod/#How_do_I_capitalize_al_the_word

and this does not exist.  What you get is an html format of the
results of "man perl", which is what I gather Brian was saying in his
own manner.

-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


------------------------------

Date: Thu, 17 Apr 1997 16:40:28 +0100
From: b.wilkinson@NOSPAM.pindar.co.uk (Bob Wilkinson)
Subject: Re: Bug in Regexp?
Message-Id: <b.wilkinson-1704971640280001@ip57-york.pindar.co.uk>

In article <33556BA9.FEB@ice-t.com.au>, hcurrie@ice-t.com.au wrote:

> Hi there,
> I have a scalar that has about 34k of text (html) in it. I run the
> Regexp
> $s =~ /<[ \t\n]*body([ \t\n][^>]*)?>((\n|.)*)<[ \t\n]*\/body[ \t\n]*>/i;
> over it, and $2 which I expect to have the body of my html document in
> it,
> retrns '2' if I cut out some of the source file, everything works well.
> (30k seems fine.) Is this a bug? Does Perl have a limit on the size of
> data 
> it can process with Regex? Can anyone suggest a workaround? 
> 

>From the BUGS section of "man perl"

A regular expression may not compile to more than 32767 bytes internally.

I think that this is what you are seeing.

Bob

-- 
I have become death, destroyer of the worlds.


------------------------------

Date: 17 Apr 1997 14:46:52 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Change password in /etc/shadow via script
Message-Id: <01bc4b3e$0b00f940$2a6aafce@cactus>

> Does anybody know a PERL script that allows the changing of a user's
password
> directly in the /etc/shadow file? I need this to create a HTML form for
individual
> users to change their password without telnet or something like this .

After you prompt the user for their name, old password and new password,
set up a pipe to the "passwd" program.  You will provide the user name as
an argument to "passwd" and then use the pipe to feed it the old and new
passwords.  Run "passwd" by hand to see what it expects.

-- 
Geoff Mottram
minaret@sprynet.com


------------------------------

Date: 17 Apr 1997 01:47:04 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: client timing out
Message-Id: <5j3veo$66t$1@neocad.com>

I solved my own problem last time an hour after posting for help,
(yes, i posted AFTER researching), maybe I can have the same results
this time, if not, hopefully someone can offer some suggestions.

I have a client/server I'm working on that will distribute tests
to various machines for running when they request them.  I have the
functionality working, it's based on the first examples on Camel 2
P. 349-350.  I only want one request to be processed at a time, to
avoid locking file hassles.

So it's all working fine, but I'm having problems when I get 20-25
machines hammering on it, they start to time out.  My understanding
of UNIX sockets is somewhat limited, so I'm not sure how to address
this issue.  

I'm including both scripts below...I'm looking for how I can control
the timeout of the client, and also interested in determining what
the SO_MAXCONN of the server is, and can I control this to allow
larger number of connections, or is this a system constant that I
cannot control?

Thanks in advance for any assistance.

Server:

#!/devl/perl5/bin/perl -Tw

use strict;
BEGIN { $ENV{PATH} = 'usr/ucb:/bin' }
use Socket;
use Carp;

sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" }

my $port = shift || 2345;
my $proto = getprotobyname('tcp');
socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l",1)) or die "setsockopt: $!";bind(Server, sockaddr_in($port,INADDR_ANY)) or die "bind: $!";
listen(Server,SOMAXCONN) or die "listen: $!";

logmsg "server started on port $port";

my $paddr;

$SIG{CHLD} = \&REAPER;

for ( ; $paddr = accept(Client,Server); close Client)
{
   select Client;
   $| = 1;
   select STDOUT;
   my ($port,$iaddr) = sockaddr_in($paddr);
   my $name = gethostbyaddr($iaddr,AF_INET);

   logmsg "connection from $name [", inet_ntoa($iaddr), "] at port $port";

   my $sleep = int(rand 10)+1;
   sleep $sleep;

   print Client "Hello there, $name, it's now ", scalar localtime, "\n";
}


sub REAPER
{
   my $waitedpid = wait;
   logmsg "reaped $waitedpid" . ($? ? " with exit $?" : "");
}

-------
Client:
-------

#!/devl/perl5/bin/perl -w

use strict;
use Socket;
my ($remote,$port,$iaddr,$paddr,$proto,$line,$sleep);
 
$remote = shift || 'hostname';
$port   = shift || 2345;
while (1)
{
if ($port =~ /\D/) {$port = getservbyname($port,'tcp') }
die "No port" unless $port;
$iaddr = inet_aton($remote) or die "no host: $remote";
$paddr = sockaddr_in($port,$iaddr);
 
$proto = getprotobyname('tcp');
socket(SOCK,PF_INET,SOCK_STREAM,$proto) or die "socket: $!";
 
 
connect(SOCK,$paddr) die "connect: $!";
while ($line = <SOCK>)
{
   print $line;
}

$sleep = int(rand(120)) +1 ;
sleep $sleep;

close (SOCK) or die "close: $!";

}
exit;




--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


------------------------------

Date: Thu, 17 Apr 1997 11:32:09 -0600
From: carsonw@technologist.com
Subject: Re: Code without comments (Was: Re: Unix and ease of use (WAS: Who makes more ...))
Message-Id: <861294335.14264@dejanews.com>

In article <861239891snz@tsys.demon.co.uk>,
  tw104@york.ac.uk wrote:
>
> In article <5j2m1k$ngf@access5.digex.net>
>            cobrien@access5.digex.net "Cary B. O'Brien" writes:
>
> >         no comments other than this one - comments being an indication that
> >         code is too complex to be trusted.
>
> Rubbish.
>
> Never comment the code, comment the process.
>
> --
> :sb)

I used to think it was a waste of time to comment code, that is until I
started to work on large scale development, at that point I discovered it
is a necessity.

There comes a time when it is difficult enough to go back and remember
what I did, not to mention what the other developers on the project did.
Then you waste a lot of time working through the code when a comment or
two would solve the problem.

Carson

******************************************************************************
Carson R. Wilcox		email: carsonw@technologist.com
Catalina Marketing Corp.
Senior Systems Programmer Analyst	phone: (813)579-5371
http://www.geocities.com/ReasearchTriangle/1524

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 17 Apr 1997 13:56:04 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: display local directory
Message-Id: <5j5a5k$9ov@epsilon.qmw.ac.uk>

In article <861267517.6907.0@laureate.demon.co.uk>, darren@spiritec.com (Darren Westlake) writes:
>How can I display a kind of file chooser dialog box that will allow
>the user to choose a file? Can it be done.

Yes.  It can.  RTFM for this one though.  It's in there.

Alastair.


------------------------------

Date: Thu, 17 Apr 1997 16:46:30 +0100
From: b.wilkinson@NOSPAM.pindar.co.uk (Bob Wilkinson)
Subject: Re: display local directory
Message-Id: <b.wilkinson-1704971646300001@ip57-york.pindar.co.uk>

In article <861267517.6907.0@laureate.demon.co.uk>, darren@spiritec.com wrote:

> Hi,
> 
> How can I display a kind of file chooser dialog box that will allow
> the user to choose a file? Can it be done?
> 
> Thanks,
> 
> Darren

What platform do you want this to work on? I know that you can do it on a Mac,
and I think that the pTk module will permit this sort of interaction. I can't
answer definitively since I don't know what your hardware is. Perl itself
doesn't have this facility, since it doesn't really "do GUI".

Bob

-- 
I have become death, destroyer of the worlds.


------------------------------

Date: 17 Apr 1997 14:54:18 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: exec "exit"
Message-Id: <01bc4b3e$feadf480$2a6aafce@cactus>

> I seem to be having a problem using the exec command.  I want to exit
> my perl script and then exit my login on a particular machine...thus I
want
> to execute a line in my script that says:
> 
> exec "exit" || die "command failed";
> or
> exec ("exit") || die " command failed";
> 
> when I try it with () I get the die error, and when I try without
> () the program gives me no error, but doesn't logoff the xterm, or
particular
> machine...

If I'm not mistaken, "exit" is not in itself a program.  Instead, it is a
command to the shell.  The shell is fast asleep waiting for your perl
script to exit.  You could kill your parent process (the shell) and then
exit, but this will leave zombies running in your process table.  A better
approach would be to:

	1) Exec your perl script so that the shell is now gone and there is just
your script running on that terminal.

	2) If you want to logout of that machine, just exit the script.

	3) If you want to continue running on that machine, exec a new shell.

-- 
Geoff Mottram
minaret@sprynet.com


------------------------------

Date: 17 Apr 1997 13:39:49 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Good editor for W95?
Message-Id: <slrn5lca15.96s.dave@fast.thomases.com>

On 16 Apr 1997 22:03:28 GMT, Tom Christiansen wrote:
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, rascal@inlink.com writes:
> :I'm writing CGI scripts in perl on my W95 machine, and then uploading
> :them to the Unix server.  I'm looking for recommendations on good
> :editors that can easily save in a Unix format.
> 
> vi

Nah - he asked for _good_, not _appropriate_ ;-)

-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


------------------------------

Date: 17 Apr 1997 15:43:03 GMT
From: Henrik Soderstrom <emehenk@rioja.ericsson.se_nojunk_>
To: rascal@inlink.com
Subject: Re: Good editor for W95?
Message-Id: <5j5ge7$d4h@newstoo.ericsson.se>

Benjamin Burack <rascal@inlink.com> wrote:
->I'm writing CGI scripts in perl on my W95 machine, and then uploading
->them to the Unix server.  I'm looking for recommendations on good
->editors that can easily save in a Unix format.
->
->Thanks,
->Ben Burack
->rascal@inlink.com

Hmmm... This could be a religious issue.
Here4s my own favourite anyway:

    http://www.idmcomp.com/

Absolutely unbeatable - but of course it's just IMHO...

HTH & Cheers /Henrik




------------------------------

Date: 17 Apr 1997 16:02:51 GMT
From: Henrik Soderstrom <emehenk@rioja.ericsson.se_nojunk_>
Subject: Re: Good editor for W95?
Message-Id: <5j5hjb$d4h@newstoo.ericsson.se>

Henrik Soderstrom <emehenk@rioja.ericsson.se_nojunk_> wrote:
->Benjamin Burack <rascal@inlink.com> wrote:
->->I'm writing CGI scripts in perl on my W95 machine, and then uploading
->->them to the Unix server.  I'm looking for recommendations on good
->->editors that can easily save in a Unix format.
->->
->->Thanks,
->->Ben Burack
->->rascal@inlink.com
->
->Hmmm... This could be a religious issue.
->Here4s my own favourite anyway:
->
->    http://www.idmcomp.com/
->
->Absolutely unbeatable - but of course it's just IMHO...
->
->HTH & Cheers /Henrik
->

PS. Sorry, forgot to mention: Yes, it does easily save in either
    Unix, Mac or DOS format - apart from being the best in many
    other ways.




------------------------------

Date: 17 Apr 1997 16:01:30 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Good editor for W95?
Message-Id: <5j5hgq$28o$2@mainsrv.main.nc.us>

Benjamin Burack (rascal@inlink.com) wrote:
: I'm writing CGI scripts in perl on my W95 machine, and then uploading
: them to the Unix server.  I'm looking for recommendations on good
: editors that can easily save in a Unix format.

You can't go wrong with the Win32 port of Emacs.

Scott



------------------------------

Date: 17 Apr 1997 09:05:24 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Neal Nachtigall <nealnach@cr.usgs.gov>
Subject: Re: How do I randomly re-order the lines of a file?
Message-Id: <8cvi5l8wjf.fsf@gadget.cscaper.com>

>>>>> "Neal" == Neal Nachtigall <nealnach@cr.usgs.gov> writes:

Neal>     printf F splice(@line,rand(@lines),1);

Ouch.  That's gonna hurt the first time you have a line with a percent
in it!

you want print, not printf.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 501 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Thu, 17 Apr 1997 15:22:45 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How to prevent DOS box from Win32 perl?
Message-Id: <ebohlmanE8sG1x.Hsp@netcom.com>

lexi (levin@mpimg-berlin-dahlem.mpg.de) wrote:
: Hi
: I collect data from a CCD camera with a macro that has recorded 
: all mouse events. Within this loop is a short perl script that
: converts the data into another format. I run this script from explorer.
: Every time the DOS window pops up and my marco fails because the
: wanted window is covered.
: As the the script must be very fast I would like to know whether there
: is a way to prevent the DOS window from appearence or give him his
: coordinates where to pop up?

Assuming this is in Windows 95, create a shortcut to your script, go to
its "program" properties page and set the "window" option to "minimized." 
This should keep the DOS window from popping up while the script is
running



------------------------------

Date: 17 Apr 1997 14:56:47 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: How to set the time?
Message-Id: <01bc4b3f$6df496a0$2a6aafce@cactus>

> I know how to get the time with localtime() and gmttime(), but how do I
set
> the current time of the computer?

Run the UNIX command "date" from within your script.  However, you must
have "super-dude" privileges.

-- 
Geoff Mottram
minaret@sprynet.com


------------------------------

Date: 17 Apr 1997 15:52:20 GMT
From: Henrik Soderstrom <emehenk@rioja.ericsson.se_nojunk_>
Subject: HTML Parser anywhere ?
Message-Id: <5j5gvk$d4h@newstoo.ericsson.se>


Hi, I want to write something to parse an html-tree, fix
relative references after moving subtrees around, change
absolute references to relative and little things like that.

Just thought I'd check if there's any HTML-parsing code available
out there, that I could base it on before I start reinventing
the wheel here.

Ultimately I'd like to run it under W95 (or possibly both Unix
and W95) - I suppose something written for Unix could be useful
as a reference too.

TIA /Henrik




------------------------------

Date: 17 Apr 1997 15:00:54 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Inseting into a specific part of text..
Message-Id: <01bc4b40$011d0340$2a6aafce@cactus>

> Hello, I am kind of new to some Perl functions.  I was wondering if
> someone could point me to a way of...
> 
> grepping for a line of text in an ascii file...
> inserting at that line number....
> 
> 	I am firmilliar with standard file operations, however I cannot figure
> out how to throw something into the middle of the text.

Your script should be set up as a while (<STDIN>) loop as such:

	while (<STDIN>) {
		make your substitutions to the current line ($)
		use print to output the current line
	}


-- 
Geoff Mottram
minaret@sprynet.com


------------------------------

Date: 17 Apr 1997 15:32:27 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Looking for a flexible string substitution script
Message-Id: <5j5fqb$t2o@fcnews.fc.hp.com>

[added newsgroup comp.lang.perl.misc, followups directed there]

Yvon Boudreau (boudreau@hawk.nstn.ca) wrote:
: I am looking for a script that can do the following:

This seems like some basic ksh (or pick-your-favorite-sh) and perl
programming. Here's some tips to get you started:

:  Basic requirements for existing string specification are:
: 1. Replacement of a specified literal string by another literal string

  perl -i -pe's/\Q<original string>\E/<replacement string/g' <filename>

: 2. Replacement of only the content contained between specified beginning
: and ending substring by a specified literal string

  perl -i -pe's/(\Q<blah1>\E).*?(\Q<blah2>\E)/$1<new stuff>$2/g' <filename>

if you want multi-line replacement possible, this should do it:

  perl -0777 -i -pe's/(\Q<blah1>\E).*?(\Q<blah2>\E)/$1<new stuff>$2/mg' <filename>

: 3. The string substitution range should be a user choice between
:    a) a single file

as shown

: b) a list of files

  perl <stuff> <filename> <filename> <filename> ...

: c) a directory

  perl <stuff> <dirname>/*

: d) a hierarchy of directories including a named directory and all
: directories below it to all levels.

find <dirname> -type f | xargs perl <stuff>

: If somebody know where I could find such a string please let me know. You
: help will be greatly appreciated.

Andrew Allen


------------------------------

Date: Thu, 17 Apr 1997 16:32:41 +0100
From: Douglas Seay <seay@absyss.fr>
Subject: Re: Newbie Question: regexp email address..
Message-Id: <33564299.14CA@absyss.fr>

Randal Schwartz wrote:
> 
> [Doesn't anyone use Dejanews any more? :-(]

I think the problem is few have ever used dejanews.  "any more" implies
that it was heavily used in the past.  If people used it, they did so
before I started using USENET back in '88.

- doug


------------------------------

Date: Thu, 17 Apr 1997 16:49:06 +0100
From: Regis Cosnier <Regis.Cosnier@irisa.fr>
Subject: NT Administration question
Message-Id: <33564672.37BB@irisa.fr>

Hello,

I see the function Win32::NetAdmin::GetUsers which allow you to get the
list of users on your machine...

But is there a similar function which allow you to get the list of
groups????????

THANX

Regis


------------------------------

Date: Thu, 17 Apr 1997 15:25:09 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: NT heart characters?
Message-Id: <ebohlmanE8sG5x.Hz3@netcom.com>

Frank Jendraszak (fjj@sashimi.wwa.com) wrote:
: If I do a dump of WINS information, I'll get a file where some entries
: contain a ascii heart suit character.

: How do I search on this character so that I may replace or remove it with
: perl32 on NT 4.0?

It's a control-c (decimal value 3).



------------------------------

Date: 17 Apr 1997 10:20:23 -0400
From: oz@ds9.rnd.border.com (ozan s. yigit)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <x6iv1lwx20.fsf@ds9.rnd.border.com>


two points:

there are many languages that need discipline and abstraction facilities
for best use, so nothing new there. the distinction is the extent to which
languages bring such abstraction facilities [and some cases, discipline and
bondage :)] from the start; tcl has a few of its own, and such things as
[incr tcl] prove that it can be extended with new ones.

different people seem to lose it with different languages in different
ways. programming effort is not something to be judged only by commentary
but by actual working code of people who obviously have not lost it. [for
a max-out example, i count 102 files and ~36000 lines for exmh, an excellent
front-end for mh mailer]

oz










------------------------------

Date: Thu, 17 Apr 1997 09:27:10 PST
From: bouncenews@contessa.phone.net (Mike Meyer)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <19970417.7DC0A38.8702@contessa.phone.net>

In <MPG.dbeb63e1cab1e39989772@news.demon.co.uk>, cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer) wrote:
> Yep, and the latest development is ActiveX (a new name for some old 
> ideas from MS, i.e. OLE,OCX,etc). ActiveX Scripting is particularly 
> neat, as it'll mean that Windows should be free of most of these 
> language wars. Anyone who wants VBScript can have it, anyone who wants 
> JavaScript have it, and so on, providing that the script language has 
> been packaged as an ActiveX script engine and your app can use it 
> ActiveX scripting.

Yup, it is. I've been working in an environment where applications
include a communications port for scripting languages to talk to
rather than a scripting language for most of the last decade. Any
application worthy of the name includes that facility (including web
browsers and web servers :-). Most programming languages (including
ports from Unix) include facilities to talk to these applications.

The result is that you can write scripts in pretty much anything you
want. However, the bundled scripting language (A Rexx, and I *added*
comp.lang.rexx to the newsgroups list) was designed for this kind of
environment. It sort of follows the TCL model of "everything is a
string", and a bare expression gets sent to the default application.
Further, the implementation was meant for this environment, so the
interpreter is written as a small application that includes commands
to launch scripts.  The net result of this is that most scripts (mine,
anyway) are written in Rexx in spite of the availability of clearly
superior languages.

> Keep it up, people. You're making Windows stronger by the minute, by 
> holding everything else back. Good luck to you - you may need it.

Windows isn't forever. Probably not even for the rest of my life. And
there'll always be a niche market of people for whom the "good enough"
sold by MS isn't.

	<mike


--
Do NOT reply to the address in the From: header. Reply to mwm instead
of bouncenews at the same machine. You have been warned.  Sending
unsoliticed email I consider commercial gives me permission to
subscribe you to a mail list of my choice.


------------------------------

Date: 17 Apr 1997 14:07:10 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Palindromic words search???
Message-Id: <5j5aqe$i8m@pirate.shu.edu>

"Fredrik Lindberg" <flg@vhojd.skovde.se> writes:

>Sorry for the dots at the beginning of each line, but my stupid newreader
>wouldnt let me indent the lines unless I began with a nonwhitespace first.

No wonder I only got:

 . #!/usr/bin/perl -w
 . #

when I tried to mail it to myself :-)

David Black
dblack@icarus.shu.edu


------------------------------

Date: 17 Apr 1997 14:16:19 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Palindromic words search???
Message-Id: <5j5bbj$9ov@epsilon.qmw.ac.uk>

In article <3355E6BC.41C6@mrc-lmb.cam.ac.uk>, Jong <jong@mrc-lmb.cam.ac.uk> writes:
>I am trying to make a program which detects all the palindromic(perfect
>or imperfect palindromes) sequences in any long string.
>
>-> OTENETO
>   ::::::: 
>   OTENETO <-
>
>is a palindrome(perfect).
>
>-> OSKTENETRMO  
>   :  :::::  : 
>   OMRTENETKSO <-
>
>is a imperfect palindrome   

Ok.

>Can anybody give any good clues on how to do it?
>Either using patttern match or any complicated
>algorithms are welcome...

Well ...

reverse # reverse or flip a string, a list operator

halve the string ($a, $b) if even number of chars, dump the middle letter and
halve the rest if not then use patterns.  Exact match is easy, imperfect is 
harder and requires patterning, the degree of patterning involved determines
exactly how close the word is to a perfect palindrome.  The code then becomes
a series of tests moving further and further away from a perfect match as you
move through the tests.

No?

Alastair.


------------------------------

Date: 17 Apr 1997 14:51:19 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Palindromic words search???
Message-Id: <5j5dd7$nb4@pirate.shu.edu>

Jong <jong@mrc-lmb.cam.ac.uk> writes:

>Hi,

>I am trying to make a program which detects all the palindromic(perfect
>or imperfect palindromes) sequences in any long string.

Here's a fairly pedestrian little engine (is that a mixed
metaphor? :-) which takes a string as input and... well,
you'll see.

David Black
dblack@icarus.shu.edu
___________________________________________________________
#!/usr/local/bin/perl -w

print "String to check: ";
my $string = <STDIN>;
$string =~ s/\s//g;
$string = lc($string);

my $len = length ($string);
my $half = ($len / 2);
my $middle = '';
if ($len % 2) {
	$middle = ":";  # middle char of odd-length string always matches
}

my $one = substr ($string, 0, $half);
my $two = reverse (substr ($string,  $len - $half)); 
my @one = split //, $one;
my @two = split //, $two;
pop (@two) if ($#two > $#one); # sacrifice to the gods of -w :-)

my $match;
for (0 .. $#one) {
	if ( shift(@one) eq shift(@two) ) { $match .= ":" }
	else { $match .= " " };
}

$match = $match . $middle . reverse $match;
print "$string\n$match\n", reverse ($string), "\n";	



------------------------------

Date: Thu, 17 Apr 1997 08:43:28 -0600
From: Scott Gargash <scottg@fusionmm.com>
Subject: Re: perl and multithreading
Message-Id: <33563710.5C58@fusionmm.com>

Richard S. Smith wrote:
> 
> Malcolm Beattie (mbeattie@sable.ox.ac.uk) wrote:
> : Multithreading is being merged in to perl after 5.004 is out (the
> : original work was done against 5.001m but more important things
> : took precendence for the perl core). It uses a fairly small number
> : of threading primitive macros which currently have definitions for
> : the POSIX threads API (and for old-draft/DCE threads). Adding a
> : "fake" scheduler for platforms without O/S thread support is on the
> : ToDo list (and, in fact, a proof of concept version "Plthread"
> : showed it could be done a couple of years ago).
> 
> Forgive me but I'm going to use this thread to ask a question that's been
> on my mind for a while.
> 
> What's the difference between "multithreading" Perl and a Perl script that
> uses fork() to do things in the background?  For example, in chapter 6 of
> the new Camel book (page 350) there's code for a "multi-threaded" socket
> server script that I've been using as a basis for some stuff web-related
> stuff I've been doing.
> 
> What's the difference between that and "true multithreading"?
> 
> Thanks for any enlightenment on this issue.

Well, since I brought up the original question...

Threads are "lightweight processes". That is, a mutlithreaded app has 2
or more 
threads that appear to run simultaneously (and asynchronously) like fork
would 
do, but they live in the same process space. This allows the threads to
use a 
shared resource like a socket connection or shared memory, provided that
the 
access to the shared resource(s) is arbitrated through some
synchronization 
mechanism like a semaphore to make it thread-safe. fork() actually
spawns off a 
new process, albeit one that is initially an exact copy of the parent
process. Fork (multiple processes) and multiple threads can many times
accomplish the same 
results, but not always. Threads are generally more efficient than fork
since
1)you don't have to copy the process space, and 2) you don't have to
swap the 
page table when context switching to the other thread. 

On a more practial note, the ActiveWare port of perl for NT/95 does not
support 
fork, so in my situation I can't even fake threading via forks.

	Scott

-- 
===================================================================
Scott Gargash				scottg@fusionmm.com
Audio Software Engineer
Fusion MicroMedia			(303) 651-1000


------------------------------

Date: 17 Apr 1997 13:50:55 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Printing X amount of lines from begining/middle of file. How?
Message-Id: <5j59rv$9ov@epsilon.qmw.ac.uk>

In article <adrade-1604972131360001@pool3-002.wwa.com>, adrade@wwa.com (Adam Levy) writes:
>Is it possible to, from a file, print the first 15 lines from the file,
>and in another case, print lines 15-30, etc. in seperate instances? Any
>help is greatly appreciated. If possible, email responses are also
>appreciated.

Yes.

#! /usr/local/bin/perl

require 5.003;
use strict;

my ($count,$usage);

if (!ARGV[3]) {
    print "\nUsage: print.pl <filename> <startlinenumber> <endlinenumber>\n\n";
} else {
    $count = 0;
    open(IN,"$ARGV[1]");
    while ( <IN> ) {
	$count++;
	if (($count >= $ARGV[2]) && ($count <= $ARGV[3])) {
	    print $_;
	}
    }
}

exit 0;

# print.pl test.dat 1 23

will print the first 23 lines of text.dat

Alastair.


------------------------------

Date: 17 Apr 1997 16:04:59 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Q:calling perl script into JavaScript?
Message-Id: <5j5hnb$28o$3@mainsrv.main.nc.us>

Aunt Debi (debi@earthling.net) wrote:
: Does anyone know if is possible to define a JavaScript function which
: calls a perl or cgi script?
: Is it possible to assign a perl script to a JavaScript event handler?

Not that I know of. You could use JavaScript to invole the URL
of a CGI script using the normal syntax.

Scott



------------------------------

Date: 17 Apr 1997 16:04:25 GMT
From: clin@cs.umd.edu (Charles Lin)
Subject: Re: Strings as a uniform representation & tcl
Message-Id: <5j5hm9$448@mimsy.cs.umd.edu>

Olin Shivers (shivers@lambda.ai.mit.edu) wrote:
||     >     If one had to choose a single type for everything, a string is a
||     > pretty good choice.   Why not a number?  How would you represent a
||     > string with a number?

|| Perlis, as usual, summed it up well in one of his aphorisms:

||     The string is a stark data structure, and everywhere it
||     occurs there is much hiding of information.

|| This is what is wrong with both Unix and tcl. Their power is also a great
|| weakness: they are designed around a "least common denominator"
|| representation, strings. What it buys you is that everything interoperates.
|| The above aphorism explains what it costs you.

    Notice this is why I said "if one HAD to" choose a single data type,
a string would probably be it.    I didn't argue that it was a good idea.
In other words, given that you had to choose one type that a language
had to be in, what would you choose?   The problem with lists is that
a list is really a compound data structure.   For example, in a Lisp
list (a (b c)), what is "a", "b", and "c"?   Lists are built from 
basic elements.   Yes, yes, you can build up some sort of counting by
using the empty list and list of empty lists, and so on, but again,
ease of programming counts.

    My preference is to have multiple types.

--
Charles Lin
clin@cs.umd.edu



------------------------------

Date: 17 Apr 1997 16:01:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Transliterate from a pattern?
Message-Id: <5j5hfs$s46$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, zpalastair@unl.ac.uk writes:
:I ran these through time with the same data:
:
:method 1) real	0m0.11s
:	  user	0m0.03s
:	  sys   0m0.07s
:
:method 2) real	0m0.11s
:	  user	0m0.04s
:	  sys	0m0.06s
:
:pretty similar.  I tried it a few times and the results varied slightly but
:were always pretty close.

Use the Benchmark module.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
        echo "Hmmm...you don't have Berkeley networking in libc.a..."
        echo "but the Wollongong group seems to have hacked it in."
            --Larry Wall in Configure from the perl distribution


------------------------------

Date: Thu, 17 Apr 1997 13:57:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Unexpected Behavior using open ()
Message-Id: <E8sC4n.Isp@world.std.com>

Steve Gunnell <steveg@ccis.adisys.com.au> writes:

>Stop shooting the bloody messangers and have the guts to accept
>that sometimes the documentation is unclear or missing. Not
>everyone has web access to get to the FAQ list. Lighten up a
>bit.

You don't need web access to get the perl FAQ. The FAQ article for the
Usenet newsgroups comp.lang.perl.* hierarchy is posted monthly. Its
expires header is set to hint to the systems storing news to keep the
articles around the entire month. It is crossposted to
news.answers. The perl FAQ, like all the articles in news.answers are
archived for retrieval by FTP at rtfm.mit.edu and its
mirrors. 

Now anybody who has access to e-mail but not to FTP should be aware of
the FTP mail servers which they can use. I can't imagine that there is
anyone with access to Usenet, but not e-mail.

This is basically the whole point behind FAQs. People reading Usenet
should be able to find answers to common questions without bothering
the regular readers of the newsgroup. Obviously, if you make that
information hard to access, it does little good.
-- 
Andrew Langmead


------------------------------

Date: 17 Apr 1997 14:33:57 GMT
From: JYoungman@vggas.com (James Youngman)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j5ccl$2s9$15@halon.vggas.com>

In article <5j2ljd$q0f@tracy.nacs.net>, heller@nacs.net says...
>
>Tim Behrendsen (tim@a-sis.com) wrote:
>  [in reference to pkzip over tar+gzip]
>: Or how about self-extracting archives?
>
>This concept is utterly useless in un*x. The fact that you bring it
>up indicates that you aren't completely clear on the concept behind
>un*x.

OSF/1 does it for binaries.

-- 
James Youngman       VG Gas Analysis Systems  The trouble with the rat-race 
Before sending advertising material, read     is, even if you win, you're 
http://www.law.cornell.edu/uscode/47/227.html         still a rat.



------------------------------

Date: 17 Apr 1997 14:35:27 GMT
From: JYoungman@vggas.com (James Youngman)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j5cff$2s9$16@halon.vggas.com>

In article <5j2ljd$q0f@tracy.nacs.net>, heller@nacs.net says...
>
>Tim Behrendsen (tim@a-sis.com) wrote:
>  [in reference to pkzip over tar+gzip]
>: Or how about self-extracting archives?
>
>This concept is utterly useless in un*x. The fact that you bring it
>up indicates that you aren't completely clear on the concept behind
>un*x.

You're "obviously" no so, yourself, either.   Download gzip and exampne the 
gzexe shell script.

-- 
James Youngman       VG Gas Analysis Systems  The trouble with the rat-race 
Before sending advertising material, read     is, even if you win, you're 
http://www.law.cornell.edu/uscode/47/227.html         still a rat.



------------------------------

Date: Thu, 17 Apr 1997 16:56:15 +0100
From: Douglas Seay <seay@absyss.fr>
Subject: Re: What does "UNIX" stand for..
Message-Id: <3356481F.2865@absyss.fr>

Michael Salmon wrote:
> 
> Ron Natalie wrote:
> >
> > Actually, while UNIX ended up being portable, I don't
> > think that was the design philosophy.  UNIX's design
> > philosophy (unfortunately lost in the bloated systems
> > of today) was to make a series of small, interoperable
> > tools, to be combined into powerful operations by the
> > user.
> 
> I don't think that that was a design philosophy. My understanding is
> that Ken Thompson became tired of cross assembling his space travel
> simulation :^) on a GE mainframe and wrote Unix so that he could do
> native assemblies, other people found the new system interesting and
> wrote tools for it in their "spare time", the small interoperating tools
> were more pragmatic than philosophic. Personally I think that it is the
> difference between people developing tools and teams/companies doing it.
> Of course the teletypes of the day must have helped to prevent too many
> bells and whistles.

And if I remember my folklore correctly, they only had 64K segments to
work with.  I've surely never used a PDP-7, so I can't say for sure. 
This encouraged small tools, or at least not hogs (cough *emacs*).  I
believe that is why the C preprocessor is a separate executable.


------------------------------

Date: 17 Apr 1997 14:11:06 GMT
From: z007400b@bcfreenet.seflin.org (Ralph Silverman)
Subject: Re: What does "UNIX" stand for..
Message-Id: <5j5b1q$g29@nntp.seflin.org>

reet.com> <33544A86.6F10F221@erols.com> <5j2rrm$b2n@nntp.seflin.org> <335508EC.1B87@sensor.com>
Organization: SEFLIN Free-Net - Broward
Distribution: 

Ron Natalie (ron@sensor.com) wrote:
: >      unix is based on a high portability
: >      design philosophy ...

: Actually, while UNIX ended up being portable, I don't
: think that was the design philosophy.  UNIX's design
: philosophy (unfortunately lost in the bloated systems
: of today) was to make a series of small, interoperable
: tools, to be combined into powerful operations by the
: user.

: Much of early UNIX wasn't exactly portable.  Large
: chunks were still in assembler (and C had yet to be widely
: ported either).  Goofy PDP-11 specific features abounded
: and still exist to this day in things like the UNIX
: signal names.

: The portability came from the design of C being very
: light weight and the openness of UNIX (for those who
: could get their hands on UNIX at all in those early
: days, they could get the source code as well).

: -Ron "Not A Typewriter" Natalie
: UNIX hacker since 1977.

--
*****************begin r.s. response******************

	apparently
		ken thompson
	had a work ethic similar to
	that of a programming contractor
	... a
		travel light
	work ethic ...

	the idea here is that
	since the next assignment
	might be anything ...
	too great specialized dependence
	on tools,  systems,  etc.
	was unsustainable ...

	certainly,
	a portable operating system
	is a big proposition from the
		go-get
	...
	but thompson had no interest in
	limiting this as
	a computer manufacturer
	would ...

	thompson's then employer,
	at&t,  very well might have had
	an interest in a portable system
	due to at&t 's then business
	situation ...

	thompson's personal inclinations
	and at&t 's plans may have meshed
	very well here ...

*****************end r.s. response********************
Ralph Silverman
z007400b@bcfreenet.seflin.lib.fl.us



------------------------------

Date: 17 Apr 1997 15:09:07 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: XS and C structures...
Message-Id: <01bc4b41$26cda4e0$2a6aafce@cactus>

> My question is : Am I doing something wrong?  And how do I access the 
> status and MemberID fields of the structure? 

You have to provide functions that return that data.  One function could be
written to return a list with all of the elements of one member or you
could have separate functions for each data element.


-- 
Geoff Mottram
minaret@sprynet.com


------------------------------

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 324
*************************************

home help back first fref pref prev next nref lref last post