[10451] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4043 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 22 08:06:35 1998

Date: Thu, 22 Oct 98 05:00:37 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 22 Oct 1998     Volume: 8 Number: 4043

Today's topics:
    Re: %SIG handlers for CGI (Bart Lateur)
    Re: a camel? <jimbo@soundimages.co.uk>
    Re: a camel? <jimbo@soundimages.co.uk>
        about ssi and <img src... <keithlol@nospammindspring.com>
        Access to a DLL with PERL ?? <Michael.Pressler@pcm.bosch.de>
    Re: Count files in a dir SSI or CGI <keithlol@nospammindspring.com>
    Re: Count files in a dir SSI or CGI (David Alan Black)
    Re: Count files in a dir SSI or CGI <keithlol@nospammindspring.com>
    Re: CreateObject doesn't work via my browser nicolaslecart@my-dejanews.com
    Re: Help: CGI.pm basic <perlguy@technologist.com>
    Re: I digress... <qdtcall@esb.ericsson.se>
    Re: Info on crypt() (Bart Lateur)
        Negative about Perl (was: what is strlen() in perl?) <erhmiru@erh.ericsson.se>
    Re: Perl & Y2K - booby trap code <jimbo@soundimages.co.uk>
    Re: Perl & Y2K - booby trap code <rra@stanford.edu>
    Re: Perl & Y2K - booby trap code <rra@stanford.edu>
    Re: Perl & Y2K - booby trap code <rra@stanford.edu>
    Re: Perl & Y2K - booby trap code <rra@stanford.edu>
    Re: Perl & Y2K - booby trap code (Matt Knecht)
    Re: perl locale problem. <jhi@alpha.hut.fi>
    Re: Perl on NT (David Cantrell)
        plain text to HTML <mwetzer@fsmat.htu.tuwien.ac.at>
    Re: plain text to HTML <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: sorting file entries by time <erhmiru@erh.ericsson.se>
        split() works not as expected raimund_kessler@my-dejanews.com
    Re: split() works not as expected <J.D.Gilbey@qmw.ac.uk>
    Re: split() works not as expected <erhmiru@erh.ericsson.se>
    Re: Still confused with pattern matching (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 22 Oct 1998 10:35:17 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: %SIG handlers for CGI
Message-Id: <363009db.10085987@news.ping.be>

Tom Phoenix wrote:

>Well, if your server doesn't send a catchable signal, there's not much
>that a Perl newsgroup can do about it. Oh well!

Better to continue talking about nicknames and buying Randal beers.
You'd probably call the "Perl Cookbook" off-topic. ;-)

If I set $SIG{ALRM} and do an alarm(120), would this keep my script
alive, if it otherwise would have been aborted? Or would it get killed
anyway? Is it safe to test it, or would I get a Schrvdinger paradox
(where the observation influences the result)?

	Bart.


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

Date: 22 Oct 1998 10:15:03 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: a camel?
Message-Id: <ubtn5gdpk.fsf@jimbosntserver.soundimages.co.uk>

Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:

> 
> > John "Gashlycrumb" Porter
> 
> GOREY!! :) 
> 

Not half! :)
-- 
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.


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

Date: 22 Oct 1998 10:18:38 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: a camel?
Message-Id: <uaf2pgdjl.fsf@jimbosntserver.soundimages.co.uk>

gorilla@elaine.drink.com (Alan Barclay) writes:

> 
> Wasn't 'gloria' on the list at some point, changed to avoid confusion
> with Mrs Wall?

Well, maybe to avoid confusion. Or perhaps Larry felt the cost in
flowers and chocolate would be way too much.

'Honey, I've just named my computer language after you!'. 

'Oh, you do love me, don't you!'.

Women have more sense. Unless your name is HappyFunBall. Then you a
definite pervert. :)
-- 
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.


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

Date: Thu, 22 Oct 1998 05:01:56 -0400
From: "DuhK" <keithlol@nospammindspring.com>
Subject: about ssi and <img src...
Message-Id: <70ms9u$l65$1@camel15.mindspring.com>

Guess I'll start simple, then get more complicated..lol
 Ok, I have written a script (pl), that does various things
