[18480] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 648 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 7 14:06:02 2001

Date: Sat, 7 Apr 2001 11:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986666713-v10-i648@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 7 Apr 2001     Volume: 10 Number: 648

Today's topics:
        ? The best Perl book ? <lists@brokerpal.com>
    Re: ? The best Perl book ? <paulus86@ascat.de>
    Re: ? The best Perl book ? <paulus86@ascat.de>
    Re: ? The best Perl book ? (Tad McClellan)
    Re: ? The best Perl book ? <paulus86@ascat.de>
        [ANNOUNCE] Crypt::RSA 1.33 (Vipul Ved Prakash)
        [OT] Re: password encryption (Steven Smolinski)
    Re: complaint about moderation of this group (Tad McClellan)
    Re: complaint about moderation of this group (Tad McClellan)
    Re: cookie woes. <juex@my-deja.com>
    Re: cookie woes. <juex@my-deja.com>
    Re: FAQ 8.5:   How do I read just one key without waiti <perl_news@tranzoa.com>
    Re: managing open file descriptors w/ cacheout <abe@ztreet.demon.nl>
    Re: Net::Telnet <abe@ztreet.demon.nl>
    Re: password encryption (Abigail)
    Re: perl 5.6 and apache <rick.delaney@home.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 7 Apr 2001 19:19:49 +0200
From: "Dejan Bizinger" <lists@brokerpal.com>
Subject: ? The best Perl book ?
Message-Id: <9an5a5$j8v$1@news.EUnet.yu>

I would like to start learning Perl so I would like you to recommend me some
good book.  I want to buy a book that starts explaining basics thru advanced
programming. I have several picks like:
Programming Perl - Larry Wall
Learning Perl - Larry Wall
Perl - The Complete Reference - McGraw-Hill
Thanks in advance.
Regards,
                Dejan
                Editor of BrokerPal Newsletter - free list of expired domain
names, domain texts, news, auctions
                Subscribe: mailto:bizi-subscribe@listbot.com




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

Date: Sat, 7 Apr 2001 16:35:22 +0200
From: "Florian Paulus" <paulus86@ascat.de>
Subject: Re: ? The best Perl book ?
Message-Id: <9an8ka$64ml0$1@ID-62217.news.dfncis.de>

start with learning perl if you are new to programming in general. if you
are familiar with e.g. C then start with programming perl

"Dejan Bizinger" <lists@brokerpal.com> schrieb im Newsbeitrag
news:9an5a5$j8v$1@news.EUnet.yu...
> I would like to start learning Perl so I would like you to recommend me
some
> good book.  I want to buy a book that starts explaining basics thru
advanced
> programming. I have several picks like:
> Programming Perl - Larry Wall
> Learning Perl - Larry Wall
> Perl - The Complete Reference - McGraw-Hill
> Thanks in advance.
> Regards,
>                 Dejan
>                 Editor of BrokerPal Newsletter - free list of expired
domain
> names, domain texts, news, auctions
>                 Subscribe: mailto:bizi-subscribe@listbot.com
>
>




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

Date: Sat, 7 Apr 2001 16:36:30 +0200
From: "Florian Paulus" <paulus86@ascat.de>
Subject: Re: ? The best Perl book ?
Message-Id: <9an8me$629vd$1@ID-62217.news.dfncis.de>

ok its Perl not perl i'm sorry my finger was too lazy to hit shift ;-)
"Florian Paulus" <paulus86@ascat.de> schrieb im Newsbeitrag
news:9an8ka$64ml0$1@ID-62217.news.dfncis.de...
> start with learning perl if you are new to programming in general. if you
> are familiar with e.g. C then start with programming perl
>
> "Dejan Bizinger" <lists@brokerpal.com> schrieb im Newsbeitrag
> news:9an5a5$j8v$1@news.EUnet.yu...
> > I would like to start learning Perl so I would like you to recommend me
> some
> > good book.  I want to buy a book that starts explaining basics thru
> advanced
> > programming. I have several picks like:
> > Programming Perl - Larry Wall
> > Learning Perl - Larry Wall
> > Perl - The Complete Reference - McGraw-Hill
> > Thanks in advance.
> > Regards,
> >                 Dejan
> >                 Editor of BrokerPal Newsletter - free list of expired
> domain
> > names, domain texts, news, auctions
> >                 Subscribe: mailto:bizi-subscribe@listbot.com
> >
> >
>
>




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

Date: Sat, 7 Apr 2001 10:33:40 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: ? The best Perl book ?
Message-Id: <slrn9cu9a4.ogq.tadmc@tadmc26.august.net>

Florian Paulus <paulus86@ascat.de> wrote:

>start with learning perl if you are new to programming in general. 


