[10954] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4555 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 5 14:27:38 1999

Date: Tue, 5 Jan 99 11:01:32 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 5 Jan 1999     Volume: 8 Number: 4555

Today's topics:
    Re: Perl 5 for NT: How to do an End Process on a deadlo <caitlin@nospam.backstreet.net>
    Re: Perl and CR+LF (brian d foy)
    Re: Perl and CR+LF <pk@dwc.ch>
    Re: problem with XS (Greg Ward)
        Q: Minimal (stingy) Regular Expression serstad@acc.jc.edu
    Re: Q: Minimal (stingy) Regular Expression <pk@dwc.ch>
    Re: Q: Minimal (stingy) Regular Expression <grimes@waste.org>
        REVIEW: "Learning Perl", Randal L. Schwartz/Tom Christi (Rob Slade, doting grandpa of Ryan and Trevor)
    Re: Sendmail 8.9.1 makemap hash format and Perl <dieter.koegel@eur.sas.com>
    Re: sort hash by values <shum@cig.mot.com>
    Re: sort hash by values <yhu@mail.nih.gov>
        Zombie, threads, children disapearing <tom_jenquin@mgic.com>
    Re: Zombie, threads, children disapearing <dgris@moiraine.dimensional.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 05 Jan 1999 18:35:24 GMT
From: "Caitlin" <caitlin@nospam.backstreet.net>
Subject: Re: Perl 5 for NT: How to do an End Process on a deadlocked Perl process
Message-Id: <MXsk2.4777$Uv.586@news.rdc1.va.home.com>

Thanks for all of your suggestions. I have replied to some of your
points below.

>Out of curiosity, what are the hardware specs for your NT server?  If
>you are going to be running a lot of CGI off this machine, you need to
>have a fairly decent hardware (300MHz PII with 128Mb RAM or better).


P133 / 64MB ram (don't laugh... it works well for the load that we put on it
 ... OK feel free to laugh!)

>Lastly, when you tried to stop these scripts from Task Manager, were you
>logged in as an Administrator level account for the appropriate domain?
>Were you tryinig to stop perl.exe or was the script itself showing in
>TM?


I was logged in as an Administrator. Perl.exe showed up in TM. I was trying
to do an end-process on Perl.exe and was getting an "Access Is Denied"
message. I later found out that since Perl.exe was invoked by IIS and that
IIS
was running under the system account, I could not do an End-Process on it
unless
I ran TM under the system account. The only way I could figure out how to do
this
was to start the Scheduler service and use "AT time /INTERACTIVE taskmgr"
at a command prompt to schedule Taskmgr to run in a minute or two from the
current
time.

I suppose that I should upgrade to the latest build of Perl 5 for NT. I'm
currently
using 5.003 Build 316. It's been working well for over 6 months now. It
wasn't
untill we got into writing bad scripts that this problem surfaced.

Caitlin
>
>John Warner
>
>Caitlin wrote:
>
>> I have a number of users that are playing with Perl on our
>> NT IIS3 server. From time to time their script will go into
>> an infinite loop or become deadlocked waiting on a flock.
>> The CPU is pinned at 100% and I can't figure out kill these
>> Perl scripts.
>>
>> If I try to use End Process from Task Manager I get an
>> "Access is denied" error message. I'm logged in as the
>> admin but I fear that since the parent of the Perl process
>> is a system service (i.e. IIS) I'm out of luck. Is there any
>> way to "kill" a Perl process without "killing" the author of
>> the script?
>> --
>> Caitlin
>




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

Date: Tue, 05 Jan 1999 12:40:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl and CR+LF
Message-Id: <comdog-ya02408000R0501991240510001@news.panix.com>

In article <3691FB67.39CA089@bbaw.de>, Joachim von Thadden <thadden@bbaw.de> posted:

> This is an obsolete problem in the 20th century, but it still exists. I
> have users who write perl-cgi-scripts on Win95-Clients and transfer them
> by samba to a linux host, where they should be executed. But the perl
> version on linux doesn't want to deal with the line endings (CR+LF).

transfer them is ascii mode (or is that a samba problem?) or use
something like dos2unix to strip the extra characters.

good luck :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Tue, 05 Jan 1999 18:55:07 +0100
From: Per Kistler <pk@dwc.ch>
To: Joachim von Thadden <thadden@bbaw.de>
Subject: Re: Perl and CR+LF
Message-Id: <369251FB.438D2D3D@dwc.ch>

Hi Joachim

