[16915] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4327 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 21:06:36 2000

Date: Thu, 14 Sep 2000 18:05:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968979918-v9-i4327@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 14 Sep 2000     Volume: 9 Number: 4327

Today's topics:
    Re: 'Listen' option on sockets <lhswartw@ichips.intel.com>
    Re: 'Listen' option on sockets <uri@sysarch.com>
        A 20,000 links DB <diab.lito@usa.net>
    Re: Building and traversing trees <clyde@NOSPAMgetofftheline.freeserve.co.uk>
    Re: Building and traversing trees (Mark-Jason Dominus)
    Re: can i run a cgi script within javascript tag? <tchemaly@ing.sun.ac.za>
    Re: Deleting Files <stevea@wrq.com>
    Re: Deleting Files <ren.maddox@tivoli.com>
    Re: Deleting Files <yanick@babyl.sympatico.ca>
    Re: escape strings ? (James Stevenson)
    Re: escape strings ? (Jerome O'Neil)
    Re: escape strings ? <elephant@squirrelgroup.com>
    Re: escape strings ? <christopher_j@uswest.net>
    Re: escape strings ? <ren.maddox@tivoli.com>
        File Upload Status Indicator kennedyjd@my-deja.com
    Re: File Upload Status Indicator (David Efflandt)
    Re: Generating Random Password in Perl <bart.lateur@skynet.be>
    Re: golf (Was Re: transliterating file names in a dir) <ren.maddox@tivoli.com>
    Re: golf (Was Re: transliterating file names in a dir) <ren.maddox@tivoli.com>
    Re: Help in RegExp to highlight keyword in HTML file <elephant@squirrelgroup.com>
    Re: Iterate over greed? (Ilya Zakharevich)
        kill a process in Win32 <r_hou@yahoo.com>
    Re: kill a process in Win32 <elephant@squirrelgroup.com>
    Re: kill a process in Win32 <swtillman@west.raytheon.com>
        MS-DOS window closes <raldanash@my-deja.com>
    Re: MS-DOS window closes (Brandon Metcalf)
    Re: problem with csv cgi script <elephant@squirrelgroup.com>
    Re: Qualifications for new Perl programmer????? (Andrew Johnson)
    Re: Qualifications for new Perl programmer????? <elephant@squirrelgroup.com>
    Re: Quality of rand() (Mark-Jason Dominus)
    Re: Req.: The perfect Perl Editor? <bkennedy@hmsonline.com>
    Re: Req.: The perfect Perl Editor? (Craig Berry)
    Re: Silly grep tricks (Alan Barclay)
    Re: space available in hard disk for NT using perl <elephant@squirrelgroup.com>
    Re: Teaching Perl <bart.lateur@skynet.be>
    Re: Teaching Perl <juex@deja.com>
    Re: Test Your Perl Skills (Richard J. Rauenzahn)
    Re: UNICODE & SSI <elephant@squirrelgroup.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 14 Sep 2000 15:35:28 -0700
From: Larry Swartwood <lhswartw@ichips.intel.com>
Subject: Re: 'Listen' option on sockets
Message-Id: <39C152AF.31A2FCA5@ichips.intel.com>

What you need is a forking server, one that forks a new process to handle
each new client. Here's some example code from the perl cookbook:

#set up the socket SERVER, bind and listen ...
use POSIX qw(:sys_wait_h);

sub REAPER
{
   1 unitl (-1 == waitpid(-1, WNOHANG));
   $SIG{CHLD} = \&REAPER;
}

$SIG{CHLD} = \&REAPER;

while ($hisaddr = accept(CLIENT, SERVER))
{
   next if $pid = fork;                                # parent
   die "fork: $!" unless defined $pid;           # failure
   # otherwise child
   close(SERVER);                                  # no use to child
   # .. do something
   exit;                                                     # child leaves
} continue {
      close(CLIENT);                                # no use to parent
}

This will allow your server to go back to waiting to accept another client.
There are other solutions such as pre-forking servers. There are also
concurrent servers that don't fork; rather, they keep an array of open
clients.

Hope this helps,
Larry S.

Paul Brady wrote:

> In article <39BF1499.3B3FB815@zeutec.de>,
>   r.schwebel@zeutec.de wrote:
> > Hi!
> >
> > I have a problem with a small server program. My server shall only
> serve
> > one single client, so if a second one tries to connect to the port he
> > has to get a 'connection denied'. After reading the 'IO::Socket::INET'
> > manpage my impression was that the 'Listen' option does what I need
> and
> > something like this should work:
> >
> > $server = IO::Socket::INET->new( Proto     => 'tcp',
> >                                  LocalPort => $PORT,
> >                                  Listen    => 1,
> >                                  Reuse     => 1);
> >
> > Unfortunately, the second (and any further) one who tries to connect
> > just gets a connection that queues up until the first client
> > disconnects.
> >
>
> Not sure how you would handle this at the server and, but you might try
> setting a timeout on the client connection.
>
> Paul.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Larry Swartwood
Phone Number : (503)613-6012
Location     : RA2-3-C2

M/S: RA2-302
2501 NW 229th Street
Hillsboro, OR 97124-5503
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Blessed is the man who, having nothing to say, abstains from
 giving us worthy evidence of the fact."

 George Eliot




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

Date: Thu, 14 Sep 2000 23:49:42 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: 'Listen' option on sockets
Message-Id: <x73dj2h6ui.fsf@home.sysarch.com>

>>>>> "LS" == Larry Swartwood <lhswartw@ichips.intel.com> writes:

  LS> What you need is a forking server, one that forks a new process to
  LS> handle each new client. Here's some example code from the perl
  LS> cookbook:

  >> > I have a problem with a small server program. My server shall
                                                               ^^^^^
  >> only serve > one single client, so if a second one tries to connect
  >> to the port he > has to get a 'connection denied'. After reading
  >> the 'IO::Socket::INET' > manpage my impression was that the
  >> 'Listen' option does what I need and > something like this should
  >> work:

the OP only wants 1 client connected at a time. note the word i marked
above. there is no need to quote code from the cookbook as it is all
available online at the o'reilly site.

also don't quote in jeopardy style.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 14 Sep 2000 23:23:18 GMT
From: Mario <diab.lito@usa.net>
Subject: A 20,000 links DB
Message-Id: <8prmkg$1kn$1@nnrp1.deja.com>

I have to make a search engine for a small company.Since I am not a
guru yet with DB and programming,I was wondering if this solution is
acceptable (it's easier to me):

A flat file for the DB (data called with SEEK and unpacked) and a Perl
Cgi for the search.

This sounds a little bit antiquate,I know...

What are the disadvantages of storing the links on a "normal" file
instead of a SQL database? The links to store are about 20,000 and each
link has to have about 1KB of info.

Also I would like to understand how much time is required to learn SQL
or similar.I need to have the job done within 2 weeks.
Again,a DBM database would be good for what I need?

Thanks anyone,
Mario


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 14 Sep 2000 23:42:56 +0100
From: "Clyde Ingram" <clyde@NOSPAMgetofftheline.freeserve.co.uk>
Subject: Re: Building and traversing trees
Message-Id: <8prkj5$rtt$1@news5.svr.pol.co.uk>

Excellent stuff, Mark.  Works fine.

To extend the problem, how do I insert a string on some nodes?
This would be the name of the system that the address routes to, in a
routing table.

To modify my example, the list of addresses route to distinct systems as
follows:

/GB/BT/BBC/NEWS: beeb-news
/GB/BT/BBC/SPORT: beeb-sport
/GB/BT/BBC/DRAMA: beeb-drama
/GB/BT/ITV: itv
/GB/BT: telecom
/GB/BT/C4: channel4
/US/ATT: a-t-and-t
/US/ATT/ABC: abc
/US/ATT/NBC: nbc

so that the shape of my (slightly bigger) tree has some nodes showing the
name of a system which the address will route to:

<root>
        GB
                BT ==> telecom
                        BBC
                                NEWS ==> beeb-news
                                SPORT ==> beeb-sport
                                DRAMA ==> beeb-drama
                        ITV ==> itv
                        C4 ==> channel4
        US
                ATT ==> a-t-and-t
                        ABC ==> abc
                        NBC ==> nbc

As you see, every leaf node points to a system name, but not all non-leaf
nodes need do so.

Thank-you in advance for your help.
Regards, Clyde


Mark-Jason Dominus wrote in message <39c1339f.3e9f$129@news.op.net>...
>In article <968953127.21507.0.nnrp-07.9e98e5bc@news.demon.co.uk>,
>Clyde Ingram <cingram-at-pjocs-dot-demon-dot-co-dot-uk> wrote:
>>I want to build a tree representation of heirarchical address strings.
>>For example, give the strings:
>>
>>/GB/BT/BBC/NEWS
>>/GB/BT/BBC/SPORT
>>/GB/BT/BBC/DRAMA
>>/GB/BT/ITV
>>/GB/BT/C4
>>/US/ATT/ABC
>>/US/ATT/NBC
>
Mark,

># Build tree
>my $top = {};
>while (<>) {
>  chomp;
>  s{^/}{};   # Remove leading /
>  my $position = $top;
>  for my $field (split m{/}) {
>    $position->{$field}= {} unless exists $position->{$field};
>    $position = $position->{$field};
>  }
>}
>
># print tree
>print_tree($top);
>
>sub print_tree {
>  my ($root, $nodename, $indentation) = @_;
>  $indentation = 0 unless defined $indentation;
>  $nodename = '<root>' unless defined $nodename;
>
>  print(("\t" x $indentation), $nodename, "\n");
>
>  while (my($subnodename, $subtree) = each %$root) {
>    print_tree($subtree, $subnodename, $indentation+1);
>  }
>}






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

Date: Thu, 14 Sep 2000 23:48:49 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Building and traversing trees
Message-Id: <39c163e0.468c$1e5@news.op.net>

In article <8prkj5$rtt$1@news5.svr.pol.co.uk>,
Clyde Ingram <clyde@NOSPAMgetofftheline.freeserve.co.uk> wrote:
>To extend the problem, how do I insert a string on some nodes?

Now's the part of the evening when you look at the code I sent and
think about how it works and then adapt it to your own problem.

>Thank-you in advance for your help.

Welcome.


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

Date: Fri, 15 Sep 2000 00:47:41 +0200
From: "Tim" <tchemaly@ing.sun.ac.za>
Subject: Re: can i run a cgi script within javascript tag?
Message-Id: <8prk7b$qaj$1@news.adamastor.ac.za>

NO
CGI is server side and can only be run at the servers side..besides most
people (me included) do not have a PERL parser on their computer. Therefore
they would not be albe to run your script!!

Also from a security point of view it would be silly allow CGI scripts to
execute on clients side.

Ciao
Tim


"klidge" <klidge@mailbox.gr> wrote in message
news:8prduu$cn2$1@ulysses.noc.ntua.gr...
> I would like to ask you if it's possible for a cgi script written in perl
> to run from within a javascript script
> example:
> Html source:
> <script language="javascript">
> --the code i need here---
> </script>
> In order for the "result" after accessing the page would be the same as
the
> htm source was:
> <script language="javascript">
> document.write('this line has been generated from a cgi perl script');
> </script>
>
> thank you in advance
>
>




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

Date: 14 Sep 2000 15:10:28 -0700
From: Steve Allan <stevea@wrq.com>
Subject: Re: Deleting Files
Message-Id: <uu2bik4kr.fsf@wrq.com>

penpendisarapen@my-deja.com writes:

>Is there another way to delete a file without using 'system'? I couldn't
>seem to find one in my Perl reference book.
>

  perldoc -f unlink

-- 
-- Steve __


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

Date: 14 Sep 2000 16:39:22 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Deleting Files
Message-Id: <m3pum6zm9h.fsf@dhcp11-177.support.tivoli.com>

penpendisarapen@my-deja.com writes:

> Is there another way to delete a file without using 'system'? I couldn't
> seem to find one in my Perl reference book.

perldoc -f unlink

This one can be tricky to find.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 15 Sep 2000 00:01:54 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Deleting Files
Message-Id: <SFdw5.13$1q6.1254@news20.bellglobal.com>

penpendisarapen@my-deja.com wrote:
: Is there another way to delete a file without using 'system'? I couldn't
: seem to find one in my Perl reference book.

	perldoc -f unlink

	and consider acquiring a /real/ Perl reference book. Y'know, 
	the kind with an index and listing of built-in functions... ;)

Joy,
Yanick

-- 
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;


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

Date: 14 Sep 2000 22:39:45 GMT
From: James@linux.home (James Stevenson)
Subject: Re: escape strings ?
Message-Id: <slrn8s2of7.1mu.James@linux.home>


Hi

i dont really mean like that i did not really explain the problem very well to start with :)