"Learning Perl" assumes that you are *already* "a programmer".

It is not meant for non-programmers at all.


[snip Jeopardy-quoted text]

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 7 Apr 2001 19:28:24 +0200
From: "Florian Paulus" <paulus86@ascat.de>
Subject: Re: ? The best Perl book ?
Message-Id: <9anioo$5vnmk$1@ID-62217.news.dfncis.de>

well that is in fact true but i think things are explained low enough to
understand it. arrays e.g. are explained from bottom up. but i admit a bit
of knowledge is demanded.
anyway i think it is the best book to start with Perl and i'm sure you will
get into it with that book also if you haven't programmed anything before.
"Tad McClellan" <tadmc@augustmail.com> schrieb im Newsbeitrag
news:slrn9cu9a4.ogq.tadmc@tadmc26.august.net...
> Florian Paulus <paulus86@ascat.de> wrote:
>
> >start with learning perl if you are new to programming in general.
>
>
> "Learning Perl" assumes that you are *already* "a programmer".
>
> It is not meant for non-programmers at all.
>
>
> [snip Jeopardy-quoted text]
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Sat, 7 Apr 2001 04:14:42 +0000 (UTC)
From: vipul@shell2.ba.best.com (Vipul Ved Prakash)
Subject: [ANNOUNCE] Crypt::RSA 1.33
Message-Id: <tcu5em1i9q0u3a@corp.supernews.com>

Hi,