counter/e-mail response/ logging etc.
I start this script with the SSI:
<!--#exec cgi="cgi-bin/whatever.pl"-->
What is returned to the html file in place is:

<br><b>You are visitor number:</b><br>
<img src="http://myurl.com/logs/graphics/2.gif" align="center">
<br><b>Thank you!</b><br>

Ok, works great, but let's say I go this route and instead of the SSI, I
use:
<img src="http://myurl.com/cgi-bin/logger.pl?/index.html">

I grab the $ENV{'QUERY_STRING'}, telling me which file I'm dealing with
(index.html). Then, I return:

<br><b>You are visitor number:</b><br>
<img src="http://myurl.com/logs/graphics/2.gif" align="center">
<br><b>Thank you!</b><br>

Ok... I get a broken image, cause NO bitmap is returned.. I still return
text/html.. which is what I want to do.

My question is this.. Is there anyway to return content=text/html using the
<img src.. tag?

Or, is there a method I can use to return content text/html, using a method
other than the SSI?

Sorry.. started complicated.. stayed that way.. Thanks in Advance!!
Keith M.







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

Date: Thu, 22 Oct 1998 13:35:16 +0200
From: "Michael Pressler" <Michael.Pressler@pcm.bosch.de>
Subject: Access to a DLL with PERL ??
Message-Id: <70n59j$179$1@news.fr.internet.bosch.de>

Hallo,
how can I access to DLL's with a PERL-Script ???

Thank you for your help
Michael




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

Date: Thu, 22 Oct 1998 05:37:02 -0400
From: "DuhK" <keithlol@nospammindspring.com>
Subject: Re: Count files in a dir SSI or CGI
Message-Id: <70mubn$2lq$1@camel19.mindspring.com>

Try...
 opendir(DIR,"directoryname");
   @files = readdir(DIR);
   close(DIR);
   $cnt = "1";
 foreach $file (@files) {
   $cnt++;
      }

