[16660] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4072 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 20 14:05:46 2000

Date: Sun, 20 Aug 2000 11:05:13 -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: <966794712-v9-i4072@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 20 Aug 2000     Volume: 9 Number: 4072

Today's topics:
    Re: Apache and cgi/perl (Thomas Brusca)
    Re: Authorizing Users <aran@mapcruzin.com>
    Re: Authorizing Users (Martien Verbruggen)
    Re: Authorizing Users <flavell@mail.cern.ch>
        Compiling code at run-time, not compile-time <carvdawg@patriot.net>
    Re: Compiling code at run-time, not compile-time (Martien Verbruggen)
    Re: cross platform newline processing <iltzu@sci.invalid>
    Re: cross platform newline processing (Eric Bohlman)
    Re: cross platform newline processing (Abigail)
    Re: crypt function (Keith Calvert Ivey)
    Re: DBI has me stumped... maybe OO problem? <dale@emmons.dontspamme.com>
    Re: DBI has me stumped... maybe OO problem? <dale@emmons.dontspamme.com>
    Re: Differing parses under 5.005, 5.6? <jpl@research.att.com>
    Re: Forking sub{}'s and selective SIG{CHLD} responses (Abigail)
    Re: Forking sub{}'s and selective SIG{CHLD} responses <unixgod@jacksonville.net>
    Re: How do I get statistics from Win NT processes? (ie  <carvdawg@patriot.net>
    Re: installation help required ... Window 98 based <mauldin@netstorm.net>
    Re: Localize "require" to subdomain <sb@muccpu1.muc.sdm.de>
    Re: London £30-35K Perl Programmers Required <zacarias@teleline.es>
    Re: London £30-35K Perl Programmers Required (Eric Bohlman)
        Newbie Needs Help with string comparison (Warren)
        perl5.6 new reg-ex errors (but only when you're on crac <maraist@udel.edu>
    Re: Regex: finding location in (?{}) (Abigail)
    Re: Running Perl-Script as NT-Service <luis_garzon@ibi.com>
    Re: setting up a cgi directory <alesr@siol.net>
    Re: using perl to interact with a telnet session <carvdawg@patriot.net>
        Was: Is unless($myhash{$some_variable} = 1) my problem  <webmaster@ostas.lu.se>
        Wildcards in DOS 'dir' command jblatz2@my-deja.com
    Re: Wildcards in DOS 'dir' command <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 19 Aug 2000 15:54:18 GMT
From: tebrusca@oakland.edu (Thomas Brusca)
Subject: Re: Apache and cgi/perl
Message-Id: <8nmaja$kme$1@news2.acs.oakland.edu>

In comp.lang.perl.misc J. Round <round@ebtech.net> wrote:

Apache Win32 handles this.

I made a /usr/local/bin on the same drive as apache runs in.
I copied the perl.exe into that directory and everything 
runs fine.

#!/usr/local/bin/perl is what I use and I don't have to
change it later.



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

Date: Sun, 20 Aug 2000 12:26:11 GMT
From: "Aran Meuser" <aran@mapcruzin.com>
Subject: Re: Authorizing Users
Message-Id: <D7Qn5.3824$km2.876912@typhoon-news2.southeast.rr.com>

Damn that was RUDE!  Oh well, but I take what you said in truth and will go
to those newsgroups.  There are billions of people in the world, so that
means billions of mistakes for beginners... so, lay off man.  And yes, about
90% of what you wrote I already know.  I'm authenticating through the CGI
script, and I know the web server can do it.  This is supposed to be
multi-platform.  Can't use .htaccess on IIS and can't use Win32 modules on
Apahe Linux.

So many people with huge egos and pride, I'm amazed that you're all able to
even work together.

Anyway, thanks.

    Aran


"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn8pu9k4.qmo.mgjv@martien.heliotrope.home...
> On Sat, 19 Aug 2000 19:30:19 GMT,
> Aran Meuser <aran@mapcruzin.com> wrote:
> > (CGI)
>
> Indeed. So why ask here? The comp.infosystems.www.* groups are much more
> appropriate.
>
> > Hey, I'm trying to authorize users.  I have various reasons for not
using
> > forms to do it.  What I have now is:
>
> Then don't use forms. Use the standard mechanisms implemented by your
> HTTP server. Authentication should never be coded at the CGI level,
> unless it's authentication above and beyond what the server is already
> doing.
>
> > print "Status: 401 Unauthorized\n";
> > print "WWW-Authenticate: Basic realm=\"Blah Blah\"\n\n";
>
> Oh, good. Perl code to comment on:
>
> If you use the qq() operator, you don't have to use as many backwhacks.
>
> > This works in Netscape and IE, so thats good.  But, I cannot figure
> > out what to do after this point.  I printed every environment variable
> > to a text file and I still can't seem to find the part that says the
> > login and password that the user entered.
>
> Whether you write this in C, Cobol, Fortran, Java, Perl PostScript, or
> BananaScript, the solution to the problem would be the same. Just the
> code would be different. So... Go to one of the comp.infosystems.www.*
> groups, and ask around there how people normally do authentication with
> webby applications. If you're still convinced after that that you need
> to do it in your CGI thingy, implement the solution you found there. If
> you at that point have trouble with Perl, NOT with the algorithms,
> techniques or general programming issues, then you can come back and
> ask.
>
> Thank you for keeping this group uncluttered
>
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | +++ Out of Cheese Error +++ Reinstall
> Commercial Dynamics Pty. Ltd.   | Universe and Reboot +++
> NSW, Australia                  |




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

Date: 20 Aug 2000 13:07:34 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Authorizing Users
Message-Id: <slrn8pvm11.5ds.mgjv@martien.heliotrope.home>

On Sun, 20 Aug 2000 12:26:11 GMT,
	Aran Meuser <aran@mapcruzin.com> wrote:
> Damn that was RUDE!  Oh well, but I take what you said in truth and will go

Euhmmm... Excuse me? You call that rude? And I suppose that not reading
a few posts to the group you are going to send an article to isn't rude?
If you had done that, you would have seen many posts that are more or
less similar to yours, all of them being referred to the correct group.
You would have seen, quite often, the statement that

Perl ne CGI and CGI ne Perl

and you would have realised that you were in the wrong place. Next time,
before you post, do the right thing, and check out the group. It'll
prevent you from having to deal with tremendous rudeness like mine.

Oh.. Had you read a few posts, you would also have known that in this
group, as in general on Usenet, people put their comments AFTER the
quoted text they reply to, as the arrow of time dictates.

[huge snip of unnecessarily and inappropriately misplaced quoted text]

Martien

PS. Don't respond. You'll only anger others, and I won't see it.
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Sun, 20 Aug 2000 15:33:02 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Authorizing Users
Message-Id: <Pine.GHP.4.21.0008201530310.11201-100000@hpplus03.cern.ch>

On Sun, 20 Aug 2000, Aran Meuser blurted out:

> Damn that was RUDE! 

Another applicant for the killfile.

Aren't there any newcomers left who're willing to respect the
community?  I guess the problem is that they don't actually wish
to join the community, but only to parasite the free benefits.




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

Date: Sun, 20 Aug 2000 07:48:10 -0400
From: H C <carvdawg@patriot.net>
Subject: Compiling code at run-time, not compile-time
Message-Id: <399FC57A.393AC51B@patriot.net>

Like all of you, I've got scripts that use the 'use' statement to
include modules and code
into the script so that everything compiles and runs nicely.

What I'm trying to do is this...I don't want all of the modules to be
compiled prior to the script
being run.  I would like to have the basic components compiled and run,
but at some point in the
code, something like this occurs:

if ([some condition]) {
  # compile code as with 'use' statement
  # then run it normally
}

Your time and effort is greatly appreciated!

c

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: 20 Aug 2000 12:15:20 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Compiling code at run-time, not compile-time
Message-Id: <slrn8pviou.5ds.mgjv@martien.heliotrope.home>

On Sun, 20 Aug 2000 07:48:10 -0400,
	H C <carvdawg@patriot.net> wrote:
> if ([some condition]) {
>   # compile code as with 'use' statement
>   # then run it normally
> }

# perldoc -f use
[snip]
          It is exactly equivalent to

    BEGIN { require Module; import Module LIST; }
[snip]

A few lines further it explains exactly what each statement in that line
means. You can also read:

# perldoc -f require
# perldoc -f import
# perldoc Exporter

if ( $foo == $bar )
{
	require Foo::Bar;
	import Foo::Bar qw(feebie banana);
	# .. do stuff
}

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | What's another word for Thesaurus?
NSW, Australia                  | 


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

Date: 20 Aug 2000 11:45:15 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: cross platform newline processing
Message-Id: <966771369.11780@itz.pp.sci.fi>

In article <399B10D1.C8B1EFB5@yahoo.com>, Mark Johnson wrote:
>    I need to read text files line by line. Problem is these text files
>may have been created on Mac, PC or unix.  As a consequence I don't know
>whether the newline code is CR or LF or CR LF.

First, read all the input into a scalar:

  my $input = do { local $/; <> };

Then substitute CR and CRLF with LF:

  $input =~ s/\cM\cJ?/\cJ/g;

Then translate LF to the logical line break on your system:

  $input =~ tr/\cJ/\n/;

>p.s. The program will be running on a unix box if that matters.

Okay, in that case the last step is needless.


>    I have searched FAQs on CPAN and at www.perl.com, but I can't find
>anything that deals with this situation.  Can anybody point me in the
>direction of a solution?

Now that you have a solution, read the rest of the thread - especially
Alan J. Flavell's posts - to understand the problem.  Try searching at
Deja or Remarq for earlier threads on this subject as well.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 20 Aug 2000 13:18:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: cross platform newline processing
Message-Id: <8nolr7$3gl$2@slb7.atl.mindspring.net>

Ilmari Karonen (iltzu@sci.invalid) wrote:
: In article <399B10D1.C8B1EFB5@yahoo.com>, Mark Johnson wrote:
: >    I need to read text files line by line. Problem is these text files
: >may have been created on Mac, PC or unix.  As a consequence I don't know
: >whether the newline code is CR or LF or CR LF.
: 
: First, read all the input into a scalar:
: 
:   my $input = do { local $/; <> };

While this will work on a Unix machine (and therefore for Mark), on other
platforms you'll need to binmode() the input file handle, which is
unfortunately rather hard to do with the blank diamond operator; better to
explicitly open a handle in that case. 



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

Date: 20 Aug 2000 14:33:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: cross platform newline processing
Message-Id: <slrn8pvr0d.tj3.abigail@alexandra.foad.org>

Ilmari Karonen (iltzu@sci.invalid) wrote on MMDXLVI September MCMXCIII in
<URL:news:966771369.11780@itz.pp.sci.fi>:
// In article <399B10D1.C8B1EFB5@yahoo.com>, Mark Johnson wrote:
// >    I need to read text files line by line. Problem is these text files
// >may have been created on Mac, PC or unix.  As a consequence I don't know
// >whether the newline code is CR or LF or CR LF.
// 
// First, read all the input into a scalar:
// 
//   my $input = do { local $/; <> };
// 
// Then substitute CR and CRLF with LF:
// 
//   $input =~ s/\cM\cJ?/\cJ/g;
// 
// Then translate LF to the logical line break on your system:
// 
//   $input =~ tr/\cJ/\n/;

That assumes that a platform using CR LF never has a lone CR or lone LF in
their lines. It also assumes that a platform using CR never has a LF, and
a platform using a LF never has a CR. That's not appropriate - you wouldn't
assume such platforms don't use the letter `a' either, would you?

Basically what you are doing is making a fourth platform, where both CR
*and* LF terminate lines, (but a CR LF combo terminates one). It's a
platform not compatible with either Unix, Windows or MacOS.

Determining on which platform a text file was created is hard, and it's
impossible to do it always correctly. Posting solutions to problems which
make assumptions without stating those assumptions is bad.


Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Sun, 20 Aug 2000 13:25:31 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: crypt function
Message-Id: <39add6c5.85079077@news.newsguy.com>

newsgroups@ckeith.clara.net (Colin Keith) wrote:
>In article <8neaoq$tid$1@nnrp1.deja.com>, sankarmukh@my-deja.com wrote:

>> sub decrypt {
>>             $crypted = shift;
>>             local $" = "";
>>             foreach $x[0] ("\x00" .. "\xFF") {             foreach
>>$x[1] ("\x00" .. "\xFF") {             foreach $x[2] ("\x00" .. "\xFF")
>>{
>>     foreach $x[3] ("\x00" .. "\xFF") {             foreach $x[4]
>>("\x00" .. "\xFF") {             foreach $x[5] ("\x00" .. "\xFF") {
>> foreach $x[6] ("\x00" .. "\xFF") {             foreach $x[7] ("\x00" ..
>>"\xFF") {                 return "@x" if $crypted eq crypt "@x",
>> $crypted;             
>>         }
>> print "\n";
>> print "$crypted";
>> ~
>> ~
>> "crypt_san.pl" 21 lines, 669 characters
>> devwk77:/u/ctssmuk> crypt_san.pl
>> syntax error at crypt_san.pl line 9, near "$x["
>
>In "foreach $x[0] ( .. )" you can't assign to an array element, you can only 
>assign to a scalar. Perlsyn man page: "foreach probably won't do what you 
>expect if VAR is a tied or other special variable.   Don't do that either."

And even if that error were fixed, the range operator won't work
on arbitrary bytes like that ("\x00" .. "\xFF").

And even if that were fixed, the subroutine still has to check
nearly 1e19 possibilities on average to find the decrypted
version (assuming it doesn't find another string instead that
produces the same crypted version).

The person who found this subroutine might want to consider that
other questions in the same FAQ (IAQ, actually) include "How do
I determine the shoe size of a directory?" and "I am a boy
scout. How can I use Perl in my day-to-day scout business?" and
that the date is 1999/04/01:

    http://www.plover.com/~mjd/perl/IAQ/

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Sun, 20 Aug 2000 11:09:48 -0500
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: DBI has me stumped... maybe OO problem?
Message-Id: <sq00cugj87v162@corp.supernews.com>

> (snippage)
>
> > I'm writing a program that outputs a schedule of when people have to
> > work at an ambulance service. There are 6 types of shifts per day:
> > day emt, paramedic, trainee, night emt, paramedic, trainee.
>
>
> This description of needs is highly inconsistent with reality
> and in direct contradiction of standards in practice for
> Emergency Medical Services as set by both state and federal
> guidelines, requirements and statues. Your description also
> contradicts well followed guidelines set by our national
> EMS Foundation.
>
> You are seventeen and responsible for EMS scheduling?

Well, not really. I've been hired by a consultant of the EMS company to
write a web app that manages the scheduling... it only manages it, not
generates it.

It allows a user to log in and request shifts. An admin can then log in and
either approve or reject those requests. The program then displays the
approved schedule using the script that I'm having problems with right now.

-Dale





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

Date: Sun, 20 Aug 2000 11:24:43 -0500
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: DBI has me stumped... maybe OO problem?
Message-Id: <sq018tog87v127@corp.supernews.com>


> >This problem has stumped me for the last few hours, and I've finally
broken
> >down and decided to ask you guys:
>
> Would have been easier if you broke it down a bit further. But anyway.
>
> >The script starts a db connection at the beginning, calls
print_calendar() ,
> >closes the db connection and exits.
>
> It might have been relevant to mention which database.

mysql 3.22.25, on SunOS 5.7

> [ lots of code snipped ]
>
> >    # shorten up the first name
> >    $requester_first_name = tr/^.{1}/$1/;
>
> tr/// is not what you want. and you used = instead of =~
> and you don't understand grouping. This shouldn't work at all.
> Get a good book on regexes or see
> http://keck.ucsf.edu/~kvale/perlrequick.pod
>
> This task is too simple for regexes anyway.
>
>      $requester_first_name = substr($requester_first_name,0,1);
>
> I dislike this personally, because now $requester_first_name isn't.
> Maybe use a new variable called $requester_initial.

Oh, thanks for catching that... I would have eventually...

> >The problem that I have is that for the first day of the month the script
> >will properly return the users that have scheduled that day, but
> >my ($state, $requester_id) = $dbh->selectrow_array(qq{
> >returns undef's for any other day, even if the database actually returns
> >values. The script works if I make a new db connection (thus a new
object)
> >at the beginning of this sub and close it at the end
>
> Sounds like something went amiss on the database end, since you
> don't mention any perl warnings or errors. You are using selectrow(), is
it
> possible that more than one row is returned?

I don't think it has to do with the database directly, because when I run
the querys through mysql manually (on the days and times I know there are
people scheduled) it returns what it should... and only one row of it.
(there aren't any entries when the slots are 'open'.)

mysql> SELECT state, requester_id
    -> FROM shifts
    -> WHERE date = '2000-8-2'
    -> AND day_night = 'day'
    -> AND type = 'paramedic'
    -> ;
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    174659
Current database: db21505e

+----------+--------------+
| state    | requester_id |
+----------+--------------+
| awaiting | emmodale     |
+----------+--------------+
1 row in set (0.37 sec)

Also, like I said before, the script works just fine if I create a new
connection at the beginning of the sub and close the new connection at the
end. I don't want 180 connections per pageveiew though, of course.

> Sometimes waving the dead chicken of $stmt->finish() will fix that
> kind of problem, MS Access was once notorious for that. See the DBI
> documentation.

I'll try that... when I get home later tonight. Do you have any other ideas?

> Style commentary: why no placeholders? See DBI documentation for details.

Didn't know what they are...

> --
> Neil Kandalgaonkar <neil@brevity.org>

Thanks much for the help thus far.
-Dale




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

Date: Sun, 20 Aug 2000 15:43:20 GMT
From: "John P. Linderman" <jpl@research.att.com>
Subject: Re: Differing parses under 5.005, 5.6?
Message-Id: <399FFC98.B92E6611@research.att.com>

Jeff Boes wrote:

> The following code worked _just fine_ under 5.00503. Under 5.6, however,
> perl complains about
>
> Variable "$userdata" is not imported at testvars.pl line 7.
> Global symbol "$userdata" requires explicit package name at testvars.pl
> line 7.
>
> use strict;
> use vars qw(%userdata %_pages @sortlist @showlist);
>
> sub showfolder_count_unshown_items {
>    return 0 if $userdata{show0};
>    @showlist = grep((
>                      $userdata{show0}
>                      or /^f/
>                      or !defined($_pages{$_})
>                      or &refisnew($_pages{$_})
>                      or ($_pages{$_}->{status} ne 'VALID')
>                      or ($_pages{$_}->{score} > 0)
>                      ), @sortlist);
>    scalar(@sortlist) - scalar(@showlist);
> }
>
> Now, the odd thing here is that if you take line 7 and move it,
>
>    @showlist = grep((
>                      /^f/
>                      or !defined($_pages{$_})
>                      or &refisnew($_pages{$_})
>                      or ($_pages{$_}->{status} ne 'VALID')
>                      or ($_pages{$_}->{score} > 0)
>                      or $userdata{show0}
>                      ), @sortlist);
>
> then it parses just fine. (By the way, I realize that the logic in this
> code is probably wrong, and since $userdata{show0} doesn't change within
> the grep-loop, it really doesn't need to be re-evaluated for each trip.
> That's not the issue. The code worked, and we were reluctant to change
> it. Then 5.6 breaks it, and now we will rewrite it anyway.)
>
> Is this a 5.6 bug?

To further muddy the waters, If I comment out the
# use strict;
at line 1, and run my 5.005 perl  with -MO=Deparse,B
I get (reformatted to fit nicely)

sub showfolder_count_unshown_items {
    return 0 if $userdata{'show0'};
    @showlist = grep(($userdata{'show0'} ||
        /^f/ ||
        !defined($_pages{$_}) ||
        &refisnew($_pages{$_}) ||
        $_pages{$_}{'status'} ne 'VALID' ||
        $_pages{$_}{'score'} > 0), @sortlist);
    scalar(@sortlist) - scalar(@showlist);
}

with 5.6, the same run yields

Can't call method "sibling" on an undefined value at
<path to my local 5.6 lib>/B/Deparse.pm line 258.
CHECK failed--call queue aborted.

I'd be inclined to call that a bug.
John P. Linderman  jpl@research.att.com



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

Date: 20 Aug 2000 15:03:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Forking sub{}'s and selective SIG{CHLD} responses
Message-Id: <slrn8pvsp3.tj3.abigail@alexandra.foad.org>

Mark Neill (unixgod@jacksonville.net) wrote on MMDXLV September MCMXCIII
in <URL:news:c9mn5.31202$56.137501@typhoon.jacksonville.mediaone.net>:
"" Please respond in Email as well, I don't normally frequent this newsgroup -
"" 
"" I'm having a problem with a program I'm writing that inconveniently happens
"" to be under a deadline.


So, you are under a deadline, ask a question here, but you cannot be
bothered to actually read the group looking for solutions to your
problem?

Must not be an important deadline then.



Abigail
-- 
$"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_;
sub   _   {push         @_ => /::(.*)/s and goto &{ shift}}
sub shift {print shift; @_              and goto &{+shift}}
Hack ("Just", "Perl ", " ano", "er\n", "ther "); # 20000720


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

Date: Sun, 20 Aug 2000 17:43:07 GMT
From: "Mark Neill" <unixgod@jacksonville.net>
Subject: Re: Forking sub{}'s and selective SIG{CHLD} responses
Message-Id: <LMUn5.35066$56.146474@typhoon.jacksonville.mediaone.net>

Grumpy unhelpful response sent to Abigail...in the meantime:

None of the following resources indicated how to handle selective SIG{CHLD}
messages:

    Perl.com
    Perl.org
    This newsgroup (fork, SIG, and CHLD searches)
    Yahoo
    Altavista
    Ask Jeeves
    The Perl CD Bookshelf, including the fork() reciped in the Perl
Cookbook.

Any useful responses welcomed :)

"Abigail" <abigail@foad.org> wrote in message
news:slrn8pvsp3.tj3.abigail@alexandra.foad.org...
> Mark Neill (unixgod@jacksonville.net) wrote on MMDXLV September MCMXCIII
> in <URL:news:c9mn5.31202$56.137501@typhoon.jacksonville.mediaone.net>:
> "" Please respond in Email as well, I don't normally frequent this
newsgroup -
> ""
> "" I'm having a problem with a program I'm writing that inconveniently
happens
> "" to be under a deadline.
>
>
> So, you are under a deadline, ask a question here, but you cannot be
> bothered to actually read the group looking for solutions to your
> problem?
>
> Must not be an important deadline then.
>
>
>
> Abigail
> --
> $"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_;
> sub   _   {push         @_ => /::(.*)/s and goto &{ shift}}
> sub shift {print shift; @_              and goto &{+shift}}
> Hack ("Just", "Perl ", " ano", "er\n", "ther "); # 20000720




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

Date: Sun, 20 Aug 2000 06:54:46 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: How do I get statistics from Win NT processes? (ie total memory used    by process)
Message-Id: <399FB8F6.C7410BA3@patriot.net>



> Be that the case, I shall check it out myself, thanks.

http://patriot.net/~carvdawg/perl.html

Check out 'wmi.pl'...it uses WMI (via Perl) to retrieve lots of info from
systems...to include
processes...


--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: Sun, 20 Aug 2000 10:38:10 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: installation help required ... Window 98 based
Message-Id: <399FB461.EAD301AB@netstorm.net>

"MENZpage.com" wrote:
> 
> I am able to test my scripts at the command line with no problems.  The
> output is as expected.  However, when I call up a known working script in my
> browser, I get a "HTTP 500 - Internal server error" message.

This is the first question in perlfaq9: "My CGI script runs from the
command line but not the browser (500 Server Error)".

http://www.cpan.org/doc/manual/html/pod/perlfaq.html

This gets asked a lot here, but as you'll see, it isn't a Perl question.

-- Jim


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

Date: 20 Aug 2000 10:21:46 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Localize "require" to subdomain
Message-Id: <8nobfq$l2t$1@solti3.sdm.de>

In article <dzNn5.3572$Nz4.162641@newsread1.prod.itd.earthlink.net>, Jacob Morrrison <zikeweb@earthlink.net> wrote:

> Is there a way you can make the variables retrieved with a required file to
> only be avalible in the subroutine it was required in? thanks,
> Jacob Morrison

Trivial: the "require"d code must have a "package" declaration.

-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Sun, 20 Aug 2000 11:27:38 GMT
From: Zacarias <zacarias@teleline.es>
Subject: Re: London £30-35K Perl Programmers Required
Message-Id: <EAbMNrrMmW0vg8LwWQGPrfqdrMzX@4ax.com>


>Well, let's see... 35k pounds is like $20-25 dollars per hour. I don't think
>anyone in this newsgroup, except maybe yourself, would even piss for that
>little.
>
>Hell... I'm 17, I suck (relative to most people here) at perl, and I can
>still get $35-40/hour easily.

really?  where?

I don't suck at Perl (and I'm good at Delphi5, ASP3 and PHP4/MySQL
stuff) and I have trouble getting a good/stable job.




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

Date: 20 Aug 2000 13:15:47 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: London £30-35K Perl Programmers Required
Message-Id: <8nolm3$3gl$1@slb7.atl.mindspring.net>

Zacarias (zacarias@teleline.es) wrote:
: 
: >Well, let's see... 35k pounds is like $20-25 dollars per hour. I don't think
: >anyone in this newsgroup, except maybe yourself, would even piss for that
: >little.
: >
: >Hell... I'm 17, I suck (relative to most people here) at perl, and I can
: >still get $35-40/hour easily.
: 
: really?  where?
: 
: I don't suck at Perl (and I'm good at Delphi5, ASP3 and PHP4/MySQL
: stuff) and I have trouble getting a good/stable job.

Make sure you aren't comparing apples and oranges here.  I suspect Dale 
is talking about a freelance/contract hourly rate, which is normally 
about 2-3 times higher than a salaried employee's equivalent hourly rate.


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

Date: Sun, 20 Aug 2000 16:47:30 GMT
From: warren@desertwolf.com (Warren)
Subject: Newbie Needs Help with string comparison
Message-Id: <39a00c6c.594712837@news.gte.net>

I am trying to compare the IP address for a user using a script, to a
separate txt file of IP addresses. The script below is what I am
using. The result is a print-out of the IP addresses in the file
because it indicates that none in the file match the one in the
variable $IP and the value for $n is 0 because it says it found no
matches.  However, one of them in the file is my static IP address.
Any ideas on what I'm doing wrong?

#!/usr/local/bin/perl 

print "Content-type: text/html", "\n\n";

$IP = $ENV{'REMOTE_ADDR'};

open(FILE, "vote_test.dat");
	
@UserList = <FILE>;

$n = 0;
$ListPos = 0;

until($ListPos > $#UserList){
  if ($IP eq $UserList[$ListPos]) { 
	$n +=1; 
      $ListPos +=1;   
   }
  else {
  print "$UserList[$ListPos]\n";
  $ListPos +=1;
  }
}
close(FILE);

print $n;



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

Date: Sun, 20 Aug 2000 13:21:28 -0400
From: "Michael Maraist" <maraist@udel.edu>
Subject: perl5.6 new reg-ex errors (but only when you're on crack)
Message-Id: <8np45k$qsc$1@news.udel.edu>

    I haven't found any documentation on bugs in the new reg-ex engine, so
I'll post a question here.

First, nested reg-exs core dumps for me.
For example <<EOS

our $reg = qr{
  (?{ print "new reg call\n"; })
  \(
   (?:
     ( (?> [^()]+ ) )
     |
     ( \( [^()]* \) )
     (?{
          my $txt = $2;
          $txt =~ $reg;
        })
    )*
    \)
}xs;

"( hi ( there ) )" =~ $reg;
EOS


produces: <<EOS
new
[ hi ]
new
[ there ]
Segmentation fault
EOS

This was a contrived example to test out a much more complex (but similarly
structured code).

I eventually solved the problem by rearranging my code so I could use
??{ $reg }) instead.  This worked as expeced, but I'll get to that later.

The core-dump is caused by any nested reg-ex actually.. And if I use an
arbitrary reg-ex like $txt =~ /txt/, then it gives me a syntax error.. This
much was in the documentation (something about syntactic end-of-statement
ambiguity).. The pre-compiled reg-ex takes care of this, so it wasn't such a
big deal.. But the core-dumping.. well, I've never really seen raw perl core
before.  I'd call that a major bug.


Ok, so the next issue I had was in (??{ $reg }).
It would be harder for me to actually make a contrived example for this, so
I'll just give you my actual code. Note: don't comment on my implementation,
it's still very alpha; it might radically change again.  Basically what I'm
doing is seeing if I can avoid using a lexer/parser to interpret code.  The
new perl reg-ex package is brand new (as far as I can tell) to the reg-ex
world.  The documentation in the book says that any reg-ex person will tell
you that reg-exs can't match parenthesis.. and then you should also know
that perl isn't your everyday reg-ex.  So I wanted to see how far I could
take nested matchings.  I wrote an interpreter that converted arbitrary
nested code (within parenthesis) into nested array refs (essentially a
data-structure).  That was pretty easy (but I ran into the above problem
while solving it).  But then I wanted to know if you could do the exact same
thing with XML.  If you could convert XML to a data-structure easily, it
might be a massive performance gain over traditional lex/parser methods
(which are slow in raw-perl).  So while implementing, I found an interesting
other bug.  Here's my code first (not, I'm retyping it, so I might have some
syntax errors )<<EOS

our $stack;

our $xml1b = qr{
  ( (?> [^<>]+ ) )
  (?{ push @$stack, $1 })
}xs;

our $xml1c = qr{
  <(\w+) ([^<>/]*) />
 (?{ push @$stack, fields::phash( tag => $1, attrs => $2, data => [], single
=> 1 ); })
}xs;

our $xml1d = qr{
  <!([^<>]*)>
  (?{ push @$stack, fields::phash( tag => '!', attrs => $1, data => [],
single => 1 ); })
}xs;

our $xml1a = qr{
#  (?{ print "{new xml1a}\n" })
  (?{
     $stack = [];
    })
    <(\w+) ([^<>/]*)>
    (?:
     (??{ $xml1b })
     #( (?> [^<>]+ ) )
    #(?{ push @$stack, $3 })
     |
     (??{ $xml1c })
     #<(\w+) ([^<>/]*) />
     #(?{ push @$stack, fields::phash( tag => $4, attrs => $5, data => [],
single => 1 ); })
     |
     (??{ $xml1d })
     #<!([^<>]*)>
     #(?{ push @$stack, fields::phash( tag => '!', attrs => $6, data => [],
single => 1 ); })
     |
     (?=<[^!<>/]+>)


 push @back_stack, $stack;
       })
     (??{ $xml1a })
     (?{
 $stack = pop( @back_stack );
 push @$stack, $lstack;
       })
    )*?
  </\1>
    (?{ $lstack = fields::phash( tag => $1, attrs => $2, data => $stack,
single => 0 );
      })
}sx; # end xml1a

our $xml1 = qr{
#  (?{ print "{new xml1}\n" })
  (?{
     $stack = [];
    })
    (?:
#     (??{ $xml1b })
     ( (?> [^<>]+ ) )
     (?{ push @$stack, $1 })
     |
#     (??{ $xml1c })
     <(\w+) ([^<>/]*) />
     (?{ push @$stack, fields::phash( tag => $2, attrs => $3, data => [],
single => 1 ); })
     |
#     (??{ $xml1d })
     <!([^<>]*)>
     (?{ push @$stack, fields::phash( tag => '!', attrs => $4, data => [],
single => 1 ); })
     |
     (?=<[^!<>/]+>)


 push @back_stack, $stack;
       })
     (??{ $xml1a })
     (?{
 $stack = pop( @back_stack );
 push @$stack, $lstack;
       })
    )*
}sx; # end xml1