I have uploaded version 1.33 of Crypt::RSA to CPAN. Changes in this
version include:

 * Wrote ::SS:PKCS1v15 (that implements PKCS #1 v1.5 signatures) and a test
   for it (t/14-es-pkcs1v15.t)

 * Renamed ::ES::PKCS1_v1_5 to ::ES::PKCS1v15. The underscores were
   driving me nuts

 * Wrote ::DataFormat::h2osp() - Hex to Octet String Primitive, that
   converts hex strings/numbers of arbitrary length into octet strings

 * Couple of small changes to ::Debug::debug()

best,
vipul.

MODULE INFOMRATION:

NAME

    Crypt::RSA - RSA public-key cryptosystem.

VERSION

    $Revision: 1.33 $ (Beta)

DESCRIPTION

   Crypt::RSA is a pure-perl, cleanroom implementation of the RSA
   public-key cryptosystem, written atop the blazingly fast number theory
   library PARI. As far as possible, Crypt::RSA conforms with PKCS #1,
   RSA Cryptography Specifications v2.1[13].

   Crypt::RSA is structured as a bundle of modules that provide
   arbitrary length key pair generation, plaintext-aware encryption
   (OAEP) and digital signatures with appendix (PSS). Crypt::RSA
   provides a convenient, scheme-independent interface to the other
   modules in the bundle.

AUTHOR

   Vipul Ved Prakash


LICENSE

   Copyright (c) 2000-2001, Vipul Ved Prakash. All rights reserved. This
   code is free software; you can redistribute it and/or modify it under
   the same terms as Perl itself.

MAILING LIST

   pac@lists.vipul.net is a mailing list for discussing development of
   asymmetric cryptography modules in perl. Please send Crypt::RSA
   related communications directly to the list address. Subscription
   interface for pac is at http://lists.vipul.net/mailman/listinfo/pac/

-- 

Vipul Ved Prakash, http://www.vipul.net/
PGP Fingerprint d5f78d9fc694a45a00ae086062498922 




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

Date: Sat, 07 Apr 2001 17:38:43 GMT
From: sjs@linux.ca (Steven Smolinski)
Subject: [OT] Re: password encryption
Message-Id: <slrn9cup4f.jf.sjs@ragnar.stevens.gulch>

[
    First of all, DO NOT STEALTH CC ME AGAIN!
    Yes, I meant to shout that.
]

Simon Stiefel <SiStie@nuclear-network.com> wrote:
> On Fri, 6 Apr 2001, Steven Smolinski wrote:
> 
> > Simon Stiefel <SiStie@nuclear-network.com> wrote:
> > > I have to transmit a password with the "get"-function to my CGI-Script (so
> > > it can be seen by everyone).
> > >
> > > What is the easiest way to encrypt and decrypt the password?
> >
> > In security, "easy" is negatively correlated with "secure."  The easiest
> > way is to rot13 the password at the client, and rot13 it again at the
> > server.  This also provides no security.
> 
> Yes, but I just want someone not to see the password (in plaintext) in the
> URL.

Who's the someone?  If you don't want the user to see it in plaintext
then your requirement isn't security, it's window-dressing.  The user
already knows the plaintext, so who cares if they see it?

And you could do this the same way in C or Java.  It's independent of
language, so not topical here.  Try a web security group.

> This:
> http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=1&admcode=hello
> should look like this:
> http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=1&admcode=x9dj40gklfjm0
> 
> But I don't know how to realize that in perl ;-).

Well, it looks like you want it 'sent' to the cgi program like this,
which means it's coming from the browser.  IOW, you're relying on
something client-side to encrypt it then, which isn't Perl.  So again,
it's offtopic for this newsgroup.

[...] 
> afaik SSL wouldn't solve the problem, because the password still can be
> seen in the URL.

\begin{offtopic}

This is the second time I've read this on this newsgroup.  The other
poster suggested that a GET request was not encrypted while a POST is.
This makes absolutely no sense to me.  I've been under the impression
that the secure sockets layer actually established a tunnel through
which the traffic was encrypted.

Part of the traffic is the request to the webserver.  Be it GET or a
small POST, the request can all fit into a single IP packet on decent
connections, so why would a GET not be enrypted while a POST is?  If
this is true I have to look more closely at the SSL standard.

In either case, it's why you should ask in a proper newsgroup; otherwise
you may get morons like myself spouting off crap they can't support.

\end{offtopic}

Steve
-- 
Steven Smolinski => http://www.steven.cx/


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

Date: Sat, 07 Apr 2001 15:18:59 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: complaint about moderation of this group
Message-Id: <slrn9cu0av.oc1.tadmc@tadmc26.august.net>

Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could Uri Guttman <uri@sysarch.com>
>say such a terrible thing:
>
>>BZZZZT! wrong. please try again. if i use perl to write a recipe
>>program, am i allowed to ask about how to saute here? if anything
>>possibly done with perl is on topic, then tell me what is off topic?
>>perl can be used to program anything.
>
>Hah! I'd like to see you write a Perl program to cut down a Redwood with
>a bana...Whoops, wrong thread.


   1 while 1;   # wait for the tree to rot and fall over


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 07 Apr 2001 15:19:01 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: complaint about moderation of this group
Message-Id: <slrn9cu7mo.oc1.tadmc@tadmc26.august.net>


[ emailed and posted ]


Kyle Dusang <hhsoft@csoft.net> wrote:

>Subject: complaint about moderation of this group


This newsgroup is not moderated. Did you mean to post this
to some other newsgroup?


>To whom it may concern: I was under the (perhaps mistaken) impression
>that usenet was a forum in which to exchange information and for
>novices to be able to ask questions and for those more experienced or
>knowledgable to answer said questions if they so desire. 


You are correct.

It is also subdivided into "topics" so that folks know where to look
when they are seeking an answer.

Nobody is likely to look for the answer to a WWW question in a Perl
newsgroup. They would look in a WWW newsgroup (where all the folks
who know about WWW stuff hang out).


>I was also
>under the impression that Perl was a programming language that was
>used to create web applications. 


Yes it is.

It is also used for many other things (it must be used for other
things, as it was created years before the WWW was created, and
it survived).

I have written Perl pretty much daily for six years. I have never
written a CGI program. 

Perl is a general-purpose programming language. You can use it
in just about any problem domain. CGI programming is one domain
where folks often choose to use Perl, but they could also choose
to use just about any other language for their CGI programs.


>Sorry if this isn't as eloquently
>stated as I'd like it to be....but every time 
                                    ^^^^^^^^^^

I can only find one time. Have you used other addresses in the past?

But I suppose "the one time I posted" _is_ "every time I have posted"
in your case...


>I ask a question in this
>group, one which concerns a PERL script I am working on...
                             ^^^^
                             ^^^^ nobody spells it that way


The one post of yours that I can find (Subject: cookie woes) did
not contain a question relevant to Perl.

If you had chosen to use Visual Basic instead of Perl for your
CGI programs, then the answer would have been the *same*.

If the answer is the same regardless of the programming language
used, then the question is not about programming languages.


You needed to output the correct string to effect the solution
to your problem.

The answer to the Perl part of your question (how to make output) is:

   You use Perl's print() function to make output.

(but you already knew that).

What you really needed to know was "what _is_ the correct string"
to output. The answer to that part of your question will be the
same regardless of the programming language you are using.


>some anal
>retentive 


You commit yet another Usenet social faux pas. "ad hominem" responses
(attacking the person rather than the person's ideas) are ineffective 
in making your point.

That technique actually hurts your position in convincing people
to come around to your views. It is counter-productive.

It is much more effective to provide at least one argumenat (reason)
_why_ their idea is not correct.


>moderator 


There are no moderators here.  Did you mean to post this to some 
other newsgroup?


>tells me its off topic 


Don't get miffed about that. It _was_ off-topic!

That response was actually very helpful, but you seemed to have
missed the help that it contained. Let me try rephrasing it:


   Only "some" of the people here in clp.misc have experience
   with WWW cookies. Nearly everyone in the ciwa.cgi newsgroup
   have used cookies. You have a much better chance of getting
   the answer to your question if you ask it over there.


>and that it doesn't deal
>specifically with PERL....(but it DOES dangit!) 


You use Perl's print() function to make output, but you already
knew that. That is the extent of the Perl content in your question.


>and probably kill
>filters me or something...(whatever the heck that means)


It means that the person doing the killing will not see any of
your postings in the future.


>...preventing
>anyone else who IS interested in helping from being able to offer
>help. 


It does not prevent anyone else who is interested in helping from
being able to offer help.

Critiquing something when you don't even know what it is or how
it works is presumptuous in the extreme.


>Lighten up a little....GEEZ.....


Take cuts in line, then turn around and say that to everyone
behind you. That worked pretty good, huh?

Usenet is its own little society, with rules different from
"real world" society. You appear to not know what the rules of
Usenet society are. You should find out if you plan to enter
this other society.

You have walked into a society that you know nothing about, and
started shouting that everybody else should start doing things
Your Way. That is not very likely to be met with warmth.


---------------------------------------------------------
In article <1995Nov9.193745.13694@netlabs.com>, lwall@netlabs.com (Larry
Wall) wrote: ...

<Larry>  [snip]  I view a programming language as a place to be
<Larry>  explored, like Disneyland. You don't need to have a lot of preparation
<Larry>  to explore a theme park.  You do have to go along with the crowd
<Larry>  control measures, though.  In a sense, each ride has its own
<Larry>  prerequisites--if you cut in line, you risk getting tossed out of the
<Larry>  park.
<Larry> 
<Larry>  What we have here in this newsgroup is a failure in crowd control.
<Larry>  Reading the FAQ is like staying in line--it's something you should
<Larry>  learn in kindergarten.  Usenet needs a better kindergarten.
---------------------------------------------------------


>i'm not posting spam or ads for
>porno sites or anything. 


That's nice.


>By the way...this group is perl.misc, right?


Correct yet again!


>That means even if the question does concern another technology which
>is referenced from a perl script...it should be allowed...


Mistaken again!

If it is about computers (comp.)

   AND

it is about languages (lang.)

   AND

it is about Perl (perl.)

   AND

it is not appropriate in any or the other comp.lang.perl.* newsgroups

   THEN

it should be allowed in comp.lang.perl.misc


>and i'm sure
>twenty or more people knew the answer to my question and could have
>lended a hand if they chose to. 


No, as you now know, all 20 of them (if they exist) did indeed see
your question, and (it appears) decided not to respond for whatever
reason.

Yet another reason to ask in a newsgroup where people care about
the things relevant to your question...


>I'm not trying to "look a gift horse
>in the mouth" but gee wiz...


Yes you are. You just asked in the wrong place. The mistake was
your's, not our's. You would likely have gotten an answer had
you posted to ciwa.cgi, where issues such as yours are discussed.

You do not know the dynamics of this newsgroup. Lurk (read some
of the posts here more or less daily) here for a bit so that you
will know what you are talking about.

You just got here, you cannot possibly know why things are the
way they are.


>I will not ask any questions in this group
>anymore...


Your loss. Dozen's of people get expert Perl consulting for free
here each day. Even more get poor Perl consulting here, but oh well.


>i found the answer to my question on the web....


How long did that take you? A few minutes perhaps?

How long did posting to (the wrong newsgroup on) Usenet take to 
get the answer? (looks like "forever" 'cause I don't see any answer).

Perhaps you should be trying to find the answer yourself for a few
minutes *before* resorting to Usenet. Seems a more efficient method
of getting past the problem quickly.


>where i will
>go from now on...


Now you are working smart. Getting the answer in the least amount
of time is a Good Thing. You should have been trying other resources
first anyway.


>so don't bother reply to this 


Oops!


>(except via email if u
>want) 


OK. Although my reply is NOT directed to you, but to the other reader's
of the newsgroup.


>because i will not point my reader to this group any more...


That is fine with us. We have no interest in increasing the readership
of the newsgroup. There seems to be plenty of folks here already...


>you
>(the moderators) 


You are addressing an empty audience. There are no moderators here.
Did you mean to post this to some other newsgroup?


>are not cool. 


Would you care to provide even one reason why off-topic postings
should be allowed?

Why divide Usenet into "topics" at all if they are to be disregarded?

Why not just have one newsgroup with all the tens of thousands of
daily Usenet posts in it then?


>Good bye.


Thank you for doing your part to make this a better newsgroup.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 7 Apr 2001 07:51:20 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: cookie woes.
Message-Id: <3acf296b@news.microsoft.com>

[jeopardectomy performed]
"Kyle Dusang" <hhsoft@csoft.net> wrote in message
news:cqgsctg93j1rqlde2ks2v4bdect88s87l4@4ax.com...
> On Fri, 6 Apr 2001 20:24:51 +0000 (UTC), abigail@foad.org (Abigail)
> wrote:
> >Kyle Dusang (hhsoft@csoft.net) wrote on MMDCCLXXV September MCMXCIII in
> ><URL:news:319qctkt92tvrqano5lriemtiv039jiebu@4ax.com>:
> >$$ Any reason why the following would not set a cookie in netscape 4.7
> >$$ which lasts longer than a browser session? (it does in I.E. 5)
> >$$
> >$$ print "Set-Cookie: rpassword=${password}; expires=Thu, 01-Jan-2099
> >$$ 00:00:00 GMT;\n";
>
> >What makes you think this is a Perl question?
>
> Ummmm...maybe because it's a line from a PERL SCRIPT

Does the "print" work? Does it print the desired text to STDOUT? If yes,
then the Perl part obviously works.
What would have been if you would have written this piece of code in let's
say C, Lisp, Cobol, or Haskell? Wouldn't you have printed the same line/the
same text? And wouldn't you have exactly the same problem? Bingo!
Now think again: is this a Perl, a C, a Lisp, a Cobol, or a Haskell problem?
Obviously it cannot be all five at the same time, so maybe it is neither of
them.

You are looking for a solution in the wrong place. If the Perl part works
already (and obviously it does) then what kind of help do you expect from
Perl people? Even the combined Perl expertise of all Perl gurus in the world
won't solve your problem.

You are asking "I can't get my groceries with my car" in a automobile
newsgroup but actually you are expecting advice on how to build a road
between your house and the grocery store. That's not gone work, dude ;-)

Ask the people who know how to build roads.
In your case you can find them in the browser NGs, and maybe to some degree
in the webauthoring and CGI NGs. But certainly not in the Perl NGs.

jue




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

Date: Sat, 7 Apr 2001 07:53:34 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: cookie woes.
Message-Id: <3acf29ef@news.microsoft.com>

[jeopardectomy performed]
[cc'ed to author]
"Kyle Dusang" <hhsoft@csoft.net> wrote in message
news:cqgsctg93j1rqlde2ks2v4bdect88s87l4@4ax.com...
> On Fri, 6 Apr 2001 20:24:51 +0000 (UTC), abigail@foad.org (Abigail)
> wrote:
> >Kyle Dusang (hhsoft@csoft.net) wrote on MMDCCLXXV September MCMXCIII in
> ><URL:news:319qctkt92tvrqano5lriemtiv039jiebu@4ax.com>:
> >$$ Any reason why the following would not set a cookie in netscape 4.7
> >$$ which lasts longer than a browser session? (it does in I.E. 5)
> >$$
> >$$ print "Set-Cookie: rpassword=${password}; expires=Thu, 01-Jan-2099
> >$$ 00:00:00 GMT;\n";
>
> >What makes you think this is a Perl question?
>
> Ummmm...maybe because it's a line from a PERL SCRIPT

Does the "print" work? Does it print the desired text to STDOUT? If yes,
then the Perl part obviously works.
What would have been if you would have written this piece of code in let's
say C, Lisp, Cobol, or Haskell? Wouldn't you have printed the same line/the
same text? And wouldn't you have exactly the same problem? Bingo!
Now think again: is this a Perl, a C, a Lisp, a Cobol, or a Haskell problem?
Obviously it cannot be all five at the same time, so maybe it is neither of
them.

You are looking for a solution in the wrong place. If the Perl part works
already (and obviously it does) then what kind of help do you expect from
Perl people? Even the combined Perl expertise of all Perl gurus in the world
won't solve your problem.

You are asking "I can't get my groceries with my car" in a automobile
newsgroup but actually you are expecting advice on how to build a road
between your house and the grocery store. That's not gone work, dude ;-)

Ask the people who know how to build roads.
In your case you can find them in the browser NGs, and maybe to some degree
in the webauthoring and CGI NGs. But certainly not in the Perl NGs.

jue




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

Date: Sat, 07 Apr 2001 11:00:52 -0700
From: Alex Robinson <perl_news@tranzoa.com>
Subject: Re: FAQ 8.5:   How do I read just one key without waiting for a return key?
Message-Id: <3ACF55D4.4C50@tranzoa.com>

Hmmm. This is a problem running Active State Perl under Windows.

I cobbled together a kludge yesterday to read a single keystroke under
both Windows and Linux.

It's trash, for sure. :) And if anyone knows how to get rid of the
warning that gets printed under Windows, please let me know!


Here it is:


package CheapIIKB;

# CheapIIKB.pm
#       April 7, 2001           bar
#
#       Save some duplictated code by putting keyboard-hit logic for II
provider Perl scripts into one module.
#
#


require 5.002;
use     strict;

use vars       qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

$VERSION     = 1.00;

@ISA         = qw(Exporter);

#
#   This way the using program need not put NextTime:: in front of
stand-alone subroutine names.
#
@EXPORT = qw(
                ii_check_keyboard
            );




# use IIProvider;


my  $win32_keybrd;


# print "OS name: ".$^O."\n";         # 'linux' / 'MSWin32'

BEGIN
{
  my $mod = "Term::ReadKey"; #   $^O is $OSNAME
     $mod = "Win32::Console" if ($^O =~ m/Win/o);

  if ($mod eq "Win32::Console") {
      die "Could not 'use' $mod!\n" if (eval "use $mod");

      #
      # I've found no way to get around the warning/bitch about
not-numeric - The code works, though.
      #
      #
      $win32_keybrd =
Win32::Console->new(Win32::Console->STD_INPUT_HANDLE);

      sub Win32ReadKey
          {
              return(undef) if (!$win32_keybrd->GetEvents);

              my @event;

              @event = $win32_keybrd->Input();
              return(undef) if (($event[0] != 1) || !$event[1] ||
!$event[5]);

              return(chr($event[5]));
          }
      }
    else {
      die "Could not 'use' $mod!\n" if (eval("use $mod"));
      }
}




#
#
#   Check the keyboard for operator input and sleep the CPU for a brief
moment, if appropriate.
#
#   Takes:
#
#       $program_name   String concatenated to the end of $PROGRAM_NAME"
#                         for printout to the operator in case we tell
him who we are, etc.
#       $iip            The II provider object that should be pinged
through.
#       $do_delay       1 if it's ok to sleep the CPU
#
#   Returns:
#       -1              Keep going.
#       otherwise       Exit program with return value
#
#
sub ii_check_keyboard
{
  my $program_name = shift;
  my $iip          = shift;
  my $do_delay     = shift;


  #
  #
  #     Check for some user interaction - a key from him
  #
  #
  for (;;) {
    my $key;

    if (defined($win32_keybrd)) {
        $key = Win32ReadKey();
        }
      else {
        ReadMode('cbreak');
        $key = ReadKey(-1);
        ReadMode('normal');
        }

    last if (!defined($key));

    print "\n";

    if ($key =~ m/^[qQ]/o) {
      print "Quitting...\n";
      return(0);                                        # exit the
program normally
      }

    if ($key =~ m/^[rR]/o) {
      print "Restart exit...\n";
      return(188);                                    # tell any script
we run under to re-start; don't exit
      }

    $do_delay = 0;

    if (defined($iip) && ($key =~ m/^[pP]/o)) {
        print "Pinging...";
        { local $| = 1 }                            # $| is
$OUTPUT_AUTOFLUSH

        if (1) {                                    # don't require the
II stuff         $iip->send_amp_ping()) {
            print "OK\n";
            }
          else {
            print "not sent!\n";
            }
        }
    elsif ($key eq "?") {
        print "Q    Quit program.\n".
              "R    Restart program (if running script allows.\n".
              "P    Send AMP Ping to IIServer if on-line.\n".
              "\n".
              "Otherwise, I tell you who I am and when I started,\n".
              "";
        }
    else {
        #      $0 is $PROGRAM_NAME                           $^T is
$BASETIME - when the script started running
        print "$0$program_name : Running since " . localtime($^T) .
"\n";
        }
    }


  select(undef, undef, undef, .1) if ($do_delay);

  return(-1);
}


#
#
#       Test code.
#       Run the .pm module to run this, but don't use MSDOS short file
name on the command line!
#
#
if (defined($0) && (lc($0) eq lc(__PACKAGE__.".pm"))) {
  my $exit_value;

  print "Testing CheapIIKB\n";
  for (;;) {
    $exit_value = ii_check_keyboard(" testing", undef, 1);
    last if ($exit_value != -1);
    }

  exit($exit_value);
  }



1;

#
#
#
# eof


Alex Robinson


PerlFAQ Server wrote:
> 
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
> 
> +
>   How do I read just one key without waiting for a return key?
> 
>     Controlling input buffering is a remarkably system-dependent matter. On
>     many systems, you can just use the stty command as shown in the getc
>     entry in the perlfunc manpage, but as you see, that's already getting
>     you into portability snags.
> 
>         open(TTY, "+</dev/tty") or die "no tty: $!";
>         system "stty  cbreak </dev/tty >/dev/tty 2>&1";
>         $key = getc(TTY);           # perhaps this works
>         # OR ELSE
>         sysread(TTY, $key, 1);      # probably this does
>         system "stty -cbreak </dev/tty >/dev/tty 2>&1";
> 
>     The Term::ReadKey module from CPAN offers an easy-to-use interface that
>     should be more efficient than shelling out to stty for each key. It even
>     includes limited support for Windows.
> 
>         use Term::ReadKey;
>         ReadMode('cbreak');
>         $key = ReadKey(0);
>         ReadMode('normal');
> 
>     However, that requires that you have a working C compiler and can use it
>     to build and install a CPAN module. Here's a solution using the standard
>     POSIX module, which is already on your systems (assuming your system
>     supports POSIX).
> 
>         use HotKey;
>         $key = readkey();
> 
>     And here's the HotKey module, which hides the somewhat mystifying calls
>     to manipulate the POSIX termios structures.
> 
>         # HotKey.pm
>         package HotKey;
> 
>         @ISA = qw(Exporter);
>         @EXPORT = qw(cbreak cooked readkey);
> 
>         use strict;
>         use POSIX qw(:termios_h);
>         my ($term, $oterm, $echo, $noecho, $fd_stdin);
> 
>         $fd_stdin = fileno(STDIN);
>         $term     = POSIX::Termios->new();
>         $term->getattr($fd_stdin);
>         $oterm     = $term->getlflag();
> 
>         $echo     = ECHO | ECHOK | ICANON;
>         $noecho   = $oterm & ~$echo;
> 
>         sub cbreak {
>             $term->setlflag($noecho);  # ok, so i don't want echo either
>             $term->setcc(VTIME, 1);
>             $term->setattr($fd_stdin, TCSANOW);
>         }
> 
>         sub cooked {
>             $term->setlflag($oterm);
>             $term->setcc(VTIME, 0);
>             $term->setattr($fd_stdin, TCSANOW);
>         }
> 
>         sub readkey {
>             my $key = '';
>             cbreak();
>             sysread(STDIN, $key, 1);
>             cooked();
>             return $key;
>         }
> 
>         END { cooked() }
> 
>         1;
> 
> -
> 
> Documents such as this have been called "Answers to Frequently
> Asked Questions" or FAQ for short.  They represent an important
> part of the Usenet tradition.  They serve to reduce the volume of
> redundant traffic on a news group by providing quality answers to
> questions that keep comming up.  If you are some how irritated by
> seeing these postings you are free to ignore them or add the sender
> to your killfile.  If you find errors or other problems with these
> postings please send corrections or comments to the posting email
> address.
> 
> If you are not able to find this or other Perl documentation from
> your installation you may access it via the web by following the
> appropriate links from one of the addresses listed below.
> 
>     http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search
>     http://www.perldoc.com
>     http://www.cpan.org
>     http://www.perl.com
> 
> Answers to questions about LOTS of other stuff, mostly not related to
> Perl, can be found at
> 
>     news:news.answers
> 
> and in the many thousands of other useful Usenet news groups.
> 
> Please note that the FAQ text posted by this server has been modified
> from that distributed in the stable Perl release.  It has been
> edited to reflect the additions, changes and corrections provided
> by respondents, reviewers, and critics to previous postings of
> these FAQ. Complete text of these FAQ is available on request.
> 
> The perlfaq manual pages contain the following copyright notice.
> 
>   AUTHOR AND COPYRIGHT
> 
>     Copyright (c) 1997-1999 Tom Christiansen and Nathan
>     Torkington.  All rights reserved.
> 
>     When included as an integrated part of the Standard
>     Distribution of Perl or of its documentation (printed or
>     otherwise), this work is covered under Perl's Artistic
>     License.  For separate distributions of all or part of
>     this FAQ outside of that, see the perlfaq manpage.
> 
>     Irrespective of its distribution, all code examples here
>     are public domain.  You are permitted and encouraged to
>     use this code and any derivatives thereof in your own
>     programs for fun or for profit as you see fit.  A simple
>     comment in the code giving credit to the FAQ would be
>     courteous but is not required.
> 
> This work is provided in the hope that it will be useful but does
> not represent a commitment of any kind on the part of the contributers,
> authors or their agents.
> --
>     This space intentionally left blank


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

Date: Sat, 07 Apr 2001 18:31:26 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: managing open file descriptors w/ cacheout
Message-Id: <27cuct44q4hpedhjn0n7u11ohkae4huov5@4ax.com>

On Wed, 4 Apr 2001 13:00:01 -0700, "B McDonald" <plz@righthere.com>
wrote:

> 
> Hi. I am unsuccessfully trying to use FileCache's cacheout function in order
> to manage writing/appending to 12 simultaneously open files on my
> Win98/ActivePerl 5.6.0.613 system. I'm not sure what I'm doing wrong -- and
> unfortunately, upon conducting a search on FileCache and cacheout at
> deja-googoo, I could not find any posts on the subject (either that's
> strange... or I am strange...)

1. The BUGS section in the docs (if you may call it that) applies to
Windows.

2. You seem to misunderstand the way FileCache works.

I wrote this test script to find out how it works. It's _not_ a good
example of a case in which you _need_ all the files to be writable
simultaneously. 

#!/usr/bin/perl
use strict;
use warnings;

use FileCache;

# make FileCache believe it can only have 3 open files
$FileCache::cacheout_maxopen = 3;

my @files = map "testfiles/$_" 
	=>qw( file1.fc file2.fc file3.fc file4.fc );

# write to all files ...
for my $file ( @files ) {
	cacheout $file;    # this opens the file
	local *FH = $file; # is there a better way?
	print FH "Write first line to $file\n";
	print FH "Write second line to $file\n";
}

# close the files (why is it not exportable?)
FileCache::cacheout_close( $_ ) for @files;

# now read them back (1 by 1)
for my $file ( @files ) {
	open my $fh, $file or die "Can't open '$file': $!";
	print "\nReading from: $file\n";
	print while <$fh>;
	close $fh;
}

__END__

IIRC, Win9x still uses the 'FILES=' entry in CONFIG.SYS, I think it's
better to look into that. I can't remember what de default value is, but
it's less than 20 (4 default + 16 from FileCache).

-- 
Good luck,
Abe
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona
 tsuJ")'


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

Date: Sat, 07 Apr 2001 19:04:36 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Net::Telnet
Message-Id: <n0huctkk8235pde9ccop8g449hpbicefuj@4ax.com>

On Wed, 04 Apr 2001 16:56:08 -0400, a246456 <a246456@fmr.com> wrote:

> Hi,
>      This script process a list of servers from a file(host.txt), if it
> fails to connect or invalid password then it should write it to output
> handler(file). For some reasons i am not able to get this result.

 ...
 
>     if($t->open($_)) #connecting to host
>      {
> 
>        if($t->login(Name => $username, Password => $passwd)) #Login
> authentication
>  {

 ...

>    }
>         elsif{
          ^^^^^^
elsif What?

>  print TELFAIL "Unable to connect $_\n";  #failed to telnet
>  }
>      else{
>  print TELFAIL "Invalid Username/Password for $_\n";  #Invalid
> userid/password.
>  }

Your logic isn't right. I think this is what you want:

	if ( $t->open( ... ) ) {
		if ( $t->login( ... ) ) {
			# do stuff
		} else {
			# login failure
		}
	} else {
		# connection failure
	}

-- 
Good luck,
Abe
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona
 tsuJ")'


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

Date: Sat, 7 Apr 2001 13:54:29 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: password encryption
Message-Id: <slrn9cu70l.apt.abigail@tsathoggua.rlyeh.net>

Simon Stiefel (SiStie@nuclear-network.com) wrote on MMDCCLXXVI September
MCMXCIII in <URL:news:Pine.LNX.4.31.0104071255190.853-100000@server.stiefel.priv>:
:} Yes, but I just want someone not to see the password (in plaintext) in the
:} URL.
:} 
:} This:
:} http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=1&admcode=hello
:} should look like this:
:} http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=1&admcode=x9dj40gklfjm0