cautious_lurker@my-dejanews.com wrote in message
<70mnil$8ha$1@nnrp1.dejanews.com>...
>Does anybody know of a SSI or CGI that will count the number of files in a
dir
>[and sub dir's] and put the result in html.
>The cgi would work better for me it would only have to be run once or twice
a
>day [by cron]
>
>Thanks
>C_L
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: 22 Oct 1998 06:28:15 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Count files in a dir SSI or CGI
Message-Id: <70n1bv$j71$1@pilot.njin.net>

(sigh)

The original post didn't deserve an answer.  However, lest the answer it
got actually be taken seriously...


"DuhK" <keithlol@nospammindspring.com> writes:

>Try...
> opendir(DIR,"directoryname");

Check the return value.

>   @files = readdir(DIR);
>   close(DIR);
>   $cnt = "1";

As opposed to $cnt = 1;  ?

> foreach $file (@files) {
>   $cnt++;
> }      

So the first entry found will increment the count to 2.  And since there
will always be . and .., an empty directory will return a count of 3.

Lovely.


David Black
dblack@pilot.njin.net


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

Date: Thu, 22 Oct 1998 07:20:11 -0400
From: "DuhK" <keithlol@nospammindspring.com>
Subject: Re: Count files in a dir SSI or CGI
Message-Id: <70n4d6$ra$1@camel29.mindspring.com>

 . and .. are files like any other.  If the directory were really empty, it
wouldn't exist to begin with. So I started with "1", so at least the answer
stimulated YOUR thought.
Every question deserves an answer. Guess you learned by never asking?
Shezzz...
David Alan Black wrote in message <70n1bv$j71$1@pilot.njin.net>...
>(sigh)
>
>The original post didn't deserve an answer.  However, lest the answer it
>got actually be taken seriously...
>
>
>"DuhK" <keithlol@nospammindspring.com> writes:
>
>>Try...
>> opendir(DIR,"directoryname");
>
>Check the return value.
>
>>   @files = readdir(DIR);
>>   close(DIR);
>>   $cnt = "1";
>
>As opposed to $cnt = 1;  ?
>
>> foreach $file (@files) {
>>   $cnt++;
>> }
>
>So the first entry found will increment the count to 2.  And since there
>will always be . and .., an empty directory will return a count of 3.
>
>Lovely.
>
>
>David Black
>dblack@pilot.njin.net




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

Date: Thu, 22 Oct 1998 09:39:17 GMT
From: nicolaslecart@my-dejanews.com
Subject: Re: CreateObject doesn't work via my browser
Message-Id: <70mug5$fa0$1@nnrp1.dejanews.com>

Hello Keith,

yes i can run a simple cgi script (doesn't use OLE) on the same directory,
with the same file type, same system,same browser and permissions.
But when i try using OLE functions, the cgi script makes an error
the cause is that the script can't create an Excel apllication instance:
the CreateObject function doesn't work via my browser(Commnunicator 4.03 on
NT4.0 and NES3.5.1 web server) :((((((

thanks anyway for your help!

regards,

Nicolas

In article <362D0CE2.7841184E@mindspring.com>,
  keithmur@mindspring.com wrote:
> Actually the script works fine on my system (Win95 running MS Personal
> Web Server; the browser is Netscape 4.06).  I take it from your previous
> postings that you *CAN* run a simple CGI script from a browser.  Can you
> run a simple CGI script on the same *directory*, with the same *file
> type* (like .pl for both) on the same *system*, with the same *browser*
> that you're trying with your OLE script?  Do the *scripts* have the same
> permissions (check the file properties)?  If so, *I'm* baffled.  Let me
> know.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 22 Oct 1998 11:05:36 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Help: CGI.pm basic
Message-Id: <362F1180.5F8EA88F@technologist.com>

Tungyat Wong wrote:
> 
> Hi,
> 
> I created a very simple script:
> 
>         use CGI;
>         $query = new CGI;
> 
>         if ($query->param('mo'))        {
>                 $mode=$query->param('mo')
>         }

      print $query->header;    #### Mucho importanto!

>         print "$mode";

Ok, so my Spanish impression sucks.  You need to print the header BEFORE
any other output so your CGI script doesn't choke.

brent
-- 
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: 22 Oct 1998 11:07:32 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: I digress...
Message-Id: <isvhldufqj.fsf@godzilla.kiere.ericsson.se>

jwilde@openskies.com (Justin Wilde) writes:

> Is there a condensed/simpler/cleaner/more-efficent way to do the
> following? Sure seems like a lot of code to do something so
> straightforward.

Look up sprintf (and in particular the options to the %d conversion
letter) in the perlfunc manpage.
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
                         Mediocre minds think alike.


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

Date: Thu, 22 Oct 1998 11:44:07 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Info on crypt()
Message-Id: <36311425.12719147@news.ping.be>

Michael J Gebis wrote:

>bart.mediamind@ping.be (Bart Lateur) writes:
>
>}I'm trying to figure out some properties of Perl's built-in crypt
>}function.
>
>}In particular I want to create my own password geberation/encryption
>                                                ^^^^^^^^^^
>That's got to have something to do with my last name, I know it.

No no no. I'm having a bit of a cold, that's all. :-)

>}code. One requirement I put on it, is that generated passwords only
>}consist of upper case letter, and digits: [A-Z0-9]. 
>
>}So I'm trying to figure out the correlation between the input text, the
>}salt, and the possible resulting characters in the encrypted string.
>
>On my system, the man page says:
>
>       By taking the lowest 7 bit of each character of the key, a
>       56-bit  key  is  obtained.   This  56-bit  key  is used to
>       encrypt repeatedly a constant  string  (usually  a  string
>       consisting  of  all  zeros).  The returned value points to
>       the encrypted password, a series  of  13  printable  ASCII
>       characters  (the  first  two characters represent the salt
>       itself).  The return value points  to  static  data  whose
>       content is overwritten by each call.
>
>Perl's crypt should really just tie you into the system crypt, so in
>my case, I'm always getting "13 printable ASCII characters."  I'd note
>that if you could find a correlation between input text and the
>crypted string, that would reduce the search space.  That is a bad thing.

No, You got that wrong. I ment a correlation between the result and the
salt. Apparently, there may never be any ":" in the encrypted string, if
that is to be used in a password file as a field separator.

I've tested it on the server of my ISP, and this is what I get:

	print crypt("Hello, world!","aa");