"1 <x 2/> 3 <y 4> 5 <z 6/> <!cool a> </y> 6 <!hi b>" =~ $xml1;

xml2str( @$stack );
EOS

displays >>EOS
1 <x 2/> 3 <y 4> 5 <z 6/> <!cool a> </y> 6 <!hi b>
EOS

So far so good.. But when I swap any of the comments, it fails.  There are
two seperate bugs I'm dealing with here.  The first and more important is
that $xml1a physically runs out of $n substitution variables.  It runs out
at about $5 I think.  It replaces the text of all subsequent vars with
undef's. I get the following <<EOS
1 <x 2/> 3 <y 4> 5 <z/> <!> </y> 6 <!hi b>
EOS

Note that z's 6, cool and cool's 'a' are absent because $5 and up ran out.
(
 It was only by breaking out the sections of code into (??{ $xml1[a-d] })
and the sub vars could be reset back to position one that it works (which is
how the above is actually coded).

Since I had to do this for the top part, I figured I could minimize the
amount of redundant code by making $xml1 also use (??{ xxx })
sub-expressions.. BUT, it fails all subs vals when it does this.  I instead
get <<EOS
</><></><!></><!>
EOS

I assume the latter problem has to do with some bug in the complex chain
that I've produced.

I'm not too concerned because I've found work-arounds, and my str2xml and
xml2str functions both seem to work.  But I don't like the current level of
inconsistency.. Can anyone tell me if any of these bugs are known, and if
not, how can I report them?

-Michael




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

Date: 20 Aug 2000 14:53:49 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regex: finding location in (?{})
Message-Id: <slrn8pvs6l.tj3.abigail@alexandra.foad.org>

Adrian Taylor (at99@active22.doc.ic.ac.uk) wrote on MMDXLIV September
MCMXCIII in <URL:news:8nj5bf$j62$1@lux.doc.ic.ac.uk>:
|| Hi folks
|| 
|| I have a regular expression with (?{}) in it. The code inside that
|| calls a function to check whether the last match was a noun, a verb
|| or something else. For instance:
|| 
|| (\w+?)(?{ $wasNoun = isNoun($+); })
|| 
|| which works fine. However I am using a parser which decides word
|| types on the basis of their context in the sentence; i.e. if there
|| are two words "fly" in the sentence one might be a noun and one 
|| might be a verb. So when I check isNoun($+) I have no way of 
|| knowing which "fly" it would be referring to.
|| 
|| So I wonder if there is a variable somewhere which can tell me,
|| from within the (?{}) block, how far through the string it is
|| at that point, in terms of the number of characters since the 
|| beginning of the string. If I passed that to is_noun then it would
|| be able to verify the word type of the correct word instead of just
|| hoping there is only one instance of "fly" in the sentence.
|| Does such a variable exist?

Yes. It's called @- (and its friend @+).

    $_ = "This is a fly";
    1 while /(\w+)(?{print "`$+' begins at position $-[@--2] and " .
                                  "ends at position ${\($+[@+-2]-1)}.\n"})/g;

gives:

    `This' begins at position 0 and ends at position 3.
    `is' begins at position 5 and ends at position 6.
    `a' begins at position 8 and ends at position 8.
    `fly' begins at position 10 and ends at position 12.



Abigail
-- 
perl -Mstrict -we '$_ = "goto H.print chop;\n=rekcaH lreP rehtona tsuJ";H1:eval'


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

Date: 20 Aug 2000 09:08:44 -0400
From: "Luis Garzon" <luis_garzon@ibi.com>
Subject: Re: Running Perl-Script as NT-Service
Message-Id: <399fd85b.5f.41@IBIWEBF>

I have successfully used NTreskit's srvany.exe tool to do
this.  The doc is self-explanatory, you basically create a
service with srvinst and have the perl script be the
application (read doc for details).
 
Remember that script runs under security of localsystem by
default so you should test (especially if script goes out to
network).
 
Luis
 
> Yes. Very ugly. I know...
> 
> The script should run on Windows NT (and 2K). It should
> run ALLWAYS (without
> a user logged in - and without autologon hacks).
> 
> I can't schedule it. The script will observe any services
> or applications -
> the scheduler too...
> 
> And i can't install LINUX first!    ;-)
> 
> Any hints?!
> 
> Post it into NT newsgroup???!!!
> 
> rgds
> 
>     Guenther
> 
>
--------------------------------------
   This EMail Was brought to you by
               WebNews
    A Netwin Web Based EMail Client
     http://netwinsite.com/webnews/


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

Date: Sun, 20 Aug 2000 14:50:17 +0200
From: marvin <alesr@siol.net>
Subject: Re: setting up a cgi directory
Message-Id: <399FD409.3D46@siol.net>

cedop@my-deja.com wrote:
> 
> Im running redhat linux 6.2
> I dont know which apache server is installed, but
> when I try to load the script, i get the whole script
> returned in the browser, not the expected output
> ie,
> 
> instead of getting the line:
> 
> Hello World
> 
> I get:
> 
> print "Hello World";
> 
> the script is correct, in that it works at UNI on my account
> there, but not at home.
> 
> In article <slrn8ppn0m.26j.tim@degree.ath.cx>,
>   tim@degree.ath.cx (Tim Hammerquist) wrote:
> > On Fri, 18 Aug 2000 01:59:01 GMT, cedop@my-deja.com
> <cedop@my-deja.com> wrote:
> > > Hello,
> > >
> > > can someone please tell me how I set up a cgi-bin directory, so that
> I
> > > can execute a perl script from a web page. My system is running
> linux
> > > 6.2 (Redhat), and perl is installed.
> > >
> > > When I type which perl, I get
> > > /usr/bin/perl
> > >
> > > when I execute a perl script by typing
> > > perl scriptName.pl
> > >
> > > it works fine, but when i try to run the script from the web
> browser, I
> > > just get an error page
> >
> > Assumption #1: You're using Apache 1.3.x server.
> > Assumption #2: You're getting a 500 server error.
> >
> > If both of these assumptions is correct, I recommend making sure your
> > script is sending the correct headers to the browser client.
> >
> > If you're actually getting a 404 or other such error, then yes, it's
> > most likely a server config issue.
> >
> > See the documentation...usually a collection of HTML files within a
> > directory named 'manual'.  If you're installations like mine (Mandrake
> 7
> > linux;Apache/1.3.12), look in /home/httpd/html/manual or maybe a
> > variation thereof.
> >
> > But again, we're missing important information.  I had to make
> > assumptions, and when stressed-out programmers have to make
> assumptions,
> > watch out!  =)
> >
> > Hope this helps,
> > --
> > -Tim Hammerquist <timmy@cpan.org>
> > The optimist thinks this is the best of all possible worlds.
> > The pessimist fears it is true.
> >       -- Robert Oppenheimer
> >
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

