[18785] in Perl-Users-Digest
Perl-Users Digest, Issue: 953 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 21 21:06:03 2001
Date: Mon, 21 May 2001 18:05:16 -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: <990493515-v10-i953@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 21 May 2001 Volume: 10 Number: 953
Today's topics:
Re: Array slice: how about the remainder? <joe+usenet@sunstarsys.com>
Re: Array slice: how about the remainder? <ren@tivoli.com>
Re: file names into an array (Joe Smith)
For a PERL programmer with an interest in diabetes... <aida@globalnet.co.uk>
Re: Function renaming and arguments replacing in c sour (Abigail)
Re: Handling JPEGs without modules <ebo_mike-antispam-remove-t@hottmail.com>
Re: Handling JPEGs without modules (Lars)
Help Please! <dtek@btinternet.com>
Re: Help Please! <joe+usenet@sunstarsys.com>
Re: Help Please! <chok@ece.gatech.edu>
Help with using fcntl file locking <bernie@fantasyfarm.com>
Re: Help: Can't use correctly File:Find in perl (Joe Smith)
Re: Help: using constants from inherited parent class (Abigail)
Re: Help: using constants from inherited parent class (Abigail)
Re: How to match the password created in Linux shadow s (Abigail)
Re: image_button and onClick??? <flavell@mail.cern.ch>
Re: image_button and onClick??? <bcoon@sequenom.com>
Re: image_button and onClick??? <bcoon@sequenom.com>
Installing module not as root <tdyboc@insight.rr.com>
linux: check whether an external program is running <chok@ece.gatech.edu>
Re: loosing contents of var <ren@tivoli.com>
Re: module for combinatorics? (partitions etc) <pilsl_@goldfisch.at>
Re: module for combinatorics? (partitions etc) (Abigail)
Re: Need help on formatting output <mischief@velma.motion.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 May 2001 18:29:20 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Array slice: how about the remainder?
Message-Id: <m3y9rqtjy7.fsf@mumonkan.sunstarsys.com>
"John Lin" <johnlin@chttl.com.tw> writes:
> my @array = <NAMELIST>;
> my @chosen = (0,3,5,7,21,35,63,66,68);
> my @go_picnic = @array[@chosen]; # those who are chosen go picnic
> my @stay_home = @array[???????]; # those who are not chosen stay home
>
> It's convinent to have array slice syntax to get partial of an array.
> But what about the remainder (also partial of the array)?
require 5.006;
my @stay_home = @array;
delete @stay_home[@chosen];
--
Joe Schaefer "We are all in the gutter, but some of us are looking at the
stars."
-- Oscar Wilde
------------------------------
Date: 21 May 2001 15:55:10 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Array slice: how about the remainder?
Message-Id: <m34ruee829.fsf@dhcp9-172.support.tivoli.com>
On Mon, 21 May 2001, johnlin@chttl.com.tw wrote:
> my @array = <NAMELIST>; my @chosen = (0,3,5,7,21,35,63,66,68); my
> @go_picnic = @array[@chosen]; # those who are chosen go picnic my
> @stay_home = @array[???????]; # those who are not chosen stay home
>
> It's convinent to have array slice syntax to get partial of an
> array. But what about the remainder (also partial of the array)?
How 'bout:
@stay_home = @array;
delete @stay_home[@chosen];
@stay_home = grep defined, @stay_home;
It does assume that undef is not a valid entry in the array, but at
least it's O(N). Depending on the application, you may be able to
skip the grep -- that is, if your usage will properly skip or ignore
undef values.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 22 May 2001 00:30:08 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: file names into an array
Message-Id: <9ecbug$2mms$1@nntp1.ba.best.com>
In article <3b067ea7$1@news.microsoft.com>,
Jürgen Exner <juex@my-deja.com> wrote:
>> @files = <*.txt>;
>Will read the content of the filehandle *.txt into the array.
No, it does not. The thing inside <> is not treated as a file handle in
this case; see the docs. It is the same as
@files = split /\0/,`csh -c "glob *.txt"`;
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Tue, 22 May 2001 00:39:12 +0100
From: "Dr. Eldon D. Lehmann" <aida@globalnet.co.uk>
Subject: For a PERL programmer with an interest in diabetes...
Message-Id: <tgj9sc8du53mcf@xo.supernews.co.uk>
Hi there. This is a bit of a 'long shot' - but I am interested in
contacting someone experienced with PERL programming who has a personal
interest in diabetes mellitus.
If I can explain - I am responsible for a completely free (not-for-profit /
non-commercial) diabetes Website which distributes some freeware diabetes
software. For those who might be interested, the site can be found at:
http://www.2aida.org
The site currently makes use of various PERL scripts to support different
functions. These have been drawn from various freeware PERL programs which
can be found on the Web, as well as from some proprietary code previously
written specially for the site.
The original programmer has since moved on, but I am seeking to enhance the
facilities available at the site, and could benefit from being able to
communicate - by email - with someone knowledgeable about PERL. A personal
interest in diabetes would probably make this more relevant for someone who
might be able to answer some queries, etc.
Obviously there would be no committment to help - or do anything. However
as and when I ran into problems with updating the PERL scripts at the
site - or had queries - if it was possible to email someone with some
experience with PERL, that could be a great help. I should stress that
everything that I am doing related to the AIDA diabetes software is being
made available completely free of charge via www.2aida.org as a
non-commercial contribution to continuing diabetes education.
If you think that you might be able to help - please do get in touch -
either via the email address given at the http://www.2aida.org Website - or
via the AIDA Contact Page at: http://www.2aida.org/aida/contact.htm
Finally, I should perhaps explain that my reason for posting this rather
'open-ended' note now is that I shall shortly be losing access to Usenet
Newsgroups such as this one - and I would prefer to make contact with a PERL
programmer who might be interested in helping - before I can no longer post
here. I hope this makes some vague sense!
Anyway, I hope someone with an interest in diabetes might be able to offer
some advice or guidance in the future.
Thanking you for any help that you can offer.
With best wishes,
Yours sincerely,
Dr. Eldon Lehmann
aida@globalnet.co.uk (old email id, shortly to stop working)
Alternatively can be contacted via: http://www.2aida.org/aida/contact.htm
(better).
------------------------------
Date: Tue, 22 May 2001 00:51:01 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Function renaming and arguments replacing in c source code
Message-Id: <slrn9gjdvl.jl8.abigail@tsathoggua.rlyeh.net>
Federico Hernandez (federico@carmen.se) wrote on MMDCCCXX September
MCMXCIII in <URL:news:rw4ruesw2a.fsf@gibraltar.carmen.se>:
[] Hi,
[]
[] I was wondering if there is some perl based script around that can be
[] used to rename functions and replace arguments in c source code?
IIRC, Damian has made C parser.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
------------------------------
Date: Tue, 22 May 2001 00:53:43 +0200
From: "Michael A. Krehan" <ebo_mike-antispam-remove-t@hottmail.com>
Subject: Re: Handling JPEGs without modules
Message-Id: <9ec6cd$ffj$06$1@news.t-online.com>
> I think an issue here is that all the JPEG handling code he has found
> for perl requires compiling, and I suspect that the hosting site
> wouldn't allow that...
This is precisely the situation. I only have FTP access to my personal
/cgi-bin. imagick is not installed (apparently not even the ImageMagick
rpm), GD 1.19 is installed. I cannot telnet. I have no superuser rights. I
cannot install or compile anything, make system-wide changes, let alone
"make" and "make install" a module. All I can do is put stuff into /cgi-bin.
So this is a challenge... is nobody up to it?! I'm rather surprised to see
that no-one else has encountered a similar problem. I wouldn't even say that
my hoster sucks; they're competent and (usually) have great support, they
just fall flat on this one issue.
--
Michael A. Krehan
------------------------------
Date: Mon, 21 May 2001 23:21:51 GMT
From: Lars.Plessmann@gmx.de (Lars)
Subject: Re: Handling JPEGs without modules
Message-Id: <3b09a253.16821818@news.btx.dtag.de>
My tip is: download the module you need, then watch its source and
copy the routines you need into your script directly or create a new
lib.
I've got the same problem with modules. I don't like it when others do
only refer to any stupid module, because I cant use them with only FTP
access. So I prefer libraries ;-)
Lars
On Fri, 18 May 2001 23:01:48 +0200, "Michael A. Krehan"
<ebo_mike-antispam-remove-t@hottmail.com> wrote:
>
>[Basically a rephrased repost from clpmo. Sorry, but the original post
>probably was a little bit hazy]
>
>
>Hi,
>
>I wanna create thumbnails from source graphics (mostly JPEG, other formats
>would be cool too), resize them to a specific dimension and save a new JPEG
>out of it. So FAQ, so good.
>
>PROBLEM is that my hoster won't allow me to install modules. The only
>available module is GD 1.19 which is incapable of handling JPEGs - the only
>format I really need.
>
>Is there anything I can do? How can I handle JPEG images without utilizing
>modules? There are also no converting tools on the server, so I'm stuck with
>pure perl code.
>
>
>--
>Michael A. Krehan
>
>
>
------------------------------
Date: Mon, 21 May 2001 23:40:52 +0100
From: "Darren Williams" <dtek@btinternet.com>
Subject: Help Please!
Message-Id: <9ec5bv$j93$1@neptunium.btinternet.com>
Hi all,
I hope someone can help please.
I'm trying to interface my personal e-commerce attempt to a co that accepts
credit cards. At an earlier date, I supply them a private key.
When I send them a transaction I pass a variable which is a random seed.
Once the transaction is processed I get a query string with a variable
called cbpop passed back to me. Calling the sub below validates the
transaction, returning a value of 1 if its good. I'd like to turn this
below into VB, could someone please explain whats happening here as I know
no CGI or Perl.
sub valid
{
my($a,$b,$c,$h,$i,$l,$q,$w,$x,$y,$z,@s,@v);
###############################
$a='YOUR_SECRET_KEY_GOES_HERE';
###############################
$q='&'.substr($ENV{'QUERY_STRING'},0,256);
$q=~/\Wseed=(\w+)/; $b=$1;
$q=~/\Wcbpop=(\w+)/; $c=$1;
return 0 unless $a&&$b&&$c;
$h=0x80000000; $l=0x7fffffff;
$q=''; $w=uc "$a $b"; $x=$y=$z=17;
@v=unpack("C*",$w); $n=1+$#v;
for($i=0;$i<256;$i++)
{ $w=(($x&$l)+($y&$l))^(($x^$y)&$h);
$w=($w<<$z)|($w>>(32-$z));
$w=(($w&$l)+$v[$i%$n])^($w&$h);
$s[$i&7]+=$w&31; $z=$y&31; $y=$x; $x=$w;
}
for ($i=0;$i<8;$i++)
{ $q.=substr('0123456789BCDEFGHJKLMNPQRSTVWXYZ',$s[$i]&31,1); }
return $c eq $q;
}
Thanks in advance.
Darren
------------------------------
Date: 21 May 2001 19:42:40 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help Please!
Message-Id: <m3u22etgjz.fsf@mumonkan.sunstarsys.com>
"Darren Williams" <dtek@btinternet.com> writes:
> Hi all,
>
> I hope someone can help please.
>
> I'm trying to interface my personal e-commerce attempt to a co that accepts
> credit cards. At an earlier date, I supply them a private key.
> When I send them a transaction I pass a variable which is a random seed.
> Once the transaction is processed I get a query string with a variable
> called cbpop passed back to me. Calling the sub below validates the
> transaction, returning a value of 1 if its good. I'd like to turn this
> below into VB, could someone please explain whats happening here as I know
> no CGI or Perl.
>
> sub valid
> {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think you "forgot" to include something...
### Copyright Keynetics Inc. Patents pending.
Be sure you aren't first violating someone else's rights before you
ask others to act in collusion.
--
Joe Schaefer "Whenever you find you are on the side of the majority, it is
time to pause and reflect."
--Mark Twain
------------------------------
Date: Mon, 21 May 2001 19:43:36 -0400
From: ChokSheak Lau <chok@ece.gatech.edu>
Subject: Re: Help Please!
Message-Id: <3B09A828.85C9C4E2@ece.gatech.edu>
if you check out www.perl.com, you'll get all your qns answered.
basically, the '.' is the strcat operator.
the funny looking "$q=~/\Wseed=(\w+)/; $b=$1;" checks for the string
"Wseed=something" within the string $q and $1 is the substring contained
within the ( ) in the "$q=~..." statement.
substr($ENV{'QUERY_STRING'},0,256) returns the first 256 chars within
the string $ENV{'QUERY_STRING'}. $ENV{'QUERY_STRING'} is the
environment variable "QUERY_STRING=...."
"return 0 unless $a&&$b&&$c;" is equivalent to:
"if( $a == NULL || $b == NULL || $c == NULL ) return 0;"
$w=uc "$a $b" puts both $a and $b into the string $w. uc is uppercase.
for unpack, check www.perl.com.
the others are pretty much all operators, may find under "Perl Operators"
in www.perl.com somewhere.
chok
Darren Williams wrote:
> Hi all,
>
> I hope someone can help please.
>
> I'm trying to interface my personal e-commerce attempt to a co that accepts
> credit cards. At an earlier date, I supply them a private key.
> When I send them a transaction I pass a variable which is a random seed.
> Once the transaction is processed I get a query string with a variable
> called cbpop passed back to me. Calling the sub below validates the
> transaction, returning a value of 1 if its good. I'd like to turn this
> below into VB, could someone please explain whats happening here as I know
> no CGI or Perl.
>
> sub valid
> {
> my($a,$b,$c,$h,$i,$l,$q,$w,$x,$y,$z,@s,@v);
>
> ###############################
> $a='YOUR_SECRET_KEY_GOES_HERE';
> ###############################
>
> $q='&'.substr($ENV{'QUERY_STRING'},0,256);
> $q=~/\Wseed=(\w+)/; $b=$1;
> $q=~/\Wcbpop=(\w+)/; $c=$1;
>
> return 0 unless $a&&$b&&$c;
>
> $h=0x80000000; $l=0x7fffffff;
> $q=''; $w=uc "$a $b"; $x=$y=$z=17;
> @v=unpack("C*",$w); $n=1+$#v;
> for($i=0;$i<256;$i++)
> { $w=(($x&$l)+($y&$l))^(($x^$y)&$h);
> $w=($w<<$z)|($w>>(32-$z));
> $w=(($w&$l)+$v[$i%$n])^($w&$h);
> $s[$i&7]+=$w&31; $z=$y&31; $y=$x; $x=$w;
> }
>
> for ($i=0;$i<8;$i++)
> { $q.=substr('0123456789BCDEFGHJKLMNPQRSTVWXYZ',$s[$i]&31,1); }
>
> return $c eq $q;
> }
>
> Thanks in advance.
>
> Darren
------------------------------
Date: Mon, 21 May 2001 18:35:58 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Help with using fcntl file locking
Message-Id: <db5jgtsmhvk7a1kad4prsmbvnffr6k49iq@news.supernews.net>
This is on RH 7.1, Perl 5.6. System is compiled to use flock() so to get
fcntl file locking [until/if I can get Perl recompiled with use-flock
turned off] I need to do the fcntl calls explicitly. I rarely have much
luck doing the low level stuff with the packs and all and getting it right
and this case is no exception. If someone could provide me with some help
on what's going wrong I'd appreciate it. Here's a little test program:
================================================
#!/usr/bin/perl -w
use Fcntl ;
use strict ;
use constant target => "/tmp/locktest" ;
use constant structflock => "SSLLL" ; # I *think* this is right
if (open (F, target))
{ print "Opening locktest file\n" ; }
else
{ die "Can't find target file\n" ; }
print "Locking target file\n" ;
my $lockit = pack(structflock, F_WRLCK, 0,0,0,0) ;
fcntl (F, F_SETLKW, $lockit) ;
print "Holding lock\n" ;
system("sleep 30") ;
print "Releasing lock\n" ;
close F ;
system("sleep 30") ;
print "Exiting\n" ;
===============================
I test this by doing: locktest.pl& locktest.pl&
When I do this program using flock() it works exactly as I hoped/expected:
the second instance of the program stalls until the first does a 'releasing
lock'. But I've tried a bunch of tweaks and twists [e.g., using F_RDLCK
and F_RdLCK | F_WRLCK] and no matter what I try, I get results like:
[bernie]> ./locktest.pl & ./locktest.pl&
Opening locktest file
Locking target file
Holding lock
[2] 1380
Opening locktest file
Locking target file
Holding lock
[3] 1382
Releasing lock
Releasing lock
Exiting
Exiting
with both processes happily "holding the lock" at the same time. I'm
clearly not grokking something simple/basic here. The unix man page
doesn't list any errors for F_SETLKW so I assume that it can never fail: it
stalls until it can do its thing and then just returns. THANKS!!
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Tue, 22 May 2001 00:13:31 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: Help: Can't use correctly File:Find in perl
Message-Id: <9ecavb$2mbk$1@nntp1.ba.best.com>
In article <9d135994.0105210745.7c40c390@posting.google.com>,
E.Lalande <emmanuel.lalande@bluelineinternational.com> wrote:
>Hi,
>
>Hope someone out there can help me. I'm trying to do the command
>"find /a_root_directory/* -prune -type d" under Perl with the
>File:find module to get a listing of 1st level sub-directories ONLY (I
>don't want to see any files or files within these sub-directories).
The version of File::Find that comes with perl-5.6.1 has a 'preprocess'
and 'postprocess' hook, where you can keep track of the directory depth.
You can use that to descend into directories that are too far down.
But your example is simple enough to handle via the command line.
unix% perl -le '-d && print foreach @ARGV' /tmp/*
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Mon, 21 May 2001 23:44:25 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Help: using constants from inherited parent class
Message-Id: <slrn9gja2p.jl8.abigail@tsathoggua.rlyeh.net>
Kai Henningsen (kaih=81IMb4HHw-B@khms.westfalen.de) wrote on MMDCCCXX
September MCMXCIII in <URL:news:81IMb4HHw-B@khms.westfalen.de>:
== abigail@foad.org (Abigail) wrote on 21.05.01 in <slrn9gidbm.6rt.abigail@tsathoggua.rlyeh.net>:
==
== > Even in an OO world, I'd like to use O_CREAT instead of Fcntl -> O_CREAT.
== >
== > Programmer convenience. Making 'Fcntl ->' mandatory adds *NOTHING*,
== > just warm fuzzy feelings for OO pronents.
==
== First of all, OO is really a red herring here. Not exporting stuff is a
== *namespace* decision, not an OO decision.
==
== OO just comes in because, in Perl, it is customary to be more strict with
== namespaces when using OO. But there's no particular reason it has to be
== that way.
==
== Now, that out of the way, the *namespace* benefit here is that two
== different modules can have two different O_CREAT symbols and not conflict.
== Sure, with O_CREAT that's rather unlikely; but certainly I do not have to
== explain that there are enough identifiers used for constants that
== sometimes, this _is_ an issue.
==
== Making a qualifier mandatory for constant names serves exactly the same
== purpose as making it mandatory for class methods ("global functions") or
== class variables ("global variables"). In short, "package" was invented
== because that's often useful. And yes, it's not *always* useful.
Ah, I see. So, the argument is "I don't export anything, cause despite
Perl giving you all means of saying what you want to import, and despite
MI being relatively rare (not to mention 99% of the OO module out there
are a frigging pain in the ass to use in MI anyway) I will assume you are
going to mess up and use something else making a name space clash.
Nanananana".
Very Perl-like.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Mon, 21 May 2001 23:49:28 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Help: using constants from inherited parent class
Message-Id: <slrn9gjac8.jl8.abigail@tsathoggua.rlyeh.net>
Sweth Chandramouli (sweth+perl@gwu.edu) wrote on MMDCCCXIX September
MCMXCIII in <URL:news:wEWN6.13080$G5.2563716@news1.rdc1.md.home.com>:
][ In article <slrn9gdva7.vtl.abigail@tsathoggua.rlyeh.net>,
][ Abigail <abigail@foad.org> wrote:
][
][ >Oh, you'd think so? You really think that if something was first defined
][ >as being constant, even if its value need to be accessed through a method
][ >call, programs won't break if it suddenly becomes variable?
][ I agree that a constant suddenly changing values in the
][ middle of the execution of a script would be a bad thing; the point of
][ encapsulation, however, is to allow for the underlying mechanism for the
][ methods to change. It's not necessarily for the values returned by
][ methods to change, although that is, obviously, a possiblity; it's also
][ a possibility with the imported-value approach to things, however--if you
][ are going to "use Foo", you kind of have to assume, whether it's OO or not,
][ that the person who maintains it isn't going to change its behaviour
][ without telling you.
Please tell me how exporting constant make it impossible, or even hard,
to change how they are calculated.
It isn't that constants aren't and need to be recalculated on the fly...
Not that there's anything in the usual way of implementing constants
in Perl that will actually prevent you from doing so...
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Mon, 21 May 2001 23:55:18 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: How to match the password created in Linux shadow suite?
Message-Id: <slrn9gjan6.jl8.abigail@tsathoggua.rlyeh.net>
Do not post Jeoparday style.
Do not crosspost to non-existing groups.
Joseph Chen (yen_hung@yahoo.com) wrote on MMDCCCXX September MCMXCIII in
<URL:news:bf927196.0105211114.6964be82@posting.google.com>:
:) The reply has a misunderstanding about the statement of the problem.
:) Whithout the Linux shadow suite, a common practice allows the password
:) a user types in to be encryped and compared against the system password
:) of the user in order to verify the access of the user. For a password
:) read from the user, e.g., $passwd_read, we can do the following in
:) perl to verify his/her access to the system.
:)
:) $salt = substr($passwd_read,0,2);
:) $passwd_read_and_encrypted = crypt($passwd_read,$salt);
:) if ($passwd_read_and_encrypted eq $user_passwd_encrypted_from_system) {
:) the user has access
:) } else {
:) the usr has no access
:) }
:)
:) Without using the shadow suite, we can get $user_passwd_encrypted_from_system
:) from /etc/passwd file. It does not require a 'root' access privilege to
:) read this file and the above codes work!
That's what I said. That's not considered to be "safe" anymore.
:) With the shadow suite, all user passwords in /etc/passwd are moved
:) to /etc/shadow and the passwords in /ect/password are replaced by '*'.
Feature.
:) To solve this password moving issue, I can read the user password
:) $user_passwd_encrypted_from_system from /etc/shadow instead of
:) /ect/passwd. But, the major problem I could not solve is that
:) the encrpyted password in /ect/shadow is longer than the password
:) encrypted in /etc/passwd. They have different lengths. This is
:) why my comparion if-statement in the above codes fails, even if
:) the $passwd_read is the same as the password of the user before
:) the password is encrypted by the shadow suite.
:)
:) Is it because the shadow suite uses a different encrypton method?
:) And, how do I fix this problem using perl? Any help is appreciated.
Well, your PS disqualifies you from receiving an answer.
:) P.S. I have root access to the machines I work on. So, please do not
:) raise the root access issue anymore.
Oh, ok. Then you don't get an answer. Because IT *IS* A ROOT ISSUE.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
------------------------------
Date: Mon, 21 May 2001 23:44:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: image_button and onClick???
Message-Id: <Pine.LNX.4.30.0105212331030.18249-100000@lxplus003.cern.ch>
On Mon, 21 May 2001, Bryan Coon jopardized:
> What do you think 'misc' stands for?
In usenet terminology, it means "a place for relevant topics which
don't have a more-specific group dedicated to them".
> This is a perl question,
It's also about coffee, apparently, but you don't post it on the group
rec.food.drink.coffee. You must have an explanation for that.
> There may be other appropriate groups, but that does NOT mean
> that comp.lang.perl.MISC is inappropriate!
I wouldn't normally bother in this much detail (you'd normally just
drop quietly into the killfile), but since you ask: if those other
appropriate groups don't end in misc, then a misc group _is_ prima
facie inappropriate.
> My apologies if I sound irritated,
Not at all. I seem to be getting quite good at recognising people who
vociferously insist on searching where the light is brightest, rather
than in the places where they have been told the treasure is likely to
be found. You just confirmed what I'd been expecting.
[and another chronic case of jeopardy]
------------------------------
Date: Mon, 21 May 2001 16:35:15 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: Re: image_button and onClick???
Message-Id: <3B09A633.D6E4DDE8@sequenom.com>
Netscape does not work with this code. :P
IE has no problem.
B
John Joseph Trammell wrote:
> On Fri, 18 May 2001 17:16:42 -0700, Bryan Coon <bcoon@sequenom.com> wrote:
> > For some reason, I cannot get the onclick javascript action to work with
> > CGI.pm's image_button. Here is a sample of code:
> >
> > --------------------------
> > #!/usr/bin/perl -w
>
> use strict; # grumble grumble
>
> [snip]
>
> > I have tried many variations, but no luck.
>
> Works OK on my server/browser. What exactly is "not working"?
>
> --
> According to the Genesis account, the tower of Babel was man's second
> major engineering undertaking, after Noah's ark. Babel was the first
> engineering fiasco.
> - F. Brooks, _The Mythical Man-Month_
------------------------------
Date: Mon, 21 May 2001 16:54:19 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: Re: image_button and onClick???
Message-Id: <3B09AAAB.37120584@sequenom.com>
>
> It's also about coffee, apparently, but you don't post it on the group
> rec.food.drink.coffee. You must have an explanation for that.
I do. You are exaggerating to support a weak argument. The post was
obviously not about coffee.
>
> Not at all. I seem to be getting quite good at recognising people who
> vociferously insist on searching where the light is brightest, rather
> than in the places where they have been told the treasure is likely to
And what exactly makes you think I did not already tried other sources?
You assume too much.
> be found. You just confirmed what I'd been expecting.
>
> [and another chronic case of jeopardy]
I find it very interesting that your original reply to my post had
nothing whatsoever to do with perl, as did the ensuing thread.
You should take your own advice.
Regardless, I feel my post was appropriate for this group. If you didn't
like it, ignore it.
------------------------------
Date: Mon, 21 May 2001 17:34:02 -0400
From: "Sparky" <tdyboc@insight.rr.com>
Subject: Installing module not as root
Message-Id: <9ec1kq0k8t@enews2.newsguy.com>
New to perl, Is it possible to install a series of modules in a temporary
directory to "test" with and move to the system level directory later? If
so where can I found information on the steps involved. I am working on an
IBM SP2 AIX 4.3 system.
Thanks
------------------------------
Date: Mon, 21 May 2001 19:51:13 -0400
From: ChokSheak Lau <chok@ece.gatech.edu>
Subject: linux: check whether an external program is running
Message-Id: <3B09A9F1.92BE5AFB@ece.gatech.edu>
i can't find an answer to this anywhere. basically, I'm trying to find
out from a Perl script whether a certain program is running or not,
without the PID. for example, for the program updatedb, I want to do
something equivalent to:
sub procRunning { return qx( ps -A | grep updatedb ) =~
m/[^\w]updatedb[^\w]/; }
# returns true if proc 'updatedb' is running, false otherwise
but i'm trying to not invoke shell and use two different programs to do
the work. so if you have a cleaner, leaner and faster way to do that,
pls let me know. any help is appreciated.
chok
------------------------------
Date: 21 May 2001 17:39:36 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: loosing contents of var
Message-Id: <m3zoc6conr.fsf@dhcp9-172.support.tivoli.com>
On Wed, 16 May 2001, mirvine@esatclear.ie wrote:
> Regardless of the DBI error, do you not find it strange that the
> $testerno variable seems to lose it's value? Is the error with perl,
> or the dbd-db2 module? (I really don't see where the error in my
> code is since it does run with the slight modification shown above).
Have you tried changing it back to see if it stops working? I can see
no reason for the change you made to have any effect. This feels like
one of those situations where the code that exhibited the problem was
ever-so-slightly different from the code in your post.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 22 May 2001 00:24:51 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <MPG.1573b41e90f0eb1c9898af@news.inode.at>
In article <3B09305D.98D55489@iname.com>, kjetilskotheim@iname.com says...
>
> perl -e
> '$n=5;$x=18;while(1){my$sum;my@sum;for(1..$n){$i=1+int(rand($x-1));push@sum,$i;$sum+=$i}print
> join(" ",@sum)."\n" and last if $sum==$x}'
>
while this works just fine for n and x small, your cpu will get hot if
this numbers grow. Drew did not tell us, if he needs only small numbers.
In that case your algorithm would be perfect, cause its "truly" random and
components are equally distributed.
If you need a algorithm for big number I would try the following
mathematical approach:
* think of total possibilities to build n components that add to x
(its the binomialcoefficient, cause we dont care about order)
* make a sequential order for all this groups so you can construct the
group out of its ordernumber in linear time. (yup - thats the hard one)
* generate a randum ordernumber and calculate the group.
Even if this is solveable (I dont know) it dont looks like an easy one.
peter
--
pilsl@
goldfisch.at
------------------------------
Date: Tue, 22 May 2001 00:18:48 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: module for combinatorics? (partitions etc)
Message-Id: <slrn9gjc38.jl8.abigail@tsathoggua.rlyeh.net>
William Cardwell (EUSWMCL@am1.ericsson.se) wrote on MMDCCCXX September
MCMXCIII in <URL:news:3B095E28.411E6026@am1.ericsson.se>:
}}
}}
}} Drew Krause wrote:
}} >
}} > I'm especially interested in finding a module or algorithm which will
}} > return a random combination of n integers which sum to x. For example, n
}} > = 5 and x = 18 might return (1 1 1 5 10).
}}
}} Intriguing...
}}
}} This tends toward too many ones...Not trivial is it?
Indeed. Not at all trivial, because he said *integers*, not natural
numbers, or positive integers.
So, one or more could easily be negative, leading to an infinite number
of possible answers.
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Tue, 22 May 2001 00:40:50 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Need help on formatting output
Message-Id: <tgjdcib5nhp571@corp.supernews.com>
Ren Maddox <ren@tivoli.com> wrote:
> On Mon, 21 May 2001, admin@the-piper.net wrote:
[snip]
>> Looks nice at the first look. My problem at this is that
>> i.e. AlphaCentauri is already located in the next directory
>> 20010521. But written in the content output of 20010520.
>>
>> How can I handle this that after the directory is finished a new
>> page with header is started?
> It's been a while since I had to do this, but IIRC, you can set $- to
> 0 before calling write to force a new page.
I believe you can set $= to the number of total lines on the page
when at the top of the page, if you only do output with write().
q{perldoc perlform} states that you can mix print()s and write()s,
but you'll have to manage $- on your own.
I think Ren's advice will work.
You must cede to me one of your bases, or I will crush you
like a bug! Ooops... sorry. I was playing Alpha Centauri
all day yesterday.
Chris
--
People understand instinctively that the best way for computer programs to
communicate with each other is for each of the them to be strict in what they
emit, and liberal in what they accept. The odd thing is that people themselves
are not willing to be strict in how they speak, and liberal in how they listen.
-- Larry Wall, 2nd State of the Onion Address, August 1998
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 953
**************************************