>>
	$1$aa$vCNvcZW/VEIq04KqtIeQn1

Uh-oh. Not too portable.

>I'd also note that for an eight character "password" you end up with a
>search space of 2821109907456 keys, which is equivalent to about 41.4
>bits, generally considered insecure (except in the US).
>
>In other words, I'm saying I don't think you can do what you want, and
>if you could, it would be a bad thing.

Anybody can apply for a password, so security from hackers is not really
a problem. We just want to keep track of what users do.

Also, if people ask for new password because they forgot the old one, I
want them to have the same password.

I think I'll resort to another way. I think I'll use 32-bit CRC, and
format that number as a 6-digit base-36 number ([0-9A-Z]) plus a
checkdigit, generated similar to barcodes and creditcards. Thus I get a
7 characters string consisting only of digits and uppercase letters,
with around 2E9 possible values.

Not only must it be a validly composed password, it must also be the dB
for the registered users (username/password scheme). To crack it, you
must know a user's username, and the search for his password.

>}I've looked at the crypt(3) man pages, but it doesn't even look like
>}it's the same functionality. For example: these man pages talk about a
>}4-bytes salt key, while I thought that Perl's crypt() uses only two
>}characters for salt.
>
>Weird, man.  What OS?

Some version of BSD. Here's what it says:

>     The first argument to crypt is a NUL-terminated
>     string (normally a password typed by a user).  The second is a character
>     array, 9 bytes in length, consisting of an underscore (``_'') followed by
>     4 bytes of iteration count and 4 bytes of salt.

but a bit further down, I found:

>     For compatibility with historical versions of crypt(3), the setting may
>     consist of 2 bytes of salt, encoded as above, in which case an iteration
>     count of 25 is used, fewer perturbations of DES are available, at most 8
>     characters of key are used, and the returned value is a NUL-terminated
>     string 13 bytes in length.

This agrees with what you said, but not with my experiments.

CRC-32 looks just as decent as crypt() (though with fewer characters in
the result), but more portable.

	Bart.


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

Date: 22 Oct 1998 12:40:47 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
To: Uri Guttman <uri@fastengines.com>
Subject: Negative about Perl (was: what is strlen() in perl?)
Message-Id: <la67dc3mmo.fsf_-_@erh.ericsson.se>

Uri Guttman <uri@fastengines.com> writes:
> >>>>> "MR" == Michal Rutka <erhmiru@erh.ericsson.se> writes:
>   MR> What so wonderful about it?
>   >>  why do you make comments like that after helping someone out?
> 
>   MR> It is not a comment. It is a question. I know why I love Perl, and
>   MR> all I want to know is why, a begginer (I guss), like Mehdi is
>   MR> finding Perl wonderfull.
> 
> i understand your intent now, but i did interpret it in a negative
> way. as some have asked me to be clearer, i will ask you to do the
> same. i think others who i have emailed with agree that that comment
> reads as negative. other ways to write it might be:
> 
> which part of perl do you most feel wonderful about?
> tell us more about why you feel wonderful about perl.

Yeah. But this question will suggest an answer. Moreover, answer to
this question would be usseles to persuade a real opponent.

> these convey a more positive view from the writer as well and asking the
> original poster about their views. the question you asked could be read
> as "WHY do you think perl is wonderful (since i don't think so)?"

Acctually, you've got it correct. The answer should be to THIS
question. It should convince the one who ask (me in this case), to use
Perl.

The problem is that this question does not represent my real feelings
about Perl, but represent an abstraction in order to generate a
correct reply. You've got the meaning on the question
correct. However, you disconnect it from my real attitude towards
Perl, and read this as negation of Perl by me. This is a typical
problem, when you try to understand some message without a full
context. Of course, I've catched myself in this trap, when I replaied
to your post about /g and \G. But, as human being we can resolve
missinterpretation, can't we?

BTW, this kind of questions is usually used by management towards
emplies in situation like this:

E: I have a bright idea.
M: What is so brigth about it?

A manager wants to generate as much good arguments as possible. He
needs this, because if he thinks that the idea is really great then he
must go to big boss and say, e.g.:

M: I need $1.000.000 for realization of the bright idea.
BB: *&^$%#@# 