I think you have a security problem. Notice, that webservers on unix
usually run as user "nobody". Check also in configuration file, that
you have assigned extension .pl to webserver, otherwise server will
not handle the script.


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

Date: Sun, 20 Aug 2000 07:42:41 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: using perl to interact with a telnet session
Message-Id: <399FC431.C427F8F0@patriot.net>

I use Perl on NT...here's a script that works well for me...and it's not platform
dependent...

#! c:\perl\bin\perl.exe

use strict;

my $host = shift;
my $username = shift;
my $passwd = shift;

use Net::Telnet ();
my $t = new Net::Telnet (Timeout => 10,
                      Prompt => '/[\$%#>] $/');

if ($t) {
 $t->open($host);
 $t->login(Name => $username,
          Password => $passwd);
  my @lines = $t->cmd("uname -a");
 print @lines;
#print "\n\n";
#@lines = $t->cmd("w");
#print @lines;
 exit;
}

Shao Zhang wrote:

> Hi,
>         I am trying to use perl to do the following equivalent. But my
>         program does not work. Any one give me some hints??
>
> In Shell,
>         (sleep 3; echo $username; echo; sleep 2; echo $passwd;
>         echo; sleep 2; echo $message; sleep 2; echo $quit; echo;) |
>         telnet $server");
>
> In perl,
>         open(HANDLE, "|telnet $server");
>         sleep 3; print HANDLE "$username\n";
>         sleep 2; print HANDLE "$passwd\n";
>         sleep 2; print HANDLE "$message\n";
>         sleep 2; print HANDLE "$quit\n";
>         close HANDLE;
>
>         Any ideas?
>
> Shao.
> --
> ____________________________________________________________________________
> Shao Zhang - Running Debian 2.1  ___ _               _____
> Department of Communications    / __| |_  __ _ ___  |_  / |_  __ _ _ _  __ _
> University of New South Wales   \__ \ ' \/ _` / _ \  / /| ' \/ _` | ' \/ _` |
> Sydney, Australia               |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
> Email: shao@cia.com.au                                                  |___/
> _____________________________________________________________________________

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: Sun, 20 Aug 2000 17:47:39 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
Subject: Was: Is unless($myhash{$some_variable} = 1) my problem ? / PROBLEM  SOLVED!
Message-Id: <399FFD9B.B8C37F77@ostas.lu.se>

