[17319] in Perl-Users-Digest
Perl-Users Digest, Issue: 4741 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 27 06:10:27 2000
Date: Fri, 27 Oct 2000 03:10: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: <972641412-v9-i4741@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 27 Oct 2000 Volume: 9 Number: 4741
Today's topics:
Re: MIME Mail help on NT - no sendmail! (Emmett McLean)
Re: Newbie (Clay Irving)
Nifty Perl E-Mail Client (Sean McAfee)
non-blocking children with NT forks <hmacdonald@europarl.eu.int>
Re: Password Authentification (getpwent) (Anders Arnholm)
Re: Password Authentification (getpwent) <josef.moellers@fujitsu-siemens.com>
Re: Perl on NT (Clay Irving)
Re: problem with ``system("clear");´´ (Andrew N. McGuire)
PV (PerlVision) problems! pfax@my-deja.com
Re: Question about perl -w <lr@hpl.hp.com>
Re: renaming local() <james@NOSPAM.demon.co.uk>
Re: Spaces to tab equilibrium1@my-deja.com
Re: Starting background process from Perl <gellyfish@gellyfish.com>
Re: what does /warn "$x" if "$x"/ mean <krahnj@acm.org>
Re: What's wrong with this regex? <dlorre@caramail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Oct 2000 22:36:25 -0700
From: emclean@slip.net (Emmett McLean)
Subject: Re: MIME Mail help on NT - no sendmail!
Message-Id: <8tb48p$ca1@slip.net>
Check out
http://www.catherinesart.com/catherine/mail.tar.gz
I use MIME to send attachments.
Complete with html and images.
I also use IMAP to peruse the mail box and peruse attachments.
em
------------------------------
Date: 25 Oct 2000 20:45:55 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Newbie
Message-Id: <slrn8vehk3.bdk.clay@panix3.panix.com>
On Wed, 25 Oct 2000 20:09:20 GMT, 5defcon5@my-deja.com
<5defcon5@my-deja.com> wrote:
>I am writing a web page that has a form taking in a username and
>password. I would like to verify this username and password against
>the system password file. Is there a module or something to help me do
>this and can someone give me an example of how this module is used.
#!/usr/local/bin/perl -w
chomp($me = shift);
if (getpwnam($me)) {
print "$me has an account\n";
} else {
print "$me doesn't have an account\n";
}
Result:
[clay@kozmik clay]$ ./foo.pl clay
clay has an account
[clay@kozmik clay]$ ./foo.pl goober
goober doesn't have an account
--
Clay Irving <clay@panix.com>
#3532. The law neither does nor requires idle acts.
- California Civil Code, Maxims of Jurisprudence
------------------------------
Date: Fri, 27 Oct 2000 06:33:10 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Nifty Perl E-Mail Client
Message-Id: <Gk9K5.8409$O5.180379@news.itd.umich.edu>
If you want to try out a nice little e-mail client written in Perl, go to:
http://www-personal.umich.edu/~mcafee/perl/pmc/
Complete documentation is available at the above URL.
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Fri, 27 Oct 2000 10:59:23 +0200
From: macdo <hmacdonald@europarl.eu.int>
Subject: non-blocking children with NT forks
Message-Id: <39F943EB.FD6E5B0A@europarl.eu.int>
Is it possible to have a child sleep in a non-blocking way with NT.
Since forks are implemented inside a single process in NT, a sleep
inside a child makes an orgy (everyone sleeps together).
------------------------------
Date: 27 Oct 2000 06:36:35 GMT
From: Anders@Arnholm.nu (Anders Arnholm)
Subject: Re: Password Authentification (getpwent)
Message-Id: <slrn8vi8ip.5dm.Anders@tika.arnholm.nu>
5defcon5@my-deja.com <5defcon5@my-deja.com> skriver:
>already have entries on the machine. I am looking at the getpwent()
>function but can't figure it out very well. Can I use this function to
I should use: getpwnam $user and $password are the usename and the
password to be verified.
($name,$passwd,$uid,$gid,
$quota,$comment,$gcos,$dir,$shell,$expire) = getpwnam($user);
if(crypt($word, $passwd) ne $passwd) {
die "Sorry...\n";
} else {
printf "Right password.";
}
/ Balp
--
http://www.arnholm.nu/~balp/ Keep on Balping
------------------------------
Date: Fri, 27 Oct 2000 11:54:49 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Password Authentification (getpwent)
Message-Id: <39F950E9.7B692C99@fujitsu-siemens.com>
Anders Arnholm wrote:
> =
> 5defcon5@my-deja.com <5defcon5@my-deja.com> skriver:
> >already have entries on the machine. I am looking at the getpwent()
> >function but can't figure it out very well. Can I use this function t=
o
> =
> I should use: getpwnam $user and $password are the usename and the
> password to be verified.
> =
> ($name,$passwd,$uid,$gid,
> $quota,$comment,$gcos,$dir,$shell,$expire) =3D getpwnam($user);
> if(crypt($word, $passwd) ne $passwd) {
> die "Sorry...\n";
> } else {
> printf "Right password.";
> }
Unless, of course, you have shadow passwords enabled. Then $passwd will
be "x".
Ordinary user processes have no right to access /etc/shadow ...
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
Date: 26 Oct 2000 00:29:10 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Perl on NT
Message-Id: <slrn8veumm.kr0.clay@panix6.panix.com>
On Thu, 26 Oct 2000 00:03:18 GMT, Martien Verbruggen
<mgjv@tradingpost.com.au> wrote:
>> Is Perl in NT (4.0) integrated, or has it to be installed additionally
>> ?
>
>Are you asking whether it comes as part of the OS? No. And if it did,
>I'd be very afraid to use it.
Can you imagine Visual Perl++ Studio?
--
Clay Irving <clay@panix.com>
Fashion is a form of ugliness so intolerable that we have to alter it
every six months.
- Oscar Wilde
------------------------------
Date: 26 Oct 2000 21:23:35 -0500
From: anmcguire@ce.mediaone.net (Andrew N. McGuire)
Subject: Re: problem with ``system("clear");´´
Message-Id: <87aebrt42g.fsf@hawk.ce.mediaone.net>
>>>>> "n" == nobull <nobull@mail.com> writes:
n> "Brian Reichholf" <brian@reichholf.at> writes:
>> at last i found the perlfaq and a way to clear the screen,
>> the command is system("clear")
n> Well actually "clear" should be replaced with whatever the equivalent
n> command is on your operating system.
n> For example, on DOS-like systems, it is "cls".
Or he could also use Term::Cap, the other solution in the
FAQ, of course the extra overhead may not be wanted or needed.
anm
--
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'
------------------------------
Date: Fri, 27 Oct 2000 08:36:05 GMT
From: pfax@my-deja.com
Subject: PV (PerlVision) problems!
Message-Id: <8tbepl$5c0$1@nnrp1.deja.com>
How can I manipulate properties of an PV:Entryfield, like background (in our
new installation PV1.4, Curses 1.05 it's always inverse)? Could it be defined
via Curses?
Has anyone an idea?
Thanx
Rudi
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 14:55:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Question about perl -w
Message-Id: <MPG.14624818702e578498ae70@nntp.hpl.hp.com>
In article <39F85CCF.42486BC1@mail.uca.edu> on Thu, 26 Oct 2000 11:33:19
-0500, Cameron Dorey <camerond@mail.uca.edu> says...
> Jeff Zucker wrote:
> > "Andrew N. McGuire" wrote:
> > > >>>>> "NM" == Nicolas MONNET <nico@monnet.to> writes:
> > > NM> If I get too many warnings, do I get suspended?
> > >
> > > I must be missing something... what do you mean "do I get suspended"?
> > > What does that have to do with '-w'?
> >
> > You, know, like if the teacher gives you a warning not to talk in class
> > and if you ignore X number of warnings you get kicked out of school.
> > AFAIK, this only occurs when you build perl with the -S&M option.
>
> -S&M option, do you mean the option that is default (required) when you
> work in Window$?
No, it is the MS option.
> semicolon, right paren
semicolon, left paren
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Oct 2000 04:49:31 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: renaming local()
Message-Id: <ant270331345fNdQ@oakseed.demon.co.uk>
Strange, this posting of mine hasn't appeared. Sorry if you
get two copies, but let me try again...
In article <xn93dhlkpu9.fsf@sync27.doc.ic.ac.uk>, Edward Avis
<URL:mailto:epa98@doc.ic.ac.uk> wrote:
>
> darkon@one.net (David Wall) writes:
> > I just finished reading Larry Wall's speech at
> > http://archive.develooper.com/perl6-meta@perl.org/msg00427.html. In it,
> > he mentions the possibility of renaming local() (in the paragraph
> > beginning 'Rename the local operator?'). If you'll listen to a
> > suggestion from someone who knows nothing about Perl internals, then
> > what about renaming it to 'this'?
>
> That would confuse C++ programmers. You should never do that :-)
>
> How about 'dynamically_scoped'? Hmm, too verbose. 'dynamic'?
I like verbs such as: save, preserve, scope, limit, stack, store
Or adjectives such as: scoped, limited, internal, local
Of all of those, local seems the most natural to me. You've probably
all forgotten, but in BASIC the LOCAL command *dynamically* scopes the
given variables, and there is no lexical scoping. If you've come from
a BASIC background the Perl local and my statements make perfect
sense, so why change it at all? Are there any languages where the
key word local means something confusingly different?
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: Fri, 27 Oct 2000 05:41:22 GMT
From: equilibrium1@my-deja.com
Subject: Re: Spaces to tab
Message-Id: <8tb4i1$t60$1@nnrp1.deja.com>
In article <8t7ghi$vlr$1@nnrp1.deja.com>,
equilibrium1@my-deja.com wrote:
> I'm trying to come up with a regex pattern that will evaluate the
space
> at the beginning of the line up to the non-whitespace characters in
> such a way that 4 spaces are converted to tab characters and any extra
> space characters left over are converted to null.
> So far I have this:
> $line=~s/( {4}/\t/g;
I mis-stated my question; thank you all for replying, however. My
intent was actually to convert every four spaces of whitespace at the
beginning of the line such that 10 spaces=2 tab (two extra spaces
eliminated), 7 spaces=1 tab, and any extraneous whitespace after the
code portion of the line (save the newline character) be converted to
null.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 27 Oct 2000 07:13:50 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Starting background process from Perl
Message-Id: <8tb6eu$jid$1@orpheus.gellyfish.com>
On Thu, 26 Oct 2000 11:59:15 GMT djoerg@my-deja.com wrote:
> Hi,
>
> I want to start a new process from a perl script, but the script always
> waits until the process is complete (the new process takes very long to
> complete and the webserver should get back a message from the script).
> Is there any way to launch the process so that perl doesn't wait for the
> child to complete?
>
I think you want fork() which you can read about in the perlfunc manpage.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Fri, 27 Oct 2000 00:05:38 -0700
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: what does /warn "$x" if "$x"/ mean
Message-Id: <39F92942.540625EF@acm.org>
[Please start a new thread instead of replying to a previous thread]
joechakra@my-deja.com wrote:
>
> Here is a short perl script(?) I wrote to split images and it works:
^^^^^^^
> use Image::Magick;
> $fname=shift;
> print "input file=$fname\n";
> $image = new Image::Magick;
> $x=$image->Read($fname);
> warn "$x" if "$x";
> $count=0+$x;
> $of="out001";
> print "$count";
>
> -------------------------------------------
> My question what is the meaning of
> warn "$x" if "$x";
> $count=0+$x;
You wrote it. Why did you write it this way? What do you think it is
supposed to do?
> Is $x a string, a number, a list, or a class? warn does not produce any
yes yes no no
It is a scalar variable that can hold a string or a number or a
reference depending on context.
perldoc perldata
John
------------------------------
Date: Fri, 27 Oct 2000 08:18:29 GMT
From: Dominique Lorre <dlorre@caramail.com>
Subject: Re: What's wrong with this regex?
Message-Id: <8tbdog$4o2$1@nnrp1.deja.com>
In article <Mc4K5.1049$G95.302893@typhoon.southeast.rr.com>,
"David Sisk" <davesisk@ipass.net> wrote:
> $some_variable = $1 + $2/$3 if ($other_variable =~ /\d{2} \D[A-Z][a-z]
{3}
> (\d*) (\d*)\/(\d*)/);
>
> The string in $other_variable looks like one of these:
> 00 Nov 5 (IFQ KA-E)
> 00 Nov 7 1/2 (IFQ KB-E)
> 00 Nov 10 (IFQ KC-E)
> 00 Nov 12 1/2 (IFQ KD-E)
>
> I'm trying to get the number in the middle (the 5, 7.5, 10, 12.5
> respectively) into $some_variable. What's wrong with my regex?
I see 3 problems with this code:
$some_variable = $1 + $2/$3
when $3 is zero you will get an error.
\D[A-z][a-z]{3}
you are looking for a non digit character followed by an upper case
character then 3 lower case characters which is not what you want.
\/
This search will fail if the / char is missing in the string.
You might want to try something like this:
#!/usr/bin/perl -w
use strict;
my($some_variable, $other_variable, @examples) ;
@examples = (
"00 Nov 5 (IFQ KA-E)",
"00 Nov 7 1/2 (IFQ KB-E)",
"00 Nov 10 (IFQ KC-E)",
"00 Nov 12 1/2 (IFQ KD-E)"
) ;
foreach $other_variable(@examples) {
$some_variable = -1 ; # undef marker
$some_variable = $3?$1+$2/$3:$1
if ($other_variable =~ |\d{2} [A-Za-z]{3} (\d*) (\d*)/*(\d*)|);
print "$some_variable = $some_variable\n" ;
}
HTH
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 4741
**************************************