No big boss will give $1.000.000 without a really good reason...

Regards,

Michal


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

Date: 22 Oct 1998 10:02:59 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <ud87lge9o.fsf@jimbosntserver.soundimages.co.uk>

mjd@op.net (Mark-Jason Dominus) writes:

> 
> If someone trips on a banana peel, it's partly their fault for not
> looking where they were going, but it's also partly the fault of
> whoever left the banana peel in the way.  This is a banana peel.
> 

Only in civil litigation mad America would such a perverted concept be
uttered. Who the hell will you blame when you fall off the unstable
sea cliff because you were standing too near the edge? God?
Geologists? The city government?

And if a sign were posted, then what? Would you still sue God?
Geologists? The city government?

Perl has a cliff. Perl has a sign. Read it. Stand back away from the
edge. Never fall off.

Illiterate? Don't program. Can read? RTFM. Put responsibility squarely
back on the shoulders that bear the burden. The Perl user. If one uses
Perl, use it correctly. If one does not know how to use Perl
correctly, RTFM.
-- 
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.


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

Date: 22 Oct 1998 02:58:50 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <yllnm87w9x.fsf@windlord.stanford.edu>

Randal Schwartz <merlyn@stonehenge.com> writes:
>>>>>> "Snowhare" == Snowhare  <snowhare@devilbunnies.org> writes:

> Snowhare> I concur with the basic premise. And it is _very_ applicable
> Snowhare> to Perl.  It wasn't until the Blue Camel came out that the
> Snowhare> reference book stated that localtime returns the year -
> Snowhare> 1900. The Pink Camel states something like "comes straight out
> Snowhare> of a tm struct (That's a bit of C programming lingo - don't
> Snowhare> worry about it.)" (pg 160) :O

> Bulloney.  Nonsense.  "straight out of a tm struct" was completely
> apropos to the audience of the Pink camel... other Unix hackers that
> knew C.  And nearly all of them were trusted to be able to type "man
> localtime" to get the details.

Then why does the text of the book strongly imply that they shouldn't
bother looking it up in the man page?  Or is Snowhare's quote incorrect?

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 22 Oct 1998 02:57:21 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <ylogr47wce.fsf@windlord.stanford.edu>

Brad Murray <murrayb@vansel.alcatel.com> writes:
> snowhare@xmission.xmission.com (Snowhare) writes:

>> *ANY* system that does not use at least 4 digit years for *ALL* dates
>> is Y2K booby trapped.  This includes Perl (which inherited the booby
>> trap from C).

> It would be as sane to argue that a function that returned year as
> number of seconds from the beginning of year 1 is not Y2K compliant
> because if you just print the year you don't get 2001, but rather some
> huge integer.  It's awkward, but the year is still correctly contained
> in the output.

> If you don't understand how to cope with offsets, you should not be
> programming.

I think you could have made your point without being gratuitously
insulting.  Please at least consider that in the future.  Snowhare
certainly should be programming, and he's been around these parts for
quite a while, but even that's beside the point.  There is absolutely no
need to be offensive when presenting your side of an argument, regardless
of who you're arguing with.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 22 Oct 1998 02:52:51 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <ylu30w7wjw.fsf@windlord.stanford.edu>

Randal Schwartz <merlyn@stonehenge.com> writes:

> In the same way, it'll make perfect sense past the millennium (or even
> now) to talk about years like 11/22/03 (to mean my birthday in the year
> 2003) and 11/22/98 (to mean my birthday this year).

I think you need to read Tom's rant about Y2K again.  :)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 22 Oct 1998 03:02:58 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <ylk91s7w31.fsf@windlord.stanford.edu>

Lack Mr G M <gml4410@ggr.co.uk> writes:
> snowhare@xmission.xmission.com (Snowhare) writes:

>> Now people have to worry about whether a date is '%100','-1900','%100
>> until 1999, 4 digit thereafter','-1900 from 1970 to 1999, -2000 after
>> 2000' or any of a dozen other bad hacks designed to simply NOT do the
>> right thing by using 4 digits dates _ALL_ the time.

> No they don't.  They have to read their documentation.

> Even if it returned 1998 at the moment, people would still have to know
> that it returned 1998.