Hi,
I just wanted to say that I solved my problem with the following solution.
Now by chomping both parts, then I got rid of the problem, cause I
thought first that it 
was only $myhash{$some_variable} = 1 that should have been
$myhash{$some_variable} == 1.
But no, it's the New line in the input and the file which really is the problem.
Thanks for all help.
// Jimmy.

############ New SUB, (working)
sub do_omreg
{
$omregfil = 'Server G4:DATABAS:data:omreg.data';
&KursModul::read_file($omregfil);
@omregfil = @KursModul::lines;


undef %is_kurskod;
foreach $code (@omregfil) 
{
chomp $code; 
$is_kurskod{$code} = 1; 
}

@omregkoder = split(/ /,$KursModul::in{'omreg'});
#&do_push;

foreach $some_code (@omregkoder)
{
chomp $some_code;
$some_code =~ s/^(.*)(\d{3})(.*)$/\U$1$2\L$3/;
unless ($is_kurskod{$some_code} == 1)
{
$fel = 'ja';
$omregfel = 'ja';
push (@fel_omreg_kod, $some_code);
}
}
}


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

Date: Sun, 20 Aug 2000 14:31:06 GMT
From: jblatz2@my-deja.com
Subject: Wildcards in DOS 'dir' command
Message-Id: <8noq3a$is8$1@nnrp1.deja.com>