what happends if i read data like

blah blah ';blah

and put it into a variable like
$var="blah blah ';blah";

now if i create an sql statment like
inset into table (data) values('$var');

the sql statment is going to fail but if the data were to look like this in $var
blah blah \';blah

its not going to fail

is there an easy way todo this eg generic function in perl i have not found ?
or will i need to write my own function ?

thanks
	James

On Thu, 14 Sep 2000 20:48:06 GMT, Jerome O'Neil <jerome@activeindexing.com> wrote:
>James@linux.home (James Stevenson) elucidates:
>> Hi
>> 
>> is there a generic function in perl to convert a string to an escape
>> string and back again eg
>> 
>> "the 'text
>> that is h"ere"
>> 
>> to
>> 
>> "the \'text\nthat is h\"ere"
>
>Generaly, you should use quote like operators for stuff like this.
>
>It's much easier to read.  Some modules will provide specialized encoding 
>functions for their own needs.
>
>print qq{the 'text\nthat is h"ere"};
>
>HTH!


-- 
---------------------------------------------
Check Out: http://www.users.zetnet.co.uk/james/
E-Mail: mistral@stevenson.zetnet.co.uk
 11:30pm  up 6 days, 14:11,  9 users,  load average: 0.97, 0.60, 0.39


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

Date: Thu, 14 Sep 2000 22:57:16 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: escape strings ?
Message-Id: <gJcw5.760$wN2.217203@news.uswest.net>

James@linux.home (James Stevenson) elucidates:

> what happends if i read data like
> 
> blah blah ';blah
> 
> and put it into a variable like
> $var="blah blah ';blah";
> 
> now if i create an sql statment like
> inset into table (data) values('$var');

SQL implies that you aught to be using the DBI module, which has a 
quote method that handles this kind of stuff for you.

       `quote'
             $sql = $dbh->quote($value);
             $sql = $dbh->quote($value, $data_type);

           Quote a string literal for use as a literal value in
           an SQL statement, by escaping any special characters
           (such as quotation marks) contained within the string
           and adding the required type of outer quotation marks.

             $sql = sprintf "SELECT foo FROM bar WHERE baz = %s",
                           $dbh->quote("Don't");



> is there an easy way todo this eg generic function in perl i have not found ?
> or will i need to write my own function ?

Already got a couple of wheels for that.  No point in re-inventing 
another one.

HTH!


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

Date: Fri, 15 Sep 2000 10:29:53 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: escape strings ?
Message-Id: <MPG.142bfc6dd55bd4009897b4@localhost>

James Stevenson <James@linux.home> wrote ..
>is there a generic function in perl to convert a string to an escape
>string and back again eg
>
>"the 'text
>that is h"ere"
>
>to
>
>"the \'text\nthat is h\"ere"

not quote that .. but close enough for most uses .. check out the 
'quotemeta' function

  perldoc -f quotemeta

but there are often better ways of doing what most people want to do 
with that sort of escape stuff .. using heredoc syntax (which I've 
never been able to find a good example of in the docs) or the q// or 
qq// operators - explained in perlop

  perldoc perlop

btw .. to get it back from the escaped sequence use 'eval' with a 
double-double-quoted value

  perldoc -f eval

eg. from non-escaped to escaped

  $escaped = quotemeta $not_escaped;

and back again

  $not_escaped = eval qq{"$escaped"};

but I repeat - there is almost certainly better ways of accomplishing 
what you're trying to accomplish with this crazy conversion

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 14 Sep 2000 16:32:29 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: escape strings ?
Message-Id: <hedw5.599$0j.305822@news.uswest.net>


I assume you're using the DBI module (and if not why not?!), so
you can simply use the quote() function (created for exactly
this purpose).




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

Date: 14 Sep 2000 16:00:51 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: escape strings ?
Message-Id: <m3vgvyzo1o.fsf@dhcp11-177.support.tivoli.com>

James@linux.home (James Stevenson) writes:

> Hi
> 
> is there a generic function in perl to convert a string to an escape
> string and back again eg
> 
> "the 'text
> that is h"ere"
> 
> to
> 
> "the \'text\nthat is h\"ere"

Well, the first problem I see is how to recognize which " is the final
one.  Unless you mean that you have a string containing the above
value but excluding the outer quotes.

Next, you have quoted the single quote within double quotes, which is
unnecessary.

Finally, as far as Perl is concerned, there is really no difference
between "\n" and "
".  They are both simply a newline.  On the other hand, if what you
really want is to convert a newline to the two-character string
composed of "\" and "n", then that is certainly different.

What other values would you want to handle in this way?  (e.g. "\t" or
"\r")

Here is something that may be a starting point for what you are trying
to do:

#!/usr/local/bin/perl -w
use strict;

# this adds the quoting
$_ = q(the 'text
that is h"ere);
s/(['"])/\\$1/g;         # add more characters to quote to the class
s/\n/\\n/g;              # really need to handle \t, etc. here
print "Quoted: $_\n";

# while this removes it
s/\\(.)/qq("\\$1")/eeg;
print "Unquoted: $_\n";
__END__

HTH,
-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 14 Sep 2000 22:59:26 GMT
From: kennedyjd@my-deja.com
Subject: File Upload Status Indicator
Message-Id: <8prl82$4i$1@nnrp1.deja.com>

Hi all,

Is it possible via Perl to display the status of a file that is being
uploaded to a web server (similar functionality to SoftArtisan's SA-
FileUp SoftArtisans.FileUpProgress object Percentage method)?

Thanks!

-- Joe


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 15 Sep 2000 00:08:28 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: File Upload Status Indicator
Message-Id: <slrn8s2q3b.slv.efflandt@efflandt.xnet.com>

On Thu, 14 Sep 2000, kennedyjd@my-deja.com <kennedyjd@my-deja.com> wrote:
>
>Is it possible via Perl to display the status of a file that is being
>uploaded to a web server (similar functionality to SoftArtisan's SA-
>FileUp SoftArtisans.FileUpProgress object Percentage method)?

Not without some sort of browser plugin.  Your browser sends a request to
the server (including file contents), then it hopefully gets a response
from the server.  There is no 2-way interactive communication.  This is
not a Perl question, but the *.authoring.cgi group seems to have been down
for days.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Fri, 15 Sep 2000 00:43:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Generating Random Password in Perl
Message-Id: <sur2ssoodnun6que2nui1nls0dj7h9ir8o@4ax.com>

J Garcia wrote:

>I am looking for any tips or any pre-written Perl code
>on how to generate random passwords for users wishing
>to register. Any help on how to do that? Thanks.

I sometimes use a combination of the user's email address and the
current time in seconds since the epoch, and that encrypted in some way,
for example using CRC and turned into a string of digits and letters
only, a base 36 number representation of a number. 7 characters is a
good length.

-- 
	Bart.


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

Date: 14 Sep 2000 16:44:59 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: golf (Was Re: transliterating file names in a dir)
Message-Id: <m3n1hazm04.fsf@dhcp11-177.support.tivoli.com>

Larry Rosler <lr@hpl.hp.com> writes:

> I can see the two arguments.  So tell me about the comma before the 
> 'for'.  It seems like list context, with a trailing nothing before the 
> 'for'.
> 
>     print 'x', for 0;
> 
> works just fine, but I can't see how to parse it.
> 
> For that matter, so does this:
> 
>    1, for 0;

For that matter, so does this:

1,;

-- 
Ren Maddox
ren@tivoli.com


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

Date: 14 Sep 2000 16:04:14 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: golf (Was Re: transliterating file names in a dir)
Message-Id: <m3snr2znw1.fsf@dhcp11-177.support.tivoli.com>

Larry Rosler <lr@hpl.hp.com> writes:

> In article <m31yym2245.fsf@dhcp11-177.support.tivoli.com> on 14 Sep 2000 
> 14:40:58 -0500, Ren Maddox <ren.maddox@tivoli.com> says...
> + Larry Rosler <lr@hpl.hp.com> writes:
> + 
> + > In article <slrn8s0qv0.ku0.abigail@alexandra.foad.org> on 14 Sep
> + > 2000 06:11:45 GMT, Abigail <abigail@foad.org> says...
> + > > I missed the obvious obfuscation touch:
> + > > 
> + > >       perl -e'rename"$_",y, ,-,x0|lc,for<*>'
> + > 
[snip]
> 
> No.  I mean the nothingness that follows the comma before the 'for', 
> where 'normal' people would use a space.

Ah... my brain parsed that as a map/grep style syntax, even though it
obviously isn't....  Deparse shows that that comma is ignored, which
presumably happens before rename's prototype comes into play.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 15 Sep 2000 10:14:01 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Help in RegExp to highlight keyword in HTML file
Message-Id: <MPG.142bf8b23f7390ae9897b2@localhost>

parvaist@my-deja.com <parvaist@my-deja.com> wrote ..
>I would like to create a regexp to highlight a keyword in a html text.
>Highlight means add the <FONT COLOR=...>keyword</FONT> tags. Of course,
>if the keyword in contained in an HTML tag (example: <A
>HREF="keyword.html">), it should not been highlighted !!!!
>
>Can you help me by creating this regexp ??

Abigail might be able to - but you won't like her answer ;)

practically speaking - what you want to do cannot be done reliably with 
a simple regex .. use one of the HTML parsing tools instead .. 
HTML::Parser will allow you to do what you want quite nicely

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 14 Sep 2000 22:57:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Iterate over greed?
Message-Id: <8prl3v$h77$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@plover.com>],
who wrote in article <39c12ebc.3c5b$1c4@news.op.net>:
> Here's a solution, although I have a nagging feeling that there is a
> much easier way to do the same thing:
> 
>   1 while m/^
>             (.*)-(.*)
>             $
>             (?{push @matches, [$1, $2]})  # Build data structure current match
>             (?!)                          # backtrack for another match
>            /x;

Yes, this is very SNOBOLish, but AFAIU, you need to be SNOBOLish to
extract all the possible matches.

One remark though: IIRC, [,] is incredibly slow.  I would use

  push @matches, $1, $2

instead.

Ilya


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

Date: Thu, 14 Sep 2000 17:29:36 -0500
From: "robert hou" <r_hou@yahoo.com>
Subject: kill a process in Win32
Message-Id: <8prjgh$95v$1@schbbs.mot.com>

Hello all,

I need to kill a process with known name in Windows NT. I guess I am
supposed to use kill, but how do I get the PID info? In unix it's easy to
get it by using 'ps -ef'. How to do it in Win32?

Thanks

Robert




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

Date: Fri, 15 Sep 2000 10:31:44 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: kill a process in Win32
Message-Id: <MPG.142bfcd6341eeb859897b5@localhost>

robert hou <r_hou@yahoo.com> wrote ..
>I need to kill a process with known name in Windows NT. I guess I am
>supposed to use kill, but how do I get the PID info? In unix it's easy to
>get it by using 'ps -ef'. How to do it in Win32?

there's probably a better way of doing this .. *but* .. if you're 
desperate there's a utility called 'tlist' which comes with the NT 
Resource Kit .. and I know that there are also ports of the UNIX 'ps' to 
Win32

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 14 Sep 2000 17:06:06 -0700
From: "Scott W. Tillman" <swtillman@west.raytheon.com>
Subject: Re: kill a process in Win32
Message-Id: <39C167EE.25F496AD@west.raytheon.com>

According to kill.exe, you can use the task name directly:

kill /?
Microsoft (R) Windows NT (TM) Version 3.5 KILL
Copyright (C) 1994 Microsoft Corp. All rights reserved

usage: KILL [options] <<pid> | <pattern>>

           [options]:
               -f     Force process kill

           <pid>
              This is the process id for the task
               to be killed.  Use TLIST to get a
               valid pid

           <pattern>
              The pattern can be a complete task
              name or a regular expression pattern
              to use as a match.  Kill matches the
              supplied pattern against the task names
              and the window titles.

jason wrote:

> robert hou <r_hou@yahoo.com> wrote ..
> >I need to kill a process with known name in Windows NT. I guess I am
> >supposed to use kill, but how do I get the PID info? In unix it's easy to
> >get it by using 'ps -ef'. How to do it in Win32?
>
> there's probably a better way of doing this .. *but* .. if you're
> desperate there's a utility called 'tlist' which comes with the NT
> Resource Kit .. and I know that there are also ports of the UNIX 'ps' to
> Win32
>
> --
>   jason -- elephant@squirrelgroup.com --



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

Date: Thu, 14 Sep 2000 22:02:30 GMT
From: Razib <raldanash@my-deja.com>
Subject: MS-DOS window closes
Message-Id: <8prht8$rtq$1@nnrp1.deja.com>

i'm using ACTIVEPERL, and every time i try to open a .pl script i've
set up in the MS-DOS window, it closes before i can see what's going on.

is there some way i can figure out what's going on?  i downloaded
ACTIVEPERL several times, so i know it's not that

--
________________________________
Razib Khan
http://geocities.com/raldanash/alternatehistory


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 14 Sep 2000 23:30:30 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: MS-DOS window closes
Message-Id: <8prn2m$qi3$1@bcrkh13.ca.nortel.com>

raldanash@my-deja.com writes:

 > i'm using ACTIVEPERL, and every time i try to open a .pl script i've
 > set up in the MS-DOS window, it closes before i can see what's going on.
 > 
 > is there some way i can figure out what's going on?  i downloaded
 > ACTIVEPERL several times, so i know it's not that

Open a dos window and execute the script from the command line.

Brandon


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

Date: Fri, 15 Sep 2000 10:10:50 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: problem with csv cgi script
Message-Id: <MPG.142bf7f3b21bd0519897b1@localhost>

Matthew Wagley <gpcu.mwagley@gcnet.com> wrote ..
>I have a csv database and I have textarea field.  When I hit enter in the
>field to start a new line and type multiple lines in and using the enter key
>to start the next new line  after sending to the cgi it parses it out
>totally different as if it was its on fields and stuff.  How can you parse
>the enter command into a new line when parsing the information coming into
>the script?

stop doing it yourself .. use one of the many CGI modules .. one of 
which (CGI.pm) is standard with the Perl distribution

> $form{'Description'} =~ (s/\r\n/<br>/g);

this substitution will not work because when reading from the STDIN 
filehandle Perl will have converted CRLF sequences to LF

you can see a bit more of an explanation of this behaviour in the 
perlfunc documentation on the 'binmode' function

  perldoc -f binmode

I think everything else is correct - but I only skimmed it - but the 
above would certainly cause you unexpected results

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 14 Sep 2000 22:22:28 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <Eccw5.17275$a5.244729@news1.rdc1.mb.home.com>

In article <8pr18i$6rs$1@nnrp1.deja.com>,
 Brendon Caligari <bcaligari@my-deja.com> wrote:
[snip]

! Some languages (like perl) are more relaxed than, say...pascal.
! For someone with at least a semi-sound programming background
! that's fine.  But if you're a beginner, a language like perl is
! a sure way of never learning any sound practices.  I believe

Why would learning Perl as a first language prevent learning any
sound practices? Are you saying that one cannot use sound programming
practices with Perl, or that sound practices cannot be taught using
Perl? 

! Yet I still believe that Perl as a first programming language is a
! lousy choice.

You are certainly entitled to your beliefs (even if you don't explain
the basis of those beliefs). I happen to disagree with your opinions 
regarding Perl.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/
      Perl can certainly be used as a first computer language, but 
      it was really designed to be a *last* computer language.
          -- Larry Wall


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

Date: Fri, 15 Sep 2000 09:39:16 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <MPG.142bf092c4440c549897af@localhost>

Steven Merritt <smerr612@mailandnews.com> wrote ..
>In article <MPG.14292f9e9342de2d98978b@localhost>,
>  jason <elephant@squirrelgroup.com> wrote:
>> Steven Merritt <smerr612@mailandnews.com> wrote ..
>
>> >I didn't have trouble with your quiz, even though you did some
>> >naughty things like array names made up of punctuation and <STDIN>
>> >when STDIN is the default for <>(Assuming no arguements).
>>
>> array names made up of punctuation ? .. do you mean scalar names ? ..
>> or did the surrounding single quotes in question 6 confuse you ?
>
>We can chalk this one up to Deja being a crappy newsreader.  With the
>font it used(and the screen resolution I run at) @x looked a fair bit
>like @( in question 7.  I used the feature I hope Deja never drops
>(View original usenet format) and saw the difference.(or maybe I just
>need new glasses)

oic .. that makes a lot more sense (as you can imagine I was really 
wondering about you)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 14 Sep 2000 22:00:23 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Quality of rand()
Message-Id: <39c14a77.42ba$21b@news.op.net>

In article <8prbuh$9nn$2@mark.ucdavis.edu>,
Adam Trace Spragg  <spragg@cs.ucdavis.edu> wrote:
>
>What a completely helpful answer!  It wasn't my question, but thanks!

My pleasure.








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

Date: Thu, 14 Sep 2000 22:33:25 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: Req.: The perfect Perl Editor?
Message-Id: <Vmcw5.25967$AW2.352389@news1.rdc2.pa.home.com>

"Tim Hammerquist" <tim@degree.ath.cx> wrote
 in messagenews:slrn8s0tfu.4t8.tim@degree.ath.cx...
> Anyone can recommend an editor, and while I sort of understand your
> logic in asking for a perl editor in a perl NG, it's really not an
> issue.  Despite the normally good taste most Perl fans have, some have
> been known to use Emacs.  *gasp!*

Editing perl scripts with emacs is great because emacs has a standard 'Perl'
major mode, which does nice things like indenting code properly by hitting
tab and flashing back to the opening curly when you type a closing curly.
Its pretty to tell if your curlies, parenthesis, or quotes are out of
alignment when you hit tab and the text doesn't align properly, which is a
good time saver.  It doesn't have a complete grasp on the syntax, for
instance it gets confused with quotes embedded in regular expressions, but
it still does admirable job, and its worth learning the dozen or so
control-x etc keystrokes necessary to get around a text document.

--Ben Kennedy





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

Date: Thu, 14 Sep 2000 23:54:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Req.: The perfect Perl Editor?
Message-Id: <ss2p8rjvct670@corp.supernews.com>

Mark-Jason Dominus (mjd@plover.com) wrote:
: In article <slrn8s0tfu.4t8.tim@degree.ath.cx>,
: Tim Hammerquist <tim@degree.ath.cx> wrote:
: >	pico
: 
: I find pico impossible because it doesn't do line numbering.  When the
: compiler says you have an error on line 57, you have to count 57 lines
: down manually. 

Not quite *that* bad.  Ctrl-c reports the current line; so you can page
down until you think you're in the neighborhood, get a ctrl-c report, and
zero in by successive refinements.  For my source files, which are seldom
more than a few hundred lines long, I can usually get to the right page
just by page-downing, and then either see the bad line immediately, or hit
it with the cursor in 1-2 more ctrl-c checks.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Every force evolves a form."
   |              - Shriekback


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

Date: 14 Sep 2000 23:29:12 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Silly grep tricks
Message-Id: <968974147.482651@elaine.furryape.com>

In article <MPG.142a133ef297f9e98ad5f@nntp.hpl.hp.com>,
Larry Rosler  <lr@hpl.hp.com> wrote:
>In article <968895240.227134@elaine.furryape.com>, 
>gorilla@elaine.furryape.com says...
>
>...
>
>> print "",(grep { /e/ } @a)[0],"\n";
>> 
>> Note, if you pass it to print, you'll have to force the parser to not
>> interpt the parenthesis as a function, that's what the useless "" is for.
>
>Instead of 'the useless ""' argument, a simple unary '+' is more 
>general, more obvious, trivially more efficient, and two strokes 
>shorter.

No doubt about the two strokes, but I personally find it clearer to 
use unary '+'s only when the scalar contains a number. Seeing a
+ screams arithemetic to me. 


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

Date: Fri, 15 Sep 2000 10:19:22 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: space available in hard disk for NT using perl
Message-Id: <MPG.142bf9f7bd81aa5b9897b3@localhost>

Hopes <hopes@ole.com> wrote ..
>¿Could anyone tell me if it is possible (and simple) to find the space
>available in a NT machine using Perl?

use the GetDriveSpace function contained in the Win32::AdminMisc module 
provided by Roth Consulting

  http://www.roth.net/perl/adminmisc/

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Fri, 15 Sep 2000 00:26:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Teaching Perl
Message-Id: <7vq2sskrsp4ntud1ahma18cj42n4km2q0a@4ax.com>

Adam Trace Spragg wrote:

>I decided to describe Perl (and general) programming to my girlfriend recently
>(who is a recent math major graduate).
>It
>was when I said that you could do "c=c+1" that she sort of flipped out.  In
>a math sense, "c=c+1" rarely ever makes sense.

Your girlfriend (and you?) is confusing assignment with equality.

Would you expect in a bormal programming language to do:

	12 = 3*x + 2*y
	15 = 2*x + 3*y

and the program come up with appropriate values for x and y?

Well, maybe you would. But that's not how it works.


	c = c + 1

does NOT mean that c is equal to c+1.

-- 
	Bart.


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

Date: Thu, 14 Sep 2000 17:59:26 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Teaching Perl
Message-Id: <39c1747a$1@news.microsoft.com>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:7vq2sskrsp4ntud1ahma18cj42n4km2q0a@4ax.com...
> Adam Trace Spragg wrote:
>
> >I decided to describe Perl (and general) programming to my girlfriend
recently
> >(who is a recent math major graduate).
> >It
> >was when I said that you could do "c=c+1" that she sort of flipped out.
In
> >a math sense, "c=c+1" rarely ever makes sense.
>
> Your girlfriend (and you?) is confusing assignment with equality.
>
> Would you expect in a bormal programming language to do:
>
> 12 = 3*x + 2*y
> 15 = 2*x + 3*y
>
> and the program come up with appropriate values for x and y?
>
> Well, maybe you would. But that's not how it works.
>
>
> c = c + 1
>
> does NOT mean that c is equal to c+1.

This has nothing to do with Perl anymore, but so what.
For your girlfriend being a mathematician maybe looking at it from a program
verification point of view might help.

The c on the left side and the c on the right side are not the same, you
must index them with a "pre" and a "post".

Now, rewriting this assignment yields (using mathematical equality):
    c[post]=c[pre]+1

Now, if I have another assignment c=c*2 immediately after the first one then
(using a different index) I will get
    c[post'] = c[pre']*2

However, because I know that c hasn't changed it value between the two
assignments Ik now that c[pre]'=c[post] which in turn is equal to c[pre]+1
and therefore c[post']=(c[pre]+1)*2
Confusing, but maybe it will help.

jue






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

Date: 14 Sep 2000 22:32:04 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Test Your Perl Skills
Message-Id: <968970723.615875@hpvablab.cup.hp.com>



Hmm - not sure how that happened!

nospam@hairball.cup.hp.com (Richard J. Rauenzahn) writes:
>>>         a. $a && $b
>>>         b. $a 
>>>         $b
>>>         c. ! $a 
>>> 
>>> It says $a|$b is the right answer.  [No, that isn't a cut & paste error
>>> above.]
>>
>>well, at least (a) is true.  the short circuit operators return 
>>the last evaluated expression.  is the answer "$a|$b" even
>>an option?

It looks like they have output errors -- but what is humorous is that
the provided answer is listed only as $a|$b.

>>> In pattern matching, how do you match an octal value?
>>> 
>>>         a. \nnn (where nnn is that octal value)
>>>         b. \onnn (that's the letter 'o')
>>>         c. %onnn ( that's the letter 'o')
>>>         d. ^onnn ( that's the letter 'o')
>>>         e. \O ( that's the letter 'O') 
>>> 
>>> Obviously, the answer is (a)!
>>
>>maybe. it has to be a valid octal value.  perhaps the
>>question meant to specify { n a member of (0,1,2,3,4,5,6,7) }.
>>even then, the first digit has to be in the right range.

Or maybe they meant to ask how to represent a character in octal in a
string.  But none of those are valid regular expressions.  (btw, I
didn't really think the answer is a -- they do, though.)

>>> Which character sequence will match a word boundary?
>>> 
>>>         a. /b
>>>         b. /c
>>>         c. /t
>>>         d. /w
>>>         e. none 
>>> 
>>> Again, the answer is (a).
>>
>>are you sure that you typed that correctly?  none of those
>>are regex assertions.  perhaps you meant \b ?

That's how *they* typed it.

Rich

-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Fri, 15 Sep 2000 10:04:58 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: UNICODE & SSI
Message-Id: <MPG.142bf697666683589897b0@localhost>

sang <laoxiu100@hotmail.com> wrote ..
>Why i  cannot use SSI in UNICODE file?

and your Perl question is ?

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4327
**************************************


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