What's the difference? All you have done is turning the password from
"hello" to "x9dj40gklfjm0". And now if your list of "encrypted passwords"
falls in the wrong hands, the accounts are compromised instantly -
the attacker doesn't even have to run crack.

:} But I don't know how to realize that in perl ;-).
:} 
:} > Rather than encrypting and decrypting the password (symmetric ciphers
:} > require you to solve the key distribution problem anyway), could you not
:} > use web services set up to solve this problem already, like SSL?  Once
:} > you have a secure channel, send the passowrd in plaintext.
:} 
:} afaik SSL wouldn't solve the problem, because the password still can be
:} seen in the URL.

I think you are solving the wrong problem. The solution to "I send
something to the user the user should not see" is not "obscure it", but
"then don't send it".

Of course, none of this is Perl specific.


Abigail


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

Date: Sat, 07 Apr 2001 15:17:26 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: perl 5.6 and apache
Message-Id: <3ACF32C4.3BCFB31A@home.com>

[posted & mailed]

AvA wrote:
> 
> i recently installed perl 5.6.0 and now my apache wont work properly
> anymore.
> 
> its still looking for Cwd.pm in the old @INC from version 5.005 (which i
> deleted)

Your apache is probably statically linked to libperl so you will need to
recompile it if you want it to use your new perl.

-- 
Rick Delaney
rick.delaney@home.com


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

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


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