I'm using ActivePerl on a Windows NT 4.0 platform.  I'm trying to use
the 'dir' command with the '*' wildcard and it won't work.  I'm trying
something like:

@dirlist=`dir /b ..\*.log`;

Tells me it cannot find the file.  I've also tried explicit path

@dirlist=`dir /b \dir1\*.log`;

with same results.

If I execute this command from DOS it works.

I've read the documentation and it indicates that I'm better off using
filenames when possible, but it's not possible here.

Am I doing something wrong or can I just not do this?

Thanks.


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


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

Date: Sun, 20 Aug 2000 16:40:44 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Wildcards in DOS 'dir' command
Message-Id: <39A00A3E.EADB4F9E@rochester.rr.com>

jblatz2@my-deja.com wrote:
> 
> I'm using ActivePerl on a Windows NT 4.0 platform.  I'm trying to use
> the 'dir' command with the '*' wildcard and it won't work.  I'm trying
> something like:
> 
> @dirlist=`dir /b ..\*.log`;
> 
> Tells me it cannot find the file.  I've also tried explicit path
> 
> @dirlist=`dir /b \dir1\*.log`;
> 
> with same results.
> 
> If I execute this command from DOS it works.
> 
> I've read the documentation and it indicates that I'm better off using
> filenames when possible, but it's not possible here.
> 
> Am I doing something wrong or can I just not do this?
 ...
> Sent via Deja.com http://www.deja.com/
> Before you buy.

You need to read up on quoted strings.  If you want a backslash (\) in a
backticked string (`...`) or a quoted string ("..."), you need to escape
the \ with another \, as in \\.  I think you'll find that:

    @dirlist=`dir /b ..\\*.log`;

will generate what you want.  I recommend you take a look at:

    perldoc perlop

Look at the "quote and quotelike operators" section in particular.

You might also wish to consider the opendir function (perldoc -f
opendir), which will permit writing a program that might be more
portable between different platforms.
-- 
Bob Walton


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

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


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