The fact that a return value of the year - 1900 is documented does not
change the fact that returning the year - 1900 when you could have just
returned the year is stupid.

Documentation is not an replacement for sound engineering.  It is, at
best, the wallpaper that tries to liven up the really ugly stone.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 22 Oct 1998 10:47:30 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <63EX1.96$6J3.1516491@news2.voicenet.com>

finsol@ts.co.nz <finsol@ts.co.nz> wrote:
>I would recommend for anyone responsible for Perl applications, to do a
>search on "localtime" in the code and ensure that it is handled correctly. 

While you're checking localtime, make sure you check all your opens for
success.  And then check all your closes, too.  Also your print
statements.  Don't forget the forks.  Make sure you're not using map in
a void context.  Also make sure to check your quoted strings.  Make sure
all packages return a 1.  Make sure ...

Or, read the docs in the first place, and don't worry about it.  Unless
you have to deal with supporting other people's code.  If so, this list
probably isn't long enough. :)

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 22 Oct 1998 13:46:39 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: perl locale problem.
Message-Id: <oeepvbkvppr.fsf@alpha.hut.fi>


syarbrou@nospam.ais.net (Steve .) writes:

> I have redhat 5.1 installed.  I try to install pRPC-modules-0.1005.
> Get the following error when doing a perl Makefile.PL
> 
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
>         LC_ALL = (unset),
>         LANG = "en_RN"
>     are supported and installed on your system.
> perl: warning: Falling back to the standard locale ("C").
> Checking for Storable ... ok
> Checking for Sys::Syslog ... 
> You must have installed the 'Sys::Syslog' module.
> You get it at the CPAN. See 'man CPAN' or 'perldoc CPAN'for more info.
> [root@olsoracle pRPC-modules-0.1005]# 
> 
> I keep getting the locale error, and also now the Sylog error.  I've

For the locale error I suggest you read the perllocale manual page.
Perl 5.005_02 suggested, it contains (even more) extensive instructions
on what to do when the above locale error hits.

> done the h2ph and there are man pages available for Sys::Syslog.

man pages do not equal the module being installed, sadly.  How about
doing as the error message says and reading "perldoc CPAN"?

> What's up?  Thanks.
> 
> Steve

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Thu, 22 Oct 1998 09:52:09 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Perl on NT
Message-Id: <362fff29.60192552@thunder>

On 21 Oct 1998 17:19:48 GMT, cberry@cinenet.net (Craig Berry)
enlightened us thusly:

>David Cantrell (NukeEmUp@ThePentagon.com) wrote:
>: On Tue, 20 Oct 1998 21:53:11 -0500, "Matt Johnson"
>: <mjohnson@getonthe.net> enlightened us thusly:
>: >Does anyone know why my perl scripts are looking for files that are in my
>: >servers root, instead of the directory that my scripts are in.
>: >
>: >I am using IIS 3.0.
>: 
>: That'd be the reason then.
>
>Yes, this is one of my favorite reasons to hate Mickeysoft.  IIS runs
>scripts with . set to the doc root, rather than in the script's own home
>dir.  Easiest way to circumvent this problem is a chdir in a begin block,
>but of course this makes the script less portable.  Sigh.

This is portable between IIS and Apache/Win32, and, I guess, other
servers on other platforms as well:

my $realPath=$ENV{'PATH_TRANSLATED'};
$realPath=~s/(.*)([\\\/])[^\\\/]*/$1/;
chdir($realPath);

I always have that near the top of my CGIs.

For the purists, there's no need to check whether the chdir() succeeds
because we already know that the webserver's userID can access it
because this script is running ;-)

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Thu, 22 Oct 1998 13:10:14 +0200
From: Michael Wetzer <mwetzer@fsmat.htu.tuwien.ac.at>
Subject: plain text to HTML
Message-Id: <362F1295.B20E94C9@fsmat.htu.tuwien.ac.at>

so i do substitute a query_string into the real values
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

but now I want to substitute plain text to html
so that "<" becomes "&lt;" and so on for all(?) possibilities
is there such a routine??

thanks Michael



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

Date: 22 Oct 1998 13:18:54 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: plain text to HTML
Message-Id: <83g1cgondt.fsf@vcpc.univie.ac.at>

