[16697] in Perl-Users-Digest
Perl-Users Digest, Issue: 4109 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 23 18:10:49 2000
Date: Wed, 23 Aug 2000 15:10:31 -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: <967068631-v9-i4109@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 23 Aug 2000 Volume: 9 Number: 4109
Today's topics:
Re: LDAP and authentication <amonotod@netscape.net>
Re: long-to-short dir/filenames <newsgroup@pmail.net>
Mail::Send <bcspencer2@home.com>
mnemonics for //m, //s (was: Re: negative lookahead ass (Neil Kandalgaonkar)
Re: Modifying @INC: my problem and solution (any commen (Malcolm Dew-Jones)
Re: multi-line reg exp deletion <ren.maddox@tivoli.com>
Re: newbie question - dont flame me <amonotod@netscape.net>
Re: newbie question - dont flame me filosmith@my-deja.com
Re: newbie question - dont flame me filosmith@my-deja.com
Re: newbie question - dont flame me <amonotod@netscape.net>
Re: newbie question - dont flame me <amonotod@netscape.net>
Re: newbie question - dont flame me filosmith@my-deja.com
Re: newbie question - dont flame me <amonotod@netscape.net>
Re: newbie question - dont flame me <ren.maddox@tivoli.com>
Re: newbie question - dont flame me <ren.maddox@tivoli.com>
Re: newbie question about "uninitialized variables" <iltzu@sci.invalid>
OT: Re: Programming Ethics (Tim Hammerquist)
Re: Perl and dates <ren.maddox@tivoli.com>
Re: Perl and dates zideon@my-deja.com
Re: perl books <admin@salvador.venice.ca.us>
Re: perl hash code <lr@hpl.hp.com>
Re: perl hash code <amonotod@netscape.net>
Perl vs. other scripting languages <khayyam.noon@unisys.com>
Re: Perl vs. other scripting languages <katz@underlevel.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 23 Aug 2000 20:09:01 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: LDAP and authentication
Message-Id: <8o1b0c$bpj$1@nnrp1.deja.com>
In article <8o0pu9$luj$1@nnrp1.deja.com>,
Andre-John Mas <ajmas@bigfoot.com> wrote:
> Next, does anyone have any code that would show me how to use
> the LDAP module for authentication purposes?
If you are able to convert Java code to Perl code, see:
http://developer.iplanet.com/docs/examples/appserver/ldap.html
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 22:02:26 +0200
From: "Giovanni Loc" <newsgroup@pmail.net>
Subject: Re: long-to-short dir/filenames
Message-Id: <8o1amc$f1b$1@nslave1.tin.it>
great!! this Perl script works and it's TENS times more fast than the AWK
not-native solution!
> use strict;
> use Win32;
> while (<>) {
> chomp;
> print Win32::GetShortPathName($_),"\n";
> }
------------------------------
Date: Wed, 23 Aug 2000 20:50:10 GMT
From: Bryan Spencer <bcspencer2@home.com>
Subject: Mail::Send
Message-Id: <39A43813.2D0CCED@home.com>
I recently downloaded the MailTools package
but I seem to be having to problems.
1.) It seems to work correctly but when I use it it feeds a message
throught to my browser which says $msg->close
is not part of the Mail::Send package.
2.) I cannot figure out how to fill in who the email that I am sending
is from.
Any help would be greatly appreciated.
------------------------------
Date: Wed, 23 Aug 2000 21:24:57 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: mnemonics for //m, //s (was: Re: negative lookahead assertions in Perl Regex)
Message-Id: <8o1f1s$b22$1@localhost.localdomain>
In article <MPG.140dad7779d321e198acc9@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>The Perl dcumentation provides mnemonics, in two places.
>
>perlop:
> m Treat string as multiple lines.
> s Treat string as single line.
Those don't work for me, and apparently not for most people.
When people want to match something that spans multiple lines,
they automatically think of "m" precisely because of that entry
in perlop.
But "m" actually breaks a multi-line string into individual lines,
with regards to what ^ and $ do.
Worse, that mnemonic suggests that //m and //s are mutually
exclusive, and they aren't!
----------------------------
#!/usr/bin/perl -w
my $foo = <<EOF;
abc
def
ghi
jkl
EOF
print "plain: <", ( $foo =~ m/(d.*i)/ ), ">\n"; # <>
print "with s: <", ( $foo =~ m/(d.*i)/s ), ">\n"; # <def\nghi>
print "^ with m: <", ( $foo =~ m/^(d.*i)/m ), ">\n"; # <>
print "^ with ms: <", ( $foo =~ m/^(d.*i)/ms ), ">\n"; # <def\nghi>
----------------------------
I still can't think of a better mnemonic, though.
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: 23 Aug 2000 11:52:18 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Modifying @INC: my problem and solution (any comment?)
Message-Id: <39a41d62@news.victoria.tc.ca>
hasant@trabas.com wrote:
: The Problem
: Determine a non-standard module path dynamically
: in the scripts.
Can you not define the PERL5LIB environment variable before hand?
(that name could be wrong, look it up)
Or use relative paths?
Also useful, a module can be in more than one location - you can place any
number of test versions in directories earlier in the path to temporarily
replace a module.
------------------------------
Date: 23 Aug 2000 09:41:46 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: multi-line reg exp deletion
Message-Id: <m3em3g82fp.fsf@dhcp11-177.support.tivoli.com>
"Driver" <betsamaarcra@mindspring.com> writes:
> I have mif files (text) generated by FrameMaker, long files. I want to
> remove large chunks of text. For example:
>
> ...Lots of text
>
> <Page
> unwanted chunk of text
> unwanted chunk of text
> unwanted chunk of text
> unwanted chunk of text
> > # end of Page.
>
> ... Lots more of text....
>
>
> I have a script that does substitution, and it works fine, but I'm trying to
> eliminate the multi-line chunk and I'm missing something
This sounds like a perfect use for the ".." operator in scalar
context.
Try something like:
while(<>) {
print unless /^\s*<Page\s*/ .. /^\s*> # end of Page\.\s*$/;
}
Note that I made the to REs very explicit -- you may want to modify
them.
perldoc perlop
(search for "Range Operators", then look at the part on scalar context)
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 23 Aug 2000 18:24:58 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: newbie question - dont flame me
Message-Id: <8o14t0$3um$1@nnrp1.deja.com>
I've reordered the message to help context. To read more about it,
http://www.geocities.com/amonotod/non_jep_reply.html.
In article <8o12dl$ko$1@nnrp1.deja.com>,
filosmith@my-deja.com wrote:
> In article <8o11d3$vj3$1@nnrp1.deja.com>,
> amonotod <amonotod@netscape.net> wrote:
> > In article <8o10q1$ujd$1@nnrp1.deja.com>,
> > filosmith@my-deja.com wrote:
> > > I'm sorry, but none of those suggestions worked for me, although
> I've
> > > filed them all away for future use. Here is the rest:
> > > %serverList = qw ( DOMAIN WinNT://DOMAIN
> > > NWFS1 NWCOMPAT://NWFS1
> > > NWFS2 NWCOMPAT://NWFS2
> > > NWFS3 NWCOMPAT://NWFS3
> > > NWPS1 NWCOMPAT://NWPS1
> > > );
> > > foreach $displayName (keys %serverList)
> > > {
> > > foreach $uName (keys %{$displayName})
> > > {
> > > print "$displayName->{$uName}\n";
> > > }
> > > }
> > >
> > Well, we all thought that you had a hash of hashes. All yo really
> have
> > is a hash, or keyed array. Try this:
> >
> > foreach my $displayName (keys %serverList) {
> > print "$displayName \= $serverList{$displayName}\n";
> > }
> That's awesome. Each of these server names is supposed to be the name
> of a hash too, though. each key name in the hash is supposed to be the
> username, and each value of the hash is supposed to be the user's full
> name. if i print it during the same foreach the hash is populated in
> it works. thereafter, it doesn't print anything and doesn't give an
> error with -w.
> That's awesome. Each of these server names is supposed to be the name
> of a hash too, though. each key name in the hash is supposed to be the
> username, and each value of the hash is supposed to be the user's full
> name. if i print it during the same foreach the hash is populated in
it
> works. thereafter, it doesn't print anything and doesn't give an error
> with -w.
>
> Thanks again.
> Filo
>
Straight from the Camel Book (ISBN 1-56592-149-6) (Okay, not _straight_
from the Camel Book, I interpolated the example to fit the question...)
foreach $displayName (sort keys %serverList) {
foreach $uName (sort keys %{$serverList{$displayName}}) {
print " $serverList{$displayName}{$uName} \n";
}
}
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 18:59:28 GMT
From: filosmith@my-deja.com
Subject: Re: newbie question - dont flame me
Message-Id: <8o16u3$6ha$1@nnrp1.deja.com>
Is it maybe not working because the name of each hash of usernames is
the key of the hash of servernames and not the value? I'm trying to get
it to print "NWFS2{Administrator} = Doe, John\n" and it seems like the
camel example would be trying to print "NWCOMPAT://NWFS2{Administrator}"
Thanks for your patience,
Filo
In article <8o14t0$3um$1@nnrp1.deja.com>,
amonotod <amonotod@netscape.net> wrote:
> I've reordered the message to help context. To read more about it,
> http://www.geocities.com/amonotod/non_jep_reply.html.
>
> In article <8o12dl$ko$1@nnrp1.deja.com>,
> filosmith@my-deja.com wrote:
> > In article <8o11d3$vj3$1@nnrp1.deja.com>,
> > amonotod <amonotod@netscape.net> wrote:
> > > In article <8o10q1$ujd$1@nnrp1.deja.com>,
> > > filosmith@my-deja.com wrote:
> > > > I'm sorry, but none of those suggestions worked for me, although
> > I've
> > > > filed them all away for future use. Here is the rest:
> > > > %serverList = qw ( DOMAIN WinNT://DOMAIN
> > > > NWFS1 NWCOMPAT://NWFS1
> > > > NWFS2 NWCOMPAT://NWFS2
> > > > NWFS3 NWCOMPAT://NWFS3
> > > > NWPS1 NWCOMPAT://NWPS1
> > > > );
> > > > foreach $displayName (keys %serverList)
> > > > {
> > > > foreach $uName (keys %{$displayName})
> > > > {
> > > > print "$displayName->{$uName}\n";
> > > > }
> > > > }
> > > >
> > > Well, we all thought that you had a hash of hashes. All yo really
> > have
> > > is a hash, or keyed array. Try this:
> > >
> > > foreach my $displayName (keys %serverList) {
> > > print "$displayName \= $serverList{$displayName}\n";
> > > }
> > That's awesome. Each of these server names is supposed to be the
name
> > of a hash too, though. each key name in the hash is supposed to be
the
> > username, and each value of the hash is supposed to be the user's
full
> > name. if i print it during the same foreach the hash is populated in
> > it works. thereafter, it doesn't print anything and doesn't give an
> > error with -w.
> > That's awesome. Each of these server names is supposed to be the
name
> > of a hash too, though. each key name in the hash is supposed to be
the
> > username, and each value of the hash is supposed to be the user's
full
> > name. if i print it during the same foreach the hash is populated in
> it
> > works. thereafter, it doesn't print anything and doesn't give an
error
> > with -w.
> >
> > Thanks again.
> > Filo
> >
>
> Straight from the Camel Book (ISBN 1-56592-149-6) (Okay, not
_straight_
> from the Camel Book, I interpolated the example to fit the
question...)
>
> foreach $displayName (sort keys %serverList) {
> foreach $uName (sort keys %{$serverList{$displayName}}) {
> print " $serverList{$displayName}{$uName} \n";
> }
> }
>
> HTH,
> amonotod
>
> --
> `\|||/ amonotod@
> (@@) netscape.net
> ooO_(_)_Ooo________________________________
> _____|_____|_____|_____|_____|_____|_____|_____|
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:09:35 GMT
From: filosmith@my-deja.com
Subject: Re: newbie question - dont flame me
Message-Id: <8o17gt$78r$1@nnrp1.deja.com>
I get no output and no error messages.
In article <8o17ac$76c$1@nnrp1.deja.com>,
amonotod <amonotod@netscape.net> wrote:
> Again, I've reordered the message, and done some snipping, to help
> context. To read more about it,
> http://www.geocities.com/amonotod/non_jep_reply.html.
>
> In article <8o16u3$6ha$1@nnrp1.deja.com>,
> filosmith@my-deja.com wrote:
> > In article <8o14t0$3um$1@nnrp1.deja.com>,
> <snip>
> > > foreach $displayName (sort keys %serverList) {
> > > foreach $uName (sort keys %{$serverList{$displayName}}) {
> > > print " $serverList{$displayName}{$uName} \n";
> > > }
> > > }
> > >
> > Is it maybe not working because the name of each hash of usernames
is
> > the key of the hash of servernames and not the value? I'm trying to
> get
> > it to print "NWFS2{Administrator} = Doe, John\n" and it seems like
the
> > camel example would be trying to print
> "NWCOMPAT://NWFS2{Administrator}"
> >
> > Thanks for your patience,
> > Filo
> >
>
> Hmmm.... Well, what do you get? Let's see some output...
> amonotod
>
> --
> `\|||/ amonotod@
> (@@) netscape.net
> ooO_(_)_Ooo________________________________
> _____|_____|_____|_____|_____|_____|_____|_____|
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:06:05 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: newbie question - dont flame me
Message-Id: <8o17ac$76c$1@nnrp1.deja.com>
Again, I've reordered the message, and done some snipping, to help
context. To read more about it,
http://www.geocities.com/amonotod/non_jep_reply.html.
In article <8o16u3$6ha$1@nnrp1.deja.com>,
filosmith@my-deja.com wrote:
> In article <8o14t0$3um$1@nnrp1.deja.com>,
<snip>
> > foreach $displayName (sort keys %serverList) {
> > foreach $uName (sort keys %{$serverList{$displayName}}) {
> > print " $serverList{$displayName}{$uName} \n";
> > }
> > }
> >
> Is it maybe not working because the name of each hash of usernames is
> the key of the hash of servernames and not the value? I'm trying to
get
> it to print "NWFS2{Administrator} = Doe, John\n" and it seems like the
> camel example would be trying to print
"NWCOMPAT://NWFS2{Administrator}"
>
> Thanks for your patience,
> Filo
>
Hmmm.... Well, what do you get? Let's see some output...
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:23:53 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: newbie question - dont flame me
Message-Id: <8o18bg$8cr$1@nnrp1.deja.com>
For the last time, I've reordered the message, and done some snipping,
to help context. To read more about it,
http://www.geocities.com/amonotod/non_jep_reply.html.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
filosmith, please read the above before replying!!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In article <8o17gt$78r$1@nnrp1.deja.com>,
filosmith@my-deja.com wrote:
> In article <8o17ac$76c$1@nnrp1.deja.com>,
> amonotod <amonotod@netscape.net> wrote:
> > Again, I've reordered the message, and done some snipping, to help
> > context. To read more about it,
> > http://www.geocities.com/amonotod/non_jep_reply.html.
> >
> > In article <8o16u3$6ha$1@nnrp1.deja.com>,
> > filosmith@my-deja.com wrote:
> > > In article <8o14t0$3um$1@nnrp1.deja.com>,
> > <snip>
> > > > foreach $displayName (sort keys %serverList) {
> > > > foreach $uName (sort keys %{$serverList{$displayName}}) {
> > > > print " $serverList{$displayName}{$uName} \n";
> > > > }
> > > > }
> > > >
> > > Is it maybe not working because the name of each hash of usernames
> is
> > > the key of the hash of servernames and not the value? I'm trying
to
> > get
> > > it to print "NWFS2{Administrator} = Doe, John\n" and it seems like
> the
> > > camel example would be trying to print
> > "NWCOMPAT://NWFS2{Administrator}"
<snip>
> > Hmmm.... Well, what do you get? Let's see some output...
> I get no output and no error messages.
That would indicate to me that the hashes are empty, or null. Have you
tried running it against a single server, or without the data going into
a HoH?
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:45:24 GMT
From: filosmith@my-deja.com
Subject: Re: newbie question - dont flame me
Message-Id: <8o19ke$9vc$1@nnrp1.deja.com>
> filosmith, please read the above before replying!!!
sorry about that. I'm a moron.
> That would indicate to me that the hashes are empty, or null. Have
you
> tried running it against a single server, or without the data going
into
> a HoH?
if I print it during the foreach below, it works fine. It goes through
each server and makes a hash called $displayName with keys called
$uName that have values called $uFName.
I guess it goes through each individual hash okay.
foreach $displayName (keys %serverList)
{
$adsDomain = Win32::OLE->GetObject($serverList{$displayName});
$domainEnumerator = Win32::OLE::Enum->new($adsDomain);
while (defined($domainObject = $domainEnumerator->Next))
{
if ($domainObject->Class eq "User")
{
$uName = $domainObject->Name;
$uFName = $domainObject->FullName;
$displayName{$uName} = $uFName;
###############
#### if i print at this point it comes out fine.
###############
Is this post snipped right?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 20:07:10 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: newbie question - dont flame me
Message-Id: <8o1asu$boe$1@nnrp1.deja.com>
In article <8o19ke$9vc$1@nnrp1.deja.com>,
filosmith@my-deja.com wrote:
> > That would indicate to me that the hashes are empty, or null. Have
> you
> > tried running it against a single server, or without the data going
> into
> > a HoH?
>
> if I print it during the foreach below, it works fine. It goes through
> each server and makes a hash called $displayName with keys called
> $uName that have values called $uFName.
>
> I guess it goes through each individual hash okay.
>
> foreach $displayName (keys %serverList)
> {
> $adsDomain = Win32::OLE->GetObject($serverList{$displayName});
> $domainEnumerator = Win32::OLE::Enum->new($adsDomain);
> while (defined($domainObject = $domainEnumerator->Next))
> {
> if ($domainObject->Class eq "User")
> {
> $uName = $domainObject->Name;
> $uFName = $domainObject->FullName;
> $displayName{$uName} = $uFName;
> ###############
> #### if i print at this point it comes out fine.
> ###############
>
If you print what? Are you doing
print "$displayName}{$uName}\n";
or are you doing
print "$serverList{$displayName}{$uName}\n";
?
Because you're creating a variable for the first print, not the
second...
> Is this post snipped right?
Very nice...
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 Aug 2000 13:11:44 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: newbie question - dont flame me
Message-Id: <m3zom37spr.fsf@dhcp11-177.support.tivoli.com>
filosmith@my-deja.com writes:
> I'm sorry, but none of those suggestions worked for me, although I've
> filed them all away for future use. Here is the rest:
> %serverList = qw ( DOMAIN WinNT://DOMAIN
> NWFS1 NWCOMPAT://NWFS1
> NWFS2 NWCOMPAT://NWFS2
> NWFS3 NWCOMPAT://NWFS3
> NWPS1 NWCOMPAT://NWPS1
So %serverList is a hash of names to some sort of network spec.
> foreach $displayName (keys %serverList)
> {
> $adsDomain = Win32::OLE->GetObject($serverList{$displayName});
> $domainEnumerator = Win32::OLE::Enum->new($adsDomain);
> while (defined($domainObject = $domainEnumerator->Next))
> {
> if ($domainObject->Class eq "User")
> {
> $uName = $domainObject->Name;
> $uFName = $domainObject->FullName;
> $displayName{$uName} = $uFName;
Ah... so %displayName is a hash of "Name"s to "FullName"s. But you
are throwing all of the data for every $displayName into one big
%displayName hash. Try this instead:
$displayName{$displayName}{$uName} = $uFName;
> }
> }
> }
>
>
> foreach $displayName (keys %serverList)
> {
> foreach $uName (keys %{$displayName})
> {
> print "$displayName->{$uName}\n";
> }
And change this to:
foreach $uName (keys %{$displayName{$displayName}})
{
print "$displayName{$displayName}{$uName}\n";
}
> }
Or, to avoid quite so many hash lookups, use:
while ( ($displayName, $displayHashRef) = each %displayName )
{
while ( ($uName, $uFName) = each %$dispalyHashRef )
{
print "$uFName\n";
}
}
Of course, there should really be a bunch of "my"s sprinkled through
that, but that is another topic....
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 23 Aug 2000 13:30:56 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: newbie question - dont flame me
Message-Id: <m3snrv7rtr.fsf@dhcp11-177.support.tivoli.com>
Ren Maddox <ren.maddox@tivoli.com> writes:
> Or, to avoid quite so many hash lookups, use:
>
> while ( ($displayName, $displayHashRef) = each %displayName )
> {
> while ( ($uName, $uFName) = each %$dispalyHashRef )
> {
> print "$uFName\n";
> }
> }
Based on some other threads, this should probably just be:
foreach my $displayHashRef (values %displayName) {
foreach my $uFName (values %$displayHashRef) {
print "$uFName\n";
}
}
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 23 Aug 2000 21:46:17 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: newbie question about "uninitialized variables"
Message-Id: <967066419.20882@itz.pp.sci.fi>
In article <39a403ac.13574088@news.earthlink.net>, Jon S. wrote:
>On 23 Aug 2000 14:20:37 GMT, Ilmari Karonen <iltzu@sci.invalid> wrote:
>>The latest version of CGI::Carp (1.20) includes a patch I wrote that
>>adds this feature. See http://search.cpan.org/search?dist=CGI.pm
>
>Now let's see if my webhoster has that version installed. *sigh*
If not, you can always use your own copy.
First you should make a module directory, /home/username/perlmod or
anything else you may wish to call it. You could now install the
whole CGI distribution according to the standard procedure, giving
that directory as the install prefix. However, as CGI::Carp needs no
special installation, you could also just extract the file from the
archive and copy it to /home/username/perlmod/CGI/Carp.pm .
In your script, you'd simply write:
use lib '/home/username/perlmod';
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla | "By promoting postconditions to
and its pseudonyms - | preconditions, algorithms become
do not feed the troll. | remarkably simple." -- Abigail
------------------------------
Date: Wed, 23 Aug 2000 19:39:33 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: OT: Re: Programming Ethics
Message-Id: <slrn8q8aop.ke.tim@degree.ath.cx>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> I personally don't think at all that there is any ground for you to
> assume that I would want to hold a speech about anything, let alone
> philosophically about subjective matters. I am always objective.
With all due respect, there's no _point_ in talking philosophically
about objective matters. =) Anyway, you're probably right that I don't
have any ground to assume anything; but when did that ever stop a
long-winded egomanial like me? =)
> Wrong is any product that has a name
> starting with 'e-' or ending in 'portal'.
Agreed.
> Any sentence that has 'savvy'
> in it somewhere is also Wrong.
Unfamiliar with that phenomenon, but I can't say I'm fond of the word.
=)
> Most products originating in Redmond are
> wrong.
What's with this "Most" business? =)
> John Howard[1] is wrong. Brussels sprouts are borderlining on wrong.
I _was_ unaware of his position, being up north. But hey, you're
winter's almost over!
> Four wheel drive trucks in yuppie inner city suburbs are wrong.
Possibly, but my personal peeve is 4x4s sitting all of 5cm off the
ground.
> Now, if I only could remember why I was reading this group...
A lot of free time? Or is your killfile extraordinarily large? =)
--
-Tim Hammerquist <timmy@cpan.org>
I haven't failed, I've found 10,000 ways that don't work.
-- Thomas Edison
------------------------------
Date: 23 Aug 2000 09:49:08 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Perl and dates
Message-Id: <m3bsyk823f.fsf@dhcp11-177.support.tivoli.com>
zideon@my-deja.com writes:
> How can I get the week of the year with a Perl script. My webhost
> provider hasn't installed the CPAN DATE::CALC module.
perldoc -q week
Note that it does reference Date::Calc, but it also gives a specific
solution (see below) and several caveats.
int((localtime)[7]/7)+1
may give you what you want, but check the caveats.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 23 Aug 2000 20:36:35 GMT
From: zideon@my-deja.com
Subject: Re: Perl and dates
Message-Id: <8o1ckg$dvg$1@nnrp1.deja.com>
Hello Tony,
Thanx for your answer, but it didn't work! I've tried this solution
before (I read Perldoc POSIX), but it returns December 31, ($year-1).
In your example it's: December 31, 1999. I'm surprised :(
Do you have a clue?
Regards,
Zid from The Netherlands
>
> perldoc POSIX
>
> --> strftime
>
> use POSIX 'strftime';
> my $then = strftime('%B %d, %Y', 0, 0, 0, 0, 0, 100, 0, 123, 0);
> print "$then\n";
>
> == May 03, 2000
>
> is probably what you want.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 13:13:41 -0700
From: Salvador Peralta <admin@salvador.venice.ca.us>
Subject: Re: perl books
Message-Id: <39A43075.FCB382B2@salvador.venice.ca.us>
Congratulations on selecting a great programming language to learn.
There are thousands of tutorials on learning perl.
This is the one that got me started ( back in the day )
http://agora.leeds.ac.uk/Perl/start.html
...an oldie but a goodie, imho.
--
Salvador Peralta
admin@salvador.venice.ca.us
http://www.la-online.com
------------------------------
Date: Wed, 23 Aug 2000 12:00:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: perl hash code
Message-Id: <MPG.140dbf25b1dd247398accd@nntp.hpl.hp.com>
In article <39A406DC.8C5779A7@yale.edu> on Wed, 23 Aug 2000 13:16:12 -
0400, Guest <guest@yale.edu> says...
> I was wondering if someone could give me a basic outline in perl to do
> the following:
Because your problem is clearly stated and more instructive than most,
I've done much more than that.
> I have 2 files "A and B" whereby file B has the same information as
> file A just different values. File B has much less information than file
> A.
> All I want to do is run a script that compares file A and file B and if
> the lines in file B match what is file A then just replace those lines
> in File A with the values in File B leaving the unmatched lines in file
> A alone.
>
> Here would be an example of file A:
<Snipped; see below.>
> An example of file B:
<Snipped; see below; a non-matching item has been added.>
Start reading here:
perlfaq4: "How can I tell whether a list or array contains a certain
element?"
1. Make a hash from file A, where the keys are the unique strings that
you want to 'key' on, and the values are, well, the values.
2. For each line in file B, if there is an entry in the hash with the
same key, replace it with the new value.
3. Extract the data from the hash.
This loses the order of entries in file A. If that is important, there
are several approaches. The simplest is to add an index number to the
values in the hash.
It is easier to show some code than to talk about it. Here is a sketch
of the solution, which was actually fun to write. It fudges reading
file B and doesn't produce the exact output you want. But you should
have *something* to do, right?
#!/usr/bin/perl -w
use strict;
my @file_b = (
"assign (segid a and resid 11 and name H1')
(segid a and resid 11 and name H3') 2.0 0.3 0.4",
"assign (segid a and resid 12 and name H1')
(segid a and resid 12 and name H2') 6.2 0.5 0.5",
# This entry was added, doesn't match, and will be ignored.
"assign (segid x and resid 12 and name H1')
(segid a and resid 12 and name H2') 6.2 0.5 0.5",
);
# The following regex matches assuming exact formatting of the
# stuff between the parentheses in each of the data files. It
# could be made much more flexible with a little work.
my $regex = qr/\(([^)]+)\)\s+\(([^)]+)\)\s+(.*)/;
my %file_a;
while (<DATA>) {
$_ .= <DATA>; # Join two lines.
/$regex/ and $file_a{$1.$2} = [$., $3];
}
/$regex/ and $file_a{$1.$2} and $file_a{$1.$2}[1] = $3 for @file_b;
print map "$_ $file_a{$_}[1]\n" =>
sort { $file_a{$a}[0] <=> $file_a{$b}[0] } keys %file_a;
__END__
assign (segid a and resid 11 and name H1')
(segid a and resid 11 and name H3') 3.7 0.3 0.3
assign (segid a and resid 11 and name H1')
(segid a and resid 12 and name H8) 3.8 0.8 0.8
assign (segid a and resid 11 and name H4')
(segid a and resid 11 and name H5) 2.7 0.1 0.1
assign (segid a and resid 12 and name H1')
(segid a and resid 12 and name H2') 1.9 0.1 0.1
Output (wrapped by hand):
segid a and resid 11 and name H1'segid a and resid 11 and name H3'
2.0 0.3 0.4
segid a and resid 11 and name H1'segid a and resid 12 and name H8
3.8 0.8 0.8
segid a and resid 11 and name H4'segid a and resid 11 and name H5
2.7 0.1 0.1
segid a and resid 12 and name H1'segid a and resid 12 and name H2'
6.2 0.5 0.5
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 23 Aug 2000 19:02:09 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: perl hash code
Message-Id: <8o1732$6ki$1@nnrp1.deja.com>
In article <39A406DC.8C5779A7@yale.edu>,
Guest <guest@yale.edu> wrote:
> I was wondering if someone could give me a basic outline in perl to do
> the
> following:
>
> I have 2 files "A and B" whereby file B has the same information as
> file A just different values. File B has much less information than
file
> A.
> All I want to do is run a script that compares file A and file B and
if
> the lines in file B match what is file A then just replace those lines
> in File A with the values in File B leaving the unmatched lines in
file
> A
> alone.
<snipped the example data>
So, are you looking for a line-by-line comparison, or just use "assign"
as a delimiter?
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 16:58:03 -0400
From: "KN" <khayyam.noon@unisys.com>
Subject: Perl vs. other scripting languages
Message-Id: <8o1dql$8d7$1@trsvr.tr.unisys.com>
What are the pros and cons of using Perl versus other scripting languages?
Can anyone help and direct me to where I can find this information.
------------------------------
Date: 23 Aug 2000 17:49:20 -0400
From: Jordan Katz <katz@underlevel.net>
Subject: Re: Perl vs. other scripting languages
Message-Id: <m37l97ir6n.fsf@underlevel.underlevel.net>
"KN" <khayyam.noon@unisys.com> writes:
> What are the pros and cons of using Perl versus other scripting languages?
>
> Can anyone help and direct me to where I can find this information.
Two good essays on this subject:
1. Scripting: Higher Level Programming for the 21st Century
<http://www.scriptics.com/people/john.ousterhout/scripting.html>
2. Comparing Python to Other Languages
<http://www.python.org/doc/essays/comparisons.html>
Although the second is Python-centric it contains some useful information.
--
Jordan Katz <katz@underlevel.net>
------------------------------
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 4109
**************************************