[7584] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1210 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 21 16:17:21 1997

Date: Tue, 21 Oct 97 13:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 21 Oct 1997     Volume: 8 Number: 1210

Today's topics:
     2 element associate array <mark_aurit@NOSPAM.mail.northgrum.com>
     Re: [Reposted due to Enlow UCE cancel]: Perl and MS Exc (Faust Gertz)
     Authenticate Web Users to the System Accounts (Craig A. Shortreed)
     Re: Authenticate Web Users to the System Accounts (brian d foy)
     Re: Date calculations in Perl (I R A Aggie)
     Re: Fastest Compare On Array Elements (Toutatis)
     Re: fill out web form ? (Faust Gertz)
     Re: help on odd problem <seay@absyss.fr>
     Re: help on odd problem <seay@absyss.fr>
     Looking for an authentication admin CGI named "Lucien" (Steve S)
     Re: Method ``print'' invocation syntax --- only one for (Jason Gloudon)
     Need help - Text formatting problems (Eric Broach)
     Re: Need help - Text formatting problems (brian d foy)
     Re: Need help - Text formatting problems (Mike Stok)
     Passing parameters to perl cgi script <dankert@nordi.no>
     Perl and DAO (Stan Cheng)
     Re: Perl Bug Report <cmargoli@world.northgrum.com>
     Re: Perl Bug Report <jstern@world.northgrum.com>
     Perl failing tests on AIX (Richard Svatos)
     Re: PERL for DEC OSF/1 v3.0 <dparrott@ford.com>
     Re: Perl system() call never returns (Solaris 2.5.1, Pe (Michael Sohmen)
     Re: Segmentation Fault in sort! <jstern@world.northgrum.com>
     superuser access <bigBADguy@usa.net>
     Re: superuser access (brian d foy)
     Un-require lib files <achoy@us.oracle.com>
     Re: variable checking (Brian Wheeler)
     Re: variable checking <seay@absyss.fr>
     Win32, del file? (Eric)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 21 Oct 1997 17:01:47 GMT
From: "Mark Aurit" <mark_aurit@NOSPAM.mail.northgrum.com>
Subject: 2 element associate array
Message-Id: <01bcde43$02b01300$3d846380@MAURIT>

I cant figure out how to work a 2-element associate array table. With a
regular array (and I dont know if this is the Perl syntax), I can access
the first element in the first 
row with something like  <array>(1,1) and the second element in that row
with <array>(1,2). But Im having no luck, I can work a single element hash,
but
I done see how to reference the second element. Im creating a
userid/password
table that will eventually go into DBM.

The book Im using (Teach Yourself perl 5... I know, its not the Camel book,

but isnt bad) doesnt mention how to do this.

A code snippet would be greatly appeciated.
Thanks, Mark
mark_aurit@mail.northgrum.com



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

Date: Tue, 21 Oct 1997 18:36:05 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: [Reposted due to Enlow UCE cancel]: Perl and MS Excel
Message-Id: <344df3d8.923783@news.wwa.com>

On Mon, 20 Oct 1997 17:27:36 -0400, Suhail Warsi <swarsi@nmpnet.net>
wrote:

>Does any one know if there is anything for perl that allows it to access
>MS Excel files?

You might want to look at the OLE module available at a CPAN near you
(http://www.perl.com/CPAN).  It is very easy to use once you start
playing with it.

use OLE;
my $app = CreateObject OLE "Excel.Application" || die;

[Do Stuff]

$app->Quit();


HTH

Faust Gertz
Philosopher at Large

"Why does this Iphigenia's fate revolt no one?  Why is it that our 
nerves accept it, that an entire nation subscribes to it?  This could 
never happen without a secret which transfigures a crime into a rite 
and transcends it."- Jean Cocteau, _La Difficulte detre_


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

Date: 21 Oct 1997 15:25:25 GMT
From: cshortreed@valnet.com (Craig A. Shortreed)
Subject: Authenticate Web Users to the System Accounts
Message-Id: <62ihh5$c9q$1@news1.rmi.net>

I would like to set up a way of authenticating users to a web site by using
the system password and usernames, instead of .htaccess.  Basically I want
to provide users a way to upload their web pages via the web page, but want
to make sure only valid system users can access this area.  Can this be done
using PERL scripting?

Thank You,
Craig Shortreed



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

Date: Tue, 21 Oct 1997 12:24:47 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Authenticate Web Users to the System Accounts
Message-Id: <comdog-ya02408000R2110971224470001@news.panix.com>

In article <62ihh5$c9q$1@news1.rmi.net>, cshortreed@valnet.com (Craig A. Shortreed) wrote:

>I would like to set up a way of authenticating users to a web site by using
>the system password and usernames, instead of .htaccess.  Basically I want
>to provide users a way to upload their web pages via the web page, but want
>to make sure only valid system users can access this area.  Can this be done
>using PERL scripting?

well, if you are really stuck on doing it this way, use htaccess but 
write a couple of scripts to build the htaccess and htpasswd files from
/etc/passwd.

is there some feature that you want that server configuration does not
provide?

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 21 Oct 1997 11:07:29 -0400
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Date calculations in Perl
Message-Id: <-2110971107300001@aggie.coaps.fsu.edu>

In article <62hqf7$ecq@du04.oli.hk>, kyue@ouhk.edu.hk (Yue H K Ken) wrote:

[posted && cc'd]

+ Is there any shareware module that can do date calculations for Perl ?

+ since our host machine hasn't got an ansi C compiler).

Date::Manip -- AFAI can tell, it does not need a c compiler.

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 21 Oct 1997 16:00:51 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Fastest Compare On Array Elements
Message-Id: <toutatis-ya023180002110971800540001@news.euro.net>

Earlier I wrote:

> sub _grep {
>    my ($find,$listref) = @_;
>    grep{/$find/o and return 1}@$listref;
>    0;
> }
> 
> print "Yippie\n" if _grep('aaa',['aaa'..'zzz']);
> #will print *substantially* faster than:
> print "Yeaaah\n" if _grep('zzz',['aaa'..'zzz']);

Somebody pointed me out the 'o' modifier in the regex should be omitted for
it to work properly in this function. Indeed. So make that:

sub _grep {
    my ($find,$listref) = @_;
    grep{/$find/ and return 1}@$listref;
    0;
}

-- 
Toutatis


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

Date: Tue, 21 Oct 1997 18:19:41 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: fill out web form ?
Message-Id: <344cf1c1.389088@news.wwa.com>

On Sun, 19 Oct 1997 23:01:55 -0500, tadmc@flash.net (Tad McClellan)
wrote:

>Perl != CGI

Kwel, man!  So where do I get and learn about 'Perl!'?  :-)


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Tue, 21 Oct 1997 17:30:37 +0200
From: Doug Seay <seay@absyss.fr>
To: Steve Nisbet <s.nisbet@doc.mmu.ac.uk>
Subject: Re: help on odd problem
Message-Id: <344CCA9D.3414EFAB@absyss.fr>

[posted and mailed]

Steve Nisbet wrote:
> 
> Thanks to anyone in advance, but how would I go about converting a string
> such as:
> frank Spencer (held in say $name)
> 
> into the following:
> 
> F.Spencer
> 
> I've tried mucking around with splice, but I'm missing something.

	$name =~ m/^(.*)\s+(\s+)$/;
	my $last = ucfirst lc $2;
	my $first = uc substr($1,0,1);
	$name = "$first.$last";

Or something along those lines.  Just remember that not all names follow
the same conventions.  The French like hypenated names (think Jean-Luc
Picard from ST:TNG) and some cultures (korean?) sometimes have spaces in
the last name.  This little snippet isn't going to go very far with
anything other than "Firstname Lastname" type names.  If possible, have
the user enter the two parts in different fields so that they can tell
you how to break the name into chunks.


- doug


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

Date: Tue, 21 Oct 1997 17:36:52 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: help on odd problem
Message-Id: <344CCC14.2D86B309@absyss.fr>

Doug Seay wrote:

>         $name =~ m/^(.*)\s+(\s+)$/;
                              ^^^
oops, that should be \S+ (capital S, not lower case)

- doug


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

Date: Tue, 21 Oct 1997 13:30:30 -0500
From: spamnotmax_eper@hotmail.com (Steve S)
Subject: Looking for an authentication admin CGI named "Lucien"
Message-Id: <spamnotmax_eper-2110971330310001@ts011d17.min-mn.concentric.net>

I'm looking for a cgi named "Lucien" that's used for administering the
password file with auth-lib.pl (from Selena Sol). It was written by Leslie
Orchard.

It was at: http://www.industrynet.net/lorchard/cgi/ titled Talien's CGI
Dreams, but the link is stale. Anyone know where to find it?

Thanks,

Steve S

Please drop the "spamnot" for e-mail.

-- 
"Forget the lawyers. The first thing we do, we kill all the spammers."


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

Date: 21 Oct 1997 15:04:42 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Method ``print'' invocation syntax --- only one form possible?
Message-Id: <62igaa$195$2@daily.bbnplanet.com>

tobez@plab.ku.dk (tobez@plab.ku.dk) wrote:
: Hi,

: Is there any way to use method invocation syntax
:   method $ObjRef LIST;
: while method name is ``print'' and object underlying
: structure is a hash?

Only thing i can think of that comes close is exporting a print sub 
that checks that the first parameter passed is a reference to your class
or not and does a normal print if it is not.

However this would still be a normal subroutine call and you'd have to say 
print $ObjRef, LIST. In general a method call can be made by saying 
method $ObjRef,LIST, this is what $ObjRef->method(LIST) becomes anyhow. 
Again note the comma.

Jason Gloudon


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

Date: Tue, 21 Oct 1997 11:49:25 -0600
From: eric@jmfilm.com (Eric Broach)
Subject: Need help - Text formatting problems
Message-Id: <eric-2110971149260001@10.0.0.6>

Hi. This may seem like a "newbie" question, but here goes:

How do you take a text string, assigned to a variable, and strip the
returns out of it?

Here's the situation. I have a form on a Web page that includes the user's
name and address. The address box is a multi-line text box. Most users
will probably fill it in like this:

1234 Any Street
Suite 1
Anytown, Any State 54321
U.S.A.


I use Brenner's "cgi-lib" library (which is excellent, by the way) to
parse the input from the form. The address comes to me as a single
variable -- $in{'address'} -- a text string that includes returns.

I take the input, and write it to a tab-delimited text file that can be
imported into a database or spreadsheet program. But in order for it to
work, I need the address to all be on the same line. In other words, I
need to remove the returns from the text string, but keep the rest of it.

I looked in my PERL books, and tried some things, but they didn't work. I
tried using "split," and removing all the "\r"'s, then "join"ing the array
back into one string, but it didn't work - the returns were still there.

I'd greatly appreciate any ideas anyone might have about how to make this
work. I've been banging my head against the wall over this one, and could
use some advice from more experienced PERL users.

Thanks very much,


Eric Broach
(eric@jmfilm.com)

-- 
+---------------------------------------------------------------+
|  Eric Broach                                                  |
|  Division Manager                                             |
|  Pixel River Interactive [a division of Jeffrey Mills Film]   |
|  Corporate Multimedia Development                             |
|  e-mail:   eric@jmfilm.com                                    |
|  WWW:      http://www.jmfilm.com/pixelriver                   |
+---------------------------------------------------------------+


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

Date: Tue, 21 Oct 1997 13:21:14 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need help - Text formatting problems
Message-Id: <comdog-ya02408000R2110971321140001@news.panix.com>

In article <eric-2110971149260001@10.0.0.6>, eric@jmfilm.com (Eric Broach) wrote:

>How do you take a text string, assigned to a variable, and strip the
>returns out of it?

   $string =~ tr/\r\n/  /;

>I use Brenner's "cgi-lib" library (which is excellent, by the way)

CGI.pm is better (and modern)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 21 Oct 1997 17:19:42 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Need help - Text formatting problems
Message-Id: <62io7e$97h@news-central.tiac.net>

In article <eric-2110971149260001@10.0.0.6>,
Eric Broach <eric@jmfilm.com> wrote:
>Hi. This may seem like a "newbie" question, but here goes:
>
>How do you take a text string, assigned to a variable, and strip the
>returns out of it?
>
>Here's the situation. I have a form on a Web page that includes the user's
>name and address. The address box is a multi-line text box. Most users
>will probably fill it in like this:
>
>1234 Any Street
>Suite 1
>Anytown, Any State 54321
>U.S.A.
>
>
>I use Brenner's "cgi-lib" library (which is excellent, by the way) to
>parse the input from the form. The address comes to me as a single
>variable -- $in{'address'} -- a text string that includes returns.

You can use tr to translate (and optionally delete) a set of characters,
so

  $in{'address'} =~ tr/\r//d;

is one way to get rid of the \r characters. alternatively you could do
something like

  $in{'address'} =~ s/\s*$//;
  $in{'address'} =~ s/\r/, /g;

to sreip trailing spaces and add commas where there were \r characters in
the field.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Tue, 21 Oct 1997 21:39:21 +0200
From: Asbjorn Dankertsen <dankert@nordi.no>
Subject: Passing parameters to perl cgi script
Message-Id: <344D04E9.B5CD04C1@nordi.no>

I want to pass parameters to a perl cgi script using this syntax from a
web page:

http://www.somedomain.com/cgi-bin/somescript.pl?parameter=value

Is this possible? If so, how do I access the parameter/value in my
script?

Regards,
Asbjorn Dankertsen
http://www.nordi.no/~dankert/



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

Date: Tue, 21 Oct 1997 13:58:40 GMT
From: hobo@alumni.stanford.org (Stan Cheng)
Subject: Perl and DAO
Message-Id: <344cb40b.1853499@news.ricochet.net>

I'm trying to access a MS Access database through perl... can anyone
help me in  figuring out how to do this either through OLE or with
DAO....

If you could either send me in the right direction that would be good
enough
I've tried 

$conn = CreateObject OLE "DAO.DBEngine" || die "Create Object";
$conn = CreateObject OLE "Access.Database.2" || die "Create Object";

Both don't error out but they don't give me a usable object either.

thanks,
Stan


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

Date: Tue, 21 Oct 1997 14:59:22 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: Perl Bug Report
Message-Id: <344CC34A.69B4@world.northgrum.com>

Charles Margolin wrote:
> Not a bug.  Your statement
>   my $z = $y->{'1'} if defined $y;
> would do two things if it had been executed:  declare the lexical
> $z and set its value.  Here it did neither, so $z is a package
> "global" variable. It was set to "a" on the first call, so it
> is still defined in the second call.
> 
My colleague Jim Stern points out that I (as usual :-( ) neglected to
notice the 'use strict' which would have trapped $z if it were being
treated as a package global.  Indeed, trying to use $z outside
the sub would generate an error because of use strict.

Separating the 'my' from the conditional:
   my $z;  $z = $y->{'1'} if defined $y;
does make it work correctly.

So I'm puzzled too.

-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

Date: Tue, 21 Oct 1997 19:22:52 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Perl Bug Report
Message-Id: <344D010C.1DF@world.northgrum.com>

The statement in question is:
    my $z = $y->{'1'} if defined $y;

Should the `if' govern the entire statement or only the assignment?
I.e., should the `if' suppress the run-time creation of $z when
$y is not defined?

Charles Margolin wrote:
> [...] 
> Separating the 'my' from the conditional:
>    my $z;  $z = $y->{'1'} if defined $y;
> does make it work correctly.
> 
> So I'm puzzled too.
> 

Some time ago, I used to periodically post a list of
Perl Traps.  This (edited) excerpt illustrates what I _thought_ was
true at the time:

    my $z if 0;     # Declares $z
    my $z=5 if 0;   # Declares $z but does not set it to 5
    local $z if 0;  # Does not create $z

But a closer look at perlsub's "Private Variables via my()"
leaves me puzzled.  The section says that a my() variable
in a function "works more like a C auto [than like a C
static]."

When I first read that section, I took it to mean that Perl
would create a different $z every time it executed a `my $z'
statement and would initialize that $z to `undef' unless an
assignment overrode that.

But of course C auto variables are not guaranteed to work that
way.  I.e., the C Standard does not require that they be set
to "undefined" values.  Were the Perl man pages meant to require
this or were they meant to imply the same caveats that C's auto
variables have?

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: 21 Oct 1997 14:54:47 GMT
From: svatosr@iastate.edu (Richard Svatos)
Subject: Perl failing tests on AIX
Message-Id: <62ifnn$1jn$1@news.iastate.edu>

I am in the process of installing Perl v5.004.03 on AIX 4.1.5.0
using gcc v2.7.2.3.  When I run `make test`, most of the tests
are successful, but I'm getting the following errors:

Too late for "-T" option at pragma/locale.t line 1.
	pragma/locale.t
	lib/io_taint.t

Memory fault(coredump)
	lib/anydbm.t
	lib/filecopy.t	(1..11 ok 1 ok 2 ok 3 ok 4 ok 5)
	lib/filehand.t
	lib/io_dup.t
	lib/io_pipe.t
	lib/io_sock.t
	lib/io_tell.t
	lib/io_udp.t
	lib/io_xs.t
	lib/ndbm.t
	lib/odbm.t
	lib/opcode.t
	lib/open2.t
	lib/open3.t
	lib/ops.t	(1..2)
	lib/posix.t
	lib/safe1.t
	lib/safe2.t
	lib/sdbm.t
	lib/socket.t


I haven't been able to locate the "-T" option in the older Perl
documentation I have available, so I was hoping someone could
enlighten me about this.

The memory faults are my big concern.  I've tried compiling Perl
both with and without its own `malloc` with the same results.
This is a brand new installation of `gcc` as well so I'm wondering
if some problem might have crept in there (I didn't have `cc`
available, and used a copy of `gcc` from an AIX 4.1.4 machine
to build `gcc`, which I then used to build Perl.)

Any suggestions would be greatly appreciated.

Thanks!

Richard Svatos
svatosr@iastate.edu
-- 
Richard Svatos
svatosr@iastate.edu


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

Date: Tue, 21 Oct 1997 12:34:34 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
Subject: Re: PERL for DEC OSF/1 v3.0
Message-Id: <344CD99A.29CA@ford.com>

Erwin Drenth wrote:
> 
> Can anyone tell me where I can find a perl version for DEC OSF/1 v3.0? I've
> tried searching the Web, but that didn't get me anywhere.
> 
> Thanks in advance,
> 
> Erwin Drenth

You download a source kit and build it. The distribution comes with 
scripts to ease you thru the process...

BTW - I use Perl on my DEC Unix boxes (nee OSF) that was built that
way...
-- 

-----------------------------------------------------------------------------
Dennis M. Parrott             |            Unix: 
parrott@ped.pto.ford.com
PCSE Webmaster                |           PROFS:  DPARROTT
Ford Motor Company            |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA        | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------------
Email is best, but voice: 313-322-4933 fax: 313-323-6743 pager:
313-201-9978


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

Date: 21 Oct 1997 15:36:24 GMT
From: somi0011@rz03.FH-Karlsruhe.DE (Michael Sohmen)
Subject: Re: Perl system() call never returns (Solaris 2.5.1, Perl 5.004_03)
Message-Id: <62ii5o$1ut$1@nz12.rz.uni-karlsruhe.de>

Tom Phoenix (rootbeer@teleport.com) wrote:
: On Tue, 14 Oct 1997, Bruce Hahne wrote:

: > Problem: calls to Perl's system() command intermittently fail to return
: > for some system() calls, and always fail to return for other types of
: > system()  calls.

: That's (almost always) the fault of the called program, which may have an
: infinite loop. 

: > When system() fails to return, the Perl process spins forever and burns
: > CPU. 

I've got a similar problem:
If I call a perl script using system(<whatever>) via a POST formular from 
netscape I get no messages from the <whatever> program. If I start the
same perl script from a shell I get the complete messages.

??

Greetings, Michael Sohmen



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

Date: Tue, 21 Oct 1997 19:35:59 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Segmentation Fault in sort!
Message-Id: <344D041F.7961@world.northgrum.com>

Phiroze Parakh wrote:
> 
> perl's sort keeps giving me this error: Segmentation Fault
> I know what a SEGV is, however, what bothers me is that is occours in
> sort!

In my experience, when Perl's `sort' crashes the cause is almost always
an inconsistent comparison function.  The underlying reason for
the crash is that Perl's `sort' calls C's `qsort' and cannot always
trap qsort errors.  (You guessed this yourself below.)

> 
> here is my code:
> @pidx = @pidx [ sort bySideNameIndexDir 0..$#pidx  ];
> 
> sub bySideNameIndexDir {
> 
>   my ($ra, $pa, $ta, $sa, $ia) = ($pidx[$a]{rname}, $pidx[$a]{port},
>                                   $pidx[$a]{type},  $pidx[$a]{side},
>                                   $pidx[$a]{idx});
>   my ($rb, $pb, $tb, $sb, $ib) = ($pidx[$b]{rname}, $pidx[$b]{port},
>                                   $pidx[$b]{type},  $pidx[$b]{side},
>                                   $pidx[$b]{idx});
> 
>   if ($NN{$sa} == $NN{$sb}) {
>     if ($ia == $ib) {
>       return $pa cmp $pb;
>     } else {
>       if ((exists $order{$pa}) && ($order{$pa}{dir} eq "up")) {
>         return $ia <=> $ib;
>       } elsif ((exists $order{$pa}) && ($order{$pa}{dir} eq "down")) {
>         return $ib <=> $ia;

(*) Here you say that if the order is "down" compare $ib to $ia.

>       } else {
>         $order{$pa}{dir} = 'down';
>         return $ia <=> $ib;

Here you say that if the order is undefined, set it to "down" and
compare $ia to $ib.  Shouldn't you compare $ib to $ia  to be
consistent with (*) above?

>       }
>     }
>   } else {
>     return $NN{$sa} <=> $NN{$sb};
>   }
> }
> 
> ##############
> [...]
> PS: If sort calls C's qsort, then I do know that on some qsorts, an out
> of bound memory read ma be performed

Exactly!

> . This was detected when I purified some C code.

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: Tue, 21 Oct 1997 22:38:20 +0800
From: "bigBADguy" <bigBADguy@usa.net>
Subject: superuser access
Message-Id: <62il15$4gg1@news.hk.linkage.net>

I need to write a script that change password. This script let user to
execute, and need to access the /etc/shadow.

What shall I do ? (besides using sudo)
I had already "chmod u+s myscript.pl", and #!/usr/local/bin/perl -T

Please help / suggest reference / web site...



bigBADguy




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

Date: Tue, 21 Oct 1997 13:16:49 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: superuser access
Message-Id: <comdog-ya02408000R2110971316490001@news.panix.com>

In article <62il15$4gg1@news.hk.linkage.net>, "bigBADguy" <bigBADguy@usa.net> wrote:

>I need to write a script that change password. This script let user to
>execute, and need to access the /etc/shadow.
>
>What shall I do ? (besides using sudo)
>I had already "chmod u+s myscript.pl", and #!/usr/local/bin/perl -T

if you have these sorts of questions and this particular task, you 
should re-evaluate your options (and read the security resources in the 
CGI Meta FAQ (they're not just for CGI scripts) ) :)

how about using the system commands to do what you want?  they'll take
care of updating the appropriate files (and locking them in the 
process) as well as all the other things that can give you headaches.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 21 Oct 1997 12:13:28 -0700
From: Allen Choy <achoy@us.oracle.com>
Subject: Un-require lib files
Message-Id: <344CFED8.5437@us.oracle.com>

Anyone know of a way to undo a previous require statement?

Thanks in advance,

Allen


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

Date: 21 Oct 1997 15:00:39 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: variable checking
Message-Id: <62ig2n$4fi$2@dismay.ucs.indiana.edu>

In article <3448C55D.7E79@jersey.net>,
	Josh <josh@jersey.net> writes:
> I have two problems, although they all revolve around the same thing:
	Yup, regular expressions.

> 
> I need a user to input an IP address and then have the program check to
> see if the address is valid.  Here are the problems I'm running into:
> 1) I can't seem to use periods in the address, when I do, the split
> command will not work.  So, for right now, I'm stuck using comma's.

	Periods are the single character wildcard, like '?' in the shell,
You'll have to escape it.  @addr=split(/\./,$ip)

> 
> 2) I don't know how to test the IP.  I don't care what the actually
> numbers are, I just want to make sure that it follows the correct
> format; i.e. 111.111.111.111 .  

	I'd think that this would work:  

	if($ip=~m/\d{1,3}(\.\d{1,3]){3})/) {
		# number is ok
	}

Hope this helps, hope its right!
Brian


> 
> Any Ideas???
> 
> Josh
> josh@jersey.net


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

Date: Tue, 21 Oct 1997 17:24:00 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: variable checking
Message-Id: <344CC910.7A7635F3@absyss.fr>

Brian Wheeler wrote:
> 
> In article <3448C55D.7E79@jersey.net>,
>         Josh <josh@jersey.net> writes:

> > 2) I don't know how to test the IP.  I don't care what the actually
> > numbers are, I just want to make sure that it follows the correct
> > format; i.e. 111.111.111.111 .
> 
>         I'd think that this would work:
> 
>         if($ip=~m/\d{1,3}(\.\d{1,3]){3})/) {
>                 # number is ok
>         }

then you need to verify that the four numbers are valid.  The string

	999.888.777.666

will match on your RE, but is not a legal address.  Each of the four
values should be between 0 and 255 (inclusive).  And even then there are
special cases, like 0.0.0.0, 111.222.255.0, and so on that may require
special attention.


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

Date: Tue, 21 Oct 1997 18:23:52 GMT
From: eric@intiman.org_nospam (Eric)
Subject: Win32, del file?
Message-Id: <344cf227.12703683@intXnt>

Another Perl beginer question:

How the heck am I supposed to delete files from Perl?  The only way I can
rig is to send a DOS command out from Perl in a print command with the ``
marks around it.  What is the easier way I have missed?

I am using the Win32 307, bld 310 version of Perl on NT 3.51 server.

Thanks!


eric@intiman.org_nospam
Eric Kylstra
Computer Coordinator
Intiman Theatre

I have the nospam on the end of my email address for the obvious reason.
Remove it to email me directly.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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