$/ = "\r\n";

> there, despite of conversing the scripts, a perl parameter to tell it to
> take a different lineending? Otherwise I have to use a wrapper, which is
> not a nice solution.

Per.

-- 
Per Kistler
Digital Wire Consulting
pk@dwc.ch (or: kistler@gmx.net)
-----------------------------------------------------------------------


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

Date: 5 Jan 1999 18:30:03 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: problem with XS
Message-Id: <76tlnb$p5o$3@news0-alterdial.uu.net>

kozo <kozo@pobox.sk> wrote:
> I trying write extension in C ..but I have a problem ..
> I have in C function
> extern int
> eparse (char *filename,
>         HASH* cmds,
>         FILE *stream) 
> in typemap I have:
> TYPEMAP
> HASH *  T_PTR
> FILE *  T_IN
> 
> --- eparse.h ---
> /* eparse header file */
>                                             
> extern int
> eparse (char *filename, HASH* cmds, FILE *stream) 
> 
> --------------
> I made Eparse from h2xs -x -n Eparse eparse.h
> 
> and Error after make: 
> In file included from Eparse.xs:11:
> eparse.h:4: parse error before `HASH'

That's a C problem, not an XS problem.  You have to declare your HASH
type before the function is defined (in the .c file) and also before it
is declared (in the .h file).  The usual way to do this is to move the
'typedef ... HASH' from your eparse.c (assuming that's where it is) to
eparse.h.  If HASH is typedef'd in another .h file, include it in
eparse.h.

Hmmm, that's enough C for one day... back to Perl please!

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 05 Jan 1999 17:13:45 GMT
From: serstad@acc.jc.edu
Subject: Q: Minimal (stingy) Regular Expression
Message-Id: <76th87$dlv$1@nnrp1.dejanews.com>

Ok -- I'm banging my head against the wall here - missing something stupid I'm
sure.

I want to match everything between these two things:  " .... cgi"
(a leading quote and the letters cgi followed by a quote)

I've got the regexp down, but it's doing maximal ("greedy) matching -- I
thought I would throw in a ? to do the minimal thing, but it's not working!

Here's two examples of what I want to find, along with the regexp I'm using.

Code:

while (<>) {
   if (/(\".*?cgi\")/) {print "$1\n";}
}

Example Search Strings:

  method="GET" action="/cgi-bin/wais/resource.cgi"
  method=GET action="/cgi-bin/wais/resource.cgi"

In both cases, I would like to print simply "/cgi-bin/wais/resource.cgi"
However, the first one prints the whole damn thing from the very first quote
to the very last quote (it's greedy?).

Ayone help?  Thanks,
Sped (serstad@acc.jc.edu)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 05 Jan 1999 18:38:39 +0100
From: Per Kistler <pk@dwc.ch>
To: serstad@acc.jc.edu
Subject: Re: Q: Minimal (stingy) Regular Expression
Message-Id: <36924E1F.2AFEDE9F@dwc.ch>

Hi Sped

Use a .* before the (), because that one will be greedy
too:-)

Per.

> while (<>) {
>    if (/(\".*?cgi\")/) {print "$1\n";}
> }

-- 
Per Kistler
Digital Wire Consulting
pk@dwc.ch (or: kistler@gmx.net)
-----------------------------------------------------------------------


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

Date: Tue, 5 Jan 1999 12:35:45 -0600
From: Peter Grimes <grimes@waste.org>
Subject: Re: Q: Minimal (stingy) Regular Expression
Message-Id: <Pine.LNX.3.96.990105120051.16556A-100000@waste.org>

On Tue, 5 Jan 1999 serstad@acc.jc.edu wrote:

> I've got the regexp down, but it's doing maximal ("greedy) matching -- I
> thought I would throw in a ? to do the minimal thing, but it's not working!

No, it's actually doing minimal.  (see below for explanation)

> while (<>) {
>    if (/(\".*?cgi\")/) {print "$1\n";}
> }
> 
> Example Search Strings:
> 
>   method="GET" action="/cgi-bin/wais/resource.cgi"
>   method=GET action="/cgi-bin/wais/resource.cgi"

> In both cases, I would like to print simply "/cgi-bin/wais/resource.cgi"
> However, the first one prints the whole damn thing from the very first quote
> to the very last quote (it's greedy?).

Non-greedy only refers to how many characters _after the first match_ it
matches.  If you had the following:

method="GET" action="/cgi-bin/wais/resource.cgi" useless="stuff.cgi"

yours would match (non-greedily)

"GET" action="/cgi-bin/wais/resource.cgi"

A greedy match would go all the way to the "stuff.cgi" string

To get what you want try something like this (BTW, there's no need to
escape double quotes in a regex)

/action=(".*?cgi")/   #if it will always be preceded by 'action='

or

/.*(".*?cgi")/  #matches the last ".*?cgi" on a line


-Dave



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

Date: Tue, 05 Jan 1999 18:07:15 GMT
From: rslade@sprint.ca (Rob Slade, doting grandpa of Ryan and Trevor)
Subject: REVIEW: "Learning Perl", Randal L. Schwartz/Tom Christiansen
Message-Id: <nxsk2.68999$c8.33549073@hme2.newscontent-01.sprint.ca>

BKLRNPRL.RVW  981024

"Learning Perl", Randal L. Schwartz/Tom Christiansen, 1997,
1-56592-284-0, U$29.95/C$42.95
%A   Randal L. Schwartz
%A   Tom Christiansen
%C   103 Morris Street, Suite A, Sebastopol, CA   95472
%D   1997
%G   1-56592-284-0
%I   O'Reilly & Associates, Inc.
%O   U$29.95/C$42.95 800-998-9938 fax: 707-829-0104 nuts@ora.com
%P   302 p.
%T   "Learning Perl, second edition"

One of the advantages of the Apple II computer (Yes, son, I *am* old
enough to remember that.  Now put that lollipop down and listen) was
the Applesoft tutorial on the BASIC computer language.  With a steady
pace, interesting examples, some wit, and a reasonable curriculum, it
taught tens, perhaps even hundreds of thousands of people, how to
program.  It taught them BASIC, of course, which was a fatal flaw, but
you can't have everything.  The loss of the tutorial book, in the IIg
and Mac lines, was a regrettable happening.

"Learning Perl" may not take its place entirely, but it comes close. 
The humour is definitely there, starting even before the book does, in
the foreword.  Sometimes it is devious and subtle, as in the program
which asks for "any last request" ... and then discards the input
before informing the hapless user that the request cannot be
performed.  The pacing is realistic, as are the examples, although
perhaps a bit slow to come to something useful, or likely to grab
immediate attention.

However, this book is not going to make many converts from the non-
programming crowd.  While chapter one is a very careful, step-by-step,
approach to input and output, with some manipulations of text for
error checking, chapter two immediately plunges into scalar variable
and all operators, while three deals with arrays.  Not that the
sections are written poorly, by any means, but they would be a tad
intimidating for the novice.

Other topics covered include control structures, hashes, basic I/O,
regular expressions, functions, miscellaneous control structures,
filehandles and file tests, formats, directory access, file and
directory manipulation, process management, other data transformation,
system database access, user database manipulation, converting other
languages to Perl, and CGI programming.

For those who are truly keen to learn Perl (such as the legions of
Webmasters needing to collect and manipulate data from forms) this is
a good introduction.  There are questions at the end of each chapter,
and an appendix with the answers.  Appendix B lists libraries and
modules, C gives a brief introduction to networking topics in Perl,
and D covers other topics.

The foreword promotes Perl as a general purpose computer language.  If
that is so, then it is a very complex tool and one cannot expect much
of a tutorial.  On the other hand, references to Perl tend to stress
its capacity for building "quick and dirty" tools for text
manipulation, primarily mail.  If this is so, then some simple but
real-life examples, such as a rot13 reader or a program to extract
articles from electronic digests, would have improved the work.

copyright Robert M. Slade, 1993, 1998   BKLRNPRL.RVW  981024

-- 
======================
rslade@vcn.bc.ca  rslade@sprint.ca  robertslade@usa.net  p1@canada.com
Subscribe to techbooks mailing list at techbooks-subscribe@egroups.com
       or via the Web at http://www.eGroups.com/list/techbooks/
Robert Slade's Guide to Computer Viruses, 0-387-94663-2 (800-SPRINGER)



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

Date: Tue, 5 Jan 1999 17:52:55 GMT
From: Dieter Koegel <dieter.koegel@eur.sas.com>
To: Andrew Pollock <apollock@bit.net.au>
Subject: Re: Sendmail 8.9.1 makemap hash format and Perl
Message-Id: <36925177.CFFEA736@eur.sas.com>

Hi,

I'm not too familiar with perl's dbmopen however:

- depending on what dbm (newdbm, hash) you used when creating the
aliases databases the extension of the database is AFAIK either .dir or
 .pag

- probably you also have have to specify the database type when using
dbmopen


Hope this helps 



Dieter



Andrew Pollock wrote:
> 
> Apologies if I'm asking a FAQ...
> 
> The following Perl code doesn't work with hashes built with makemap that
> comes with Sendmail 8.9.1
> 
> dbmopen %ALIASES, "/etc/aliases", 0666 || die "Can't open aliases: $!\n";
> 
> while (($key,$val) = each %ALIASES) {
>         print $key, ' = ', $val, "\n";
> }
> dbmclose %ALIASES
> 
> Is there any way to get this functionality back?
> 
> Andrew

-- 

___________________________________________________________________________
Dieter Koegel                      Email: dieter.koegel@eur.sas.com
Unix System Administrator          http://members.xoom.com/eurdrk (ext.) 
Systems and Operations             http://www.eur.sas.com/~eurdrk (int.)

SAS Institute                      Tel:  (49) 6221/416-117
European Headquarters              Fax:  (49) 6221/474850
Neuenheimer Landstrasse 28-30
P.O.-BOX 105340
D-69120 Heidelberg, Germany
___________________________________________________________________________


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

Date: Tue, 05 Jan 1999 10:28:54 -0600
From: Edmond Shum <shum@cig.mot.com>
Subject: Re: sort hash by values
Message-Id: <36923DC6.9C35384@cig.mot.com>

Pardon me if this is in html format. I am trying to configure the
browser to use only plain text.

Have you tried:

foreach $key ( sort { $my_hash{$a} <=> $my_hash{$b} } keys %my_hash )
{ &do_something ; }

Looks like that the statement:

while (($key, sort {$a<=>$b} $value ) = each %my_hash ) { }

will fail because ($k,$v) = each %my_hash is an assignment statement.
You cannot alter the order while it is being assigned.

-- 
Edmond Shum                     System and Network Administration 
Motorola CIG			email: shum@cig.mot.com         
Arlington Heights, IL		phone: 847-632-6702


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

Date: Tue, 05 Jan 1999 12:24:08 -0500
From: Ying Hu <yhu@mail.nih.gov>
Subject: Re: sort hash by values
Message-Id: <36924AB8.1FBF2B7D@mail.nih.gov>

I wanted as the following:

foreach $key (keys %hash_sorted_by_their_values){
    @doing;
}

Staffan Liljas wrote:

> > while (($key, sort {$a<=>$b}$value) = each %my_hash){
> >     &doing_something;
>
> From perlfunc keys:
>
> [snip] how about sorted by key:
>
> foreach $key (sort(keys %ENV))
>
> [snip] Here's a descending numeric sort of a hash by its values:
>
> foreach $key (sort { $hash{$b} <=> $hash{$a} } keys %hash)
>
> and then, off course, $value is $hash{ $key }...
>
> Staffan





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

Date: Tue, 05 Jan 1999 10:10:15 -0600
From: Tom Jenquin <tom_jenquin@mgic.com>
Subject: Zombie, threads, children disapearing
Message-Id: <36923966.5B26510A@mgic.com>

OS: UNIX; Solaris 2.5.1
PERL: 5.004_04
Latest change:  Added threads to perl for use with MQ Series
After I added threads my all of my socket server type applications began
having processing children disappear.  I am using a reaper process to
remove zombies.

After disabling the reaper process (living with lots of zombies), I find
that all of my children complete normally.

HELP!?



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

Date: 05 Jan 1999 10:44:34 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Zombie, threads, children disapearing
Message-Id: <m3ww318vi5.fsf@moiraine.dimensional.com>

Tom Jenquin <tom_jenquin@mgic.com> writes:

> OS: UNIX; Solaris 2.5.1
> PERL: 5.004_04
        ^^^^^^^^^
> Latest change:  Added threads to perl for use with MQ Series
                  ^^^^^^^^^^^^^
I doubt it, threads are not available in 5.004_0x no matter how
hard you try.

> After I added threads my all of my socket server type applications began
> having processing children disappear.  I am using a reaper process to
> remove zombies.

I'm guessing that when you say threads you mean that you've moved
to a fork/exec model of execution.  They aren't the same thing, you'll
just confuse yourself if you think of them that way.

> After disabling the reaper process (living with lots of zombies), I find
> that all of my children complete normally.
> 
> HELP!?

We can't help at all if you don't show us the code that causes the
problem.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4555
**************************************

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