Re: plain text to HTML, Michael
<mwetzer@fsmat.htu.tuwien.ac.at> said:

Michael> so i do substitute a query_string into the real
Michael> values $value =~
Michael> s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Na geh, why not "use CGI;" ?

Michael> but now I want to substitute plain text to html so
Michael> that "<" becomes "&lt;" and so on for all(?)
Michael> possibilities is there such a routine??

Check out CPAN for the HTML modules.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: 22 Oct 1998 12:11:25 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: sorting file entries by time
Message-Id: <la7lxs3nzm.fsf@erh.ericsson.se>

John Porter <jdporter@min.net> writes:
> Michal Rutka wrote:
> > 
> Thanks a lot, jerk.

Thanks for presentation. Jerk, you can call me Michal.

> You also mailed this to me.
> Has it ever occured to you that most people deal with their
> email before hitting the newsgroups?

Yes.

> Please, next time put something like "[Posted and mailed]"
> at the top.

If you read your e-mail carefully then you should notice the following
tekst on the beggining:

"The following message is a courtesy copy of an article
that has been posted to comp.lang.perl.misc as well."

Of course it differs from "[Posted and mailed]", but there are more
ways to do the same thing. The first one is to use a decent
newsreader.

> The Net and I thank you.
> 
> Also, please set your line width to something less than 80.
> Thanks again.

There is no line longer than 75 characters in my post. In Europe 75 is
less than 80.

<cut>

Michal.


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

Date: Thu, 22 Oct 1998 10:44:24 GMT
From: raimund_kessler@my-dejanews.com
Subject: split() works not as expected
Message-Id: <70n2a8$id7$1@nnrp1.dejanews.com>

What I want to do is to increment an ip address. I tried to split the address
in the 4 parts then increment the last one and finally join the parts
together. To split I used the line  @pip = split(/\./,$ip[0]); After that the
value of @pip was 4. Whats wrong? Can anybody help me?

Thanks in advance
  Raiund Kessler

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 22 Oct 1998 11:58:09 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: split() works not as expected
Message-Id: <362F0FC1.4C212C7C@qmw.ac.uk>

raimund_kessler@my-dejanews.com wrote:
> 
> What I want to do is to increment an ip address. I tried to split the address
> in the 4 parts then increment the last one and finally join the parts
> together. To split I used the line  @pip = split(/\./,$ip[0]); After that the
> value of @pip was 4. Whats wrong? Can anybody help me?

Nothing -- IP addresses usually have for octets, and @pip == 4 means
that
the @pip array has four elements: $pip[0], ..., $pip[3].

HTH,

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-


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

Date: 22 Oct 1998 13:27:10 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: split() works not as expected
Message-Id: <la3e8g3khd.fsf@erh.ericsson.se>

raimund_kessler@my-dejanews.com writes:
> What I want to do is to increment an ip address. I tried to split the address
> in the 4 parts then increment the last one and finally join the parts
> together. To split I used the line  @pip = split(/\./,$ip[0]); After that the
> value of @pip was 4. Whats wrong? Can anybody help me?

Everything is OK. If you evaluate @pip in a scalar context then you
get a number of elements contained in @pip. You want 4, wont you?

However, looking on your problem I would do it like this:

use Socket;
$ip = '254.255.255.255';
$ipn = unpack("I",inet_aton($ip));
$ipn++;
print "$ip increased is: ",inet_ntoa(pack("I",$ipn));

This script will return:

254.255.255.255 increased is: 255.0.0.0

Hope this help.

Michal

> Thanks in advance
>   Raiund Kessler


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

Date: Thu, 22 Oct 1998 06:14:38 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Still confused with pattern matching
Message-Id: <u24n07.shk.ln@flash.net>

Martien Verbruggen (mgjv@comdyn.com.au) wrote:
: In article <362ED1BE.14AEABE1@creative.net>,
: 	Farhad Farzaneh <ff@creative.net> writes:

: > if ($mls =~ /[0-9]+/) {

: You realise that this does the same as 

: if ($mls =~ /\d/)
              ^^^^
              ^^^^

    /\d+/  is the same as  /[0-9]+/   (was a typo, I'm sure)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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