[11455] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5055 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 4 15:07:54 1999

Date: Thu, 4 Mar 99 12:01:29 -0800
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, 4 Mar 1999     Volume: 8 Number: 5055

Today's topics:
        Printing to multiple Filehandles simultaneously <sherlock@genome.stanford.edu>
    Re: Printing to multiple Filehandles simultaneously <jglascoe@giss.nasa.gov>
    Re: printing value of -M "$file" (Bart Lateur)
    Re: printing value of -M "$file" (Larry Rosler)
    Re: procmail-ish mail handler in perl? <elaine@cts.wustl.edu>
    Re: q// vs. '' (Larry Rosler)
        questions about grep in a void context <Allan@due.net>
    Re: Re: can I make this code better? (Alan Young)
    Re: Re: can I make this code better? (Larry Rosler)
    Re: sysopen and NT (Monte Westlund)
        Taint checking, setuid cgi scripts, and user administra (Justin)
        Uploading image bnabil@my-dejanews.com
    Re: URGENT! Where Do You Hide The CGI Cards From The Sp dturley@pobox.com
    Re: URGENT! Where Do You Hide The CGI Cards From The Sp (Bart Lateur)
    Re: URGENT! Where Do You Hide The CGI Cards From The Sp (Larry Rosler)
    Re: y2k and 4-digit dates (was Re: foreach and while) <tobias@shark.td.org.uit.no>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 04 Mar 1999 10:11:30 -0800
From: Gavin Sherlock <sherlock@genome.stanford.edu>
Subject: Printing to multiple Filehandles simultaneously
Message-Id: <040319991011304897%sherlock@genome.stanford.edu>

I know I can do this:

open (FILE1, ">file1.out");
open (FILE2, ">file2.out");
 .
 .
open (FILE100, ">file100.out")

@files=(FILE1, FILE2,....FILE100);

for ($i=0; $i<100; $i++){
      print {$file[$i]} "Stuff to print";
}


but is there a way of omitting the for loop, like:

print {@files} "Stuff to print";

or 

print {FILE1, FILE2...} "Stuff to print";

both of which don't work

Cheers,

Gavin Sherlock

Sorry, no humorous signature


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

Date: Thu, 04 Mar 1999 13:45:22 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Gavin Sherlock <sherlock@genome.stanford.edu>
Subject: Re: Printing to multiple Filehandles simultaneously
Message-Id: <36DED4C2.CCBAF55E@giss.nasa.gov>

Gavin Sherlock wrote:
> 
> I know I can do this:
> 
> open (FILE1, ">file1.out");
> open (FILE2, ">file2.out");
> .
> .
> open (FILE100, ">file100.out")
> 
> @files=(FILE1, FILE2,....FILE100);

that should be a list of references: \*FILE1, \*FILE2, ...

You may want to look at perlfaq5:
"How can I make a filehandle local to a subroutine?
 How do I pass filehandles between subroutines?
 How do I make an array of filehandles?"

> for ($i=0; $i<100; $i++){
>       print {$file[$i]} "Stuff to print";
> }
> 
> but is there a way of omitting the for loop, like:
> 
> print {@files} "Stuff to print";

use strict;
use diagnostics;

local (*FH01, *FH02);

open FH01, "> biz";
open FH02, "> baz";

my @files = (\*FH01, \*FH02);

print $_ "hello, world!\n" for (@files);

> Cheers,
> 
> Gavin Sherlock

	Jay Glascoe
--  
"'C' is for 'cookie'.  That's good enough for me."
  --Cookie Monster


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

Date: Thu, 04 Mar 1999 18:59:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: printing value of -M "$file"
Message-Id: <36dfd63d.17505036@news.skynet.be>

23_skidoo wrote:

>the split works fine, i can detect which files are older than
>$time_limit and which are newer, however i'm now trying to get a
>printout of the modification value so i can see how many days have
>passed since last modification.

You could use the appropriate field from stat() (#9?), but this works,
too:

	$\ = "\n";
	print -M $0;
	print scalar gmtime($^T - 24*60*60* -M $0);


You'll see an increase in the first line every time you run the script,
but the second line should always display the same time.

	Bart.


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

Date: Thu, 4 Mar 1999 11:06:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: printing value of -M "$file"
Message-Id: <MPG.1148799dc70aeedd9896d7@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36DEA1B1.16BB@geocities.com> on Thu, 04 Mar 1999 15:07:45 
+0000, 23_skidoo <23_skidoo@geocities.com> says...
> i'm trying to write a cgi script which looks at a directory full of
> files and makes a list splitting files by their modification date.
 ...
> the split works fine, i can detect which files are older than
> $time_limit and which are newer, however i'm now trying to get a
> printout of the modification value so i can see how many days have
> passed since last modification. here's the relevant part of a larger
> script. the file that outputs looks like this:
> 
> Kill - 8247 - 
> Kill - 8248 - 
> Kill - 8249 - 
> Keep - 8070 - 
> Keep - 8071 - 
> Keep - 8085 - 

That is because the value returned by -M is 'undef' (see below for the 
reason).  Run your code with the '-w' flag, dammit!

> i was hoping for this given that $time_limit = 5
> 
> Kill - 8247 - 6
> Kill - 8248 - 6
> Kill - 8249 - 7
> Keep - 8070 - 1
> Keep - 8071 - 2
> Keep - 8085 - 3
 ...
> #check modification dates against $time_limit. 
> #remove extension ".$ext" from file names, add modification date & make
> 2 arrays
> foreach $file (@filenames)	{
> 	if (-M "$messages/$file" > $time_limit)	{
> 		$file =~ s/\.$ext//; 
> 		$moddate = -M "$messages/$file";

If $file contains ".$ext" (anywhere in the name), this is no longer the 
same file as above!  So the value of $moddate is undefined.  One way of 
dealing with this is to say

  		$moddate = -M _;

> 		push (@oldfiles, "$file - $moddate"); 
> 	}	else	{
> 		$file =~ s/\.$ext//; 
> 		$moddate = -M "$messages/$file";
> 		push (@notold, "$file - $moddate");
> 	}
> }

I tried your code as written and it works (except for the bug noted 
above).  But it prints a long floating-point result for -M, because 
'number of days' is extremely unlikely to be an integer.  I would write 
it this way (because I love to factor out common code, to avoid 
redundancy, or errors in writing the same thing twice):

  foreach my $file (@filenames) {
      my $moddate = -M "$messages/$file";
      $file =~ s/\.$ext$//;
      push @{$moddate > $time_limit ? \@oldfiles : \@notold},
          sprintf '%s - %.0f', $file, $moddate; 
  }

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 04 Mar 1999 14:01:36 -0500
From: Elaine Ashton <elaine@cts.wustl.edu>
Subject: Re: procmail-ish mail handler in perl?
Message-Id: <36DED890.2E13A181@cts.wustl.edu>

Lindbergh Loomis wrote: 
> Has anyone here taken the plunge and authored their own e-mail handler
> application, in lieu of procmail or 3rd-party spamgards? Any success or
> failure stories?

tom has some cool stuff here;
http://www.cpan.org/modules/by-authors/Tom_Christiansen/scripts/ qmail
is written in Perl as is majordomo and a bunch of other doodads...so,
I'm sure that it has been done. 

e.


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

Date: Thu, 4 Mar 1999 10:16:17 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: q// vs. ''
Message-Id: <MPG.11486dcd6865d9c49896d5@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7bme5q$nis@bgtnsc01.worldnet.att.net> on 4 Mar 1999 16:59:38 
GMT, Michael Balenger <MBalenger@worldnet.att.net> says...
> I use qw a lot to prevent me from having to put double quotes around my
> words and commas between them.

In essence, qw() puts *single* quotes around the words.

    qw( word1 word2 word3 )

is identical to

    split ' ', ' word1 word2 word3 '

And it does this at run-time, so doing it in a tight loop is unwise.
 
 ...
> system $cmd == 0
>     or die "a terrible death"

No.  Sorry, but this is not what you mean.  The expression

  $cmd == 0

is not a useful argument for system(), and would draw a warning if the 
'-w' is set (and why shouldn't it be set?). 

> I really fell in love with perl (like any good relationship, you can fall in
> love every day) when I got to pick my own delimiting characters -- the
> script I needed to submit had single- and double-quotes and parens and
> pipes.  I forget, but it was like this:
> (Note that I used bang as  my delimiter to avoid the other *special*
> characters).
> 
> $cmd = qq!  cmd1 -d "double quotes" -s 'single-quotes' | cmd2 | (cmd3; cmd4
> | cmd5) | cmd6 !

Just a reminder -- you don't even need to look at the string to find a 
character that isn't in it to use as a delimiter.  Any of the paired 
brackets () [] {} <> can be used, provided only that the string doesn't 
contain *unpaired* instances of the particular bracket-pair you choose.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 4 Mar 1999 14:35:13 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: questions about grep in a void context
Message-Id: <7bmmtb$4om$1@samsara0.mindspring.com>

Hi Folks,
    A long while back now someone posted a question about L. Stein's CGI.pm
and his use of grep.  In the example there was a bit of code which did
something like:

my %FIELDS =
('PersonalInformation'=>['Name','Address','Telephone','Fax'],
                 'References'=> ['Personal Ref 1', 'Personal Ref 2']
                  );


foreach (values %FIELDS){
    grep($ALL_FIELDS{$_}++, @$_);
}

The original post asked for help understanding what was going on.  Included
in some of the replies was a note to the effect that the above was an
example of the deprecated grep in a void context, and would be slower than
using a foreach.  In fact, I was just about to post that same statement but
decided to test it first (my script is included below).  To my surprise the
grep was faster than the foreach.  I had always thought that the grep (and
map) in a void context were slower as they built up an array that was never
used so I tried explicitly building an array.  This did slow the process
down but did not supply the same results as just using grep or map by
themselves.  Now it may be that my Benchmark is flawed so any comment there
is appreciated.  If the results of my Benchmark are representative then I
have the following questions:

1)  Given that grep in a void context is faster than the foreach, should we
revisit the notion that grep in a void context is deprecated?  Might it well
be appropriate in some circumstances?

2)  Why do grep and map become so much slower when passing data to an array
than when they are used in a void context.  I thought map was slower than
foreach because it was building an array that was not used.

3)  Are my results specific to this application and not generalizable?

Edification is always appreciated.

---------------------
#!/usr/local/bin/perl -w
use strict;

my %FIELDS =
('PersonalInformation'=>['Name','Address','Telephone','Fax'],
                 'References'=> ['Personal Ref 1', 'Personal Ref 2'],
                 'References2'=>['Personal Ref 1', 'Personal Ref 2'],
                 'References3'=>['Personal Ref 1', 'Personal Ref 2'],
                 'References4'=>['Personal Ref 1', 'Personal Ref 2']
                 );

#above, just wanted some of the values to be incremented.

sub CGIPM_grep {
    my %ALL_FIELDS;
    foreach (values %FIELDS){
        grep($ALL_FIELDS{$_}++, @$_);
    }
}
#Below, just wondered if it made a difference, doesn't seem to.
sub Block_grep {
    my %ALL_FIELDS2;
    foreach (values %FIELDS){
        grep{$ALL_FIELDS2{$_}++} @$_;
    }
}
sub Map {
    my %ALL_FIELDS3;
    foreach (values %FIELDS){
        map {$ALL_FIELDS3{$_}++} @$_;
    }
}
sub Foreach {
    my %ALL_FIELDS4;
    foreach (values %FIELDS){
        foreach (@$_) {
            $ALL_FIELDS4{$_}++;
        }
    }
}

sub Empty_map {
    my (%ALL_FIELDS5,@disposable2);
    foreach (values %FIELDS){
        @disposable2= map {$ALL_FIELDS5{$_}++} @$_;
    }
}

sub Empty_grep {
    my (%ALL_FIELDS6,@disposable);
    foreach (values %FIELDS){
      @disposable= grep{$ALL_FIELDS6{$_}++} @$_;
    }
}

use Benchmark;

timethese(1000000, {
'CGI.PMs grep in a void context'  => \&CGIPM_grep,
'Block version of grep'  => \&Block_grep,
'Map in a void context' => \&Map,
'Map, building unused array' => \&Empty_map,
'Grep, building unused array' => \&Empty_grep,
'vs. foreach'  => \&Foreach
});
__END__

Benchmark: timing 1000000 iterations of Block version of grep, CGI.PMs grep
in a void context, Grep, building unused array, Map in a void context, Map,
building unused array, vs. foreach...
Block version of grep: 81 wallclock secs (80.79 usr +  0.00 sys = 80.79 CPU)
CGI.PMs grep in a void context: 78 wallclock secs (78.54 usr +  0.00 sys =
78.54 CPU)
Grep, building unused array: 125 wallclock secs (124.84 usr +  0.00 sys =
124.84 CPU)
Map in a void context: 112 wallclock secs (112.71 usr +  0.00 sys = 112.71
CPU)
Map, building unused array: 187 wallclock secs (186.59 usr +  0.00 sys =
186.59 CPU)
vs. foreach: 104 wallclock secs (104.79 usr +  0.00 sys = 104.79 CPU)

-----------------------
Thanks,
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
If a man does not keep pace with his companions, perhaps it is because he
hears a different drummer. Let him step to the music which he hears, however
measured or far away.
 - Thoreau





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

Date: Thu, 04 Mar 1999 18:52:55 GMT
From: alany@2021.com (Alan Young)
Subject: Re: Re: can I make this code better?
Message-Id: <36e0d177.11009524@news.supernews.com>

[cc'd ]

Thank you for your time on this.  I really appreciate it.

On Wed, 3 Mar 1999 20:11:35 -0800, lr@hpl.hp.com (Larry Rosler) wrote:

>> LR>Wouldn't an absolute path or a visible chdir be more appropriate?
>> 
>> What do you mean?  ./inventory as opposed to inventory?
>
>No, I mean '/home/alany/subdir/inventory' (or whatever), or
>
>  chdir '/home/alany/subdir/' or die "Couldn't chdir. $!\n";

Yes, it would be more appropriate.  This project is for multiple
clients who will have their own setup in subdirectories under the main
program directory.  And I do use a absolute path in the real program.
I had it that way because I was more concerned with getting
information from the item and inventory files.

>> LR>  my %inventory = map { (split /\|/)[0], $_ } <FH>;
>> 
>> Let me make sure I understand what you've done here:
>> 
>> $_ is the individual lines from FH
>> 
>> (split /\|/) will split $_ into an anonymous array @() (Is that the
>> same as @_ ?)
>
>No.

I'm assuming you mean "No, it's not the same" as opposed to "No,
you're completely wrong here."

Am I correct in that it splits to an anonymous array?  Based on
perlref and perldoc -q split (which is mostly similar to Programming
Perl's section as well) I think this is the case, but confirmation
would be nice! :)

Also, I see now the difference between @() and @_.  Is @() the correct
notation for an anonymous array, or am I just making things up here.

>> "Item " . (split /\|/)[0] . " does not exist in inventory.\n", @line;
>
>Yes.  But rather than do the split twice, I would write:
>
>  my @items = map { my $item = (split /\|/)[0];
>    $inventory{$item} || "Item $item does not exist in inventory.\n" }
>    @line;

Experimentation is fun! If I add sort in front of map I'll then get a
sorted output (since item codes are alpha-numeric I don't need to
worry about anything else)!

The more I know perl the more I like it!  Wheeee!

Thanks again for your help.

-- 
Alan Young                                            Technical Support
http://members.xoom.com/AlanYoung                 2021.Interactive, LLC
If your happy and you know it, clunk your chains!   http://www.2021.com

986 It was a book to kill time for those who liked it better dead.



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

Date: Thu, 4 Mar 1999 11:52:10 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Re: can I make this code better?
Message-Id: <MPG.1148844156d1ac3f9896dd@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36e0d177.11009524@news.supernews.com> on Thu, 04 Mar 1999 
18:52:55 GMT, Alan Young <alany@2021.com> says...
 ...
> On Wed, 3 Mar 1999 20:11:35 -0800, lr@hpl.hp.com (Larry Rosler) wrote:
 ...
> >> LR>  my %inventory = map { (split /\|/)[0], $_ } <FH>;
> >> 
> >> Let me make sure I understand what you've done here:
> >> 
> >> $_ is the individual lines from FH
> >> 
> >> (split /\|/) will split $_ into an anonymous array @() (Is that the
> >> same as @_ ?)
> >
> >No.
> 
> I'm assuming you mean "No, it's not the same" as opposed to "No,
> you're completely wrong here."

No, it's not the same.

 ... 
> Also, I see now the difference between @() and @_.  Is @() the correct
> notation for an anonymous array, or am I just making things up here.

Yes, you are just making things up here.  There is no such correct 
notation for an anonymous array, because it is anonymous :-).  You can 
create a *reference* to an anonymous array:

   $ref = [];  # Note -- square brackets!

and then the correct notation for the anonymous array is @{$ref} or 
simply @$ref.

> >  my @items = map { my $item = (split /\|/)[0];
> >    $inventory{$item} || "Item $item does not exist in inventory.\n" }
> >    @line;
> 
> Experimentation is fun! If I add sort in front of map I'll then get a
> sorted output (since item codes are alpha-numeric I don't need to
> worry about anything else)!

You might worry about the nonexistent items and where they sort.  :-)

> The more I know perl the more I like it!  Wheeee!

ITYM Yee-haw!

> Thanks again for your help.

You're welcome.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 04 Mar 1999 19:24:11 GMT
From: montejw@memes.com (Monte Westlund)
Subject: Re: sysopen and NT
Message-Id: <36deddae.12087217@news.memes.com>

Bart,
I'm checking on that. Thanks.

Best regards,
Monte

On Wed, 03 Mar 1999 20:16:56 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

>Monte Westlund wrote:
>
>>Our ISP says we have full read, write permissions for the directory in
>>question.
>
>And execute? I think you need it in order to create new files.
>
>   HTH,
>   Bart.



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

Date: Thu, 04 Mar 1999 18:25:36 GMT
From: shazam@cheesewhiz.kraft.com (Justin)
Subject: Taint checking, setuid cgi scripts, and user administration
Message-Id: <slrn7dtnf8.jkr.shazam@colo.brain.com>

Hello,

	I was wondering if anybody had a solution to my problem.  I am
developing  a setuid CGI script for user administration on a machine
running Solaris 2.6.  I don't have to worry about the kernel race bug, 
I've successfuly gotten past the opening/writing of the passwd and shadow
 files, and also calling mkdir by passing the shell command plus it's args 
as an argument to sudo.  But I have a problem with the chdir() call.  I
do this:

-L94:  chdir("$real_home_dir");

so I can start copying files like .profile and .cshrc into their directory.

But I get this:

[Thu Mar  4 09:45:04 1999] 5: Insecure dependency in chdir while running 
setuid at /dev/fd/5 line 92.

My path is set to this:

$ENV{'PATH'} = "/etc:/etc/ariesmail:/var/yp:/usr/bin:/export/home: \
$real_home_dir";

I'm not sure what to do next.  Should I just have my program copy the files 
into their home directory  by calling full paths?  How about calling sudo and 
pass cd as an arg?  Would calling cd actually change the working directory of
the program?

Any suggestions?

Justin


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

Date: Thu, 04 Mar 1999 19:31:07 GMT
From: bnabil@my-dejanews.com
Subject: Uploading image
Message-Id: <7bmn1s$tul$1@nnrp1.dejanews.com>

HI I am trying to upload an image from the browser using the cgi-lib.pl 
library, when I specify the location it uploads the image but in Ascii format
so I can't view it. Can any one tell me how I can upload an image from the
hard drive to the server.

Thanks a lot

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


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

Date: Thu, 04 Mar 1999 18:21:46 GMT
From: dturley@pobox.com
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <7bmivd$q4e$1@nnrp1.dejanews.com>

In article <36de6200.4250206@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:

>   # print "Content-type: text/plain\n\n"; # Only if print to browser
>   ($\,$,) = ("\n",':');
>   print $user,crypt($pwd,'zx');
>
> You'll have to do this on the server, because crypt() can give different
> results on different machines, and you need the version as used by that
> machine.

I've encrypted passwords numerous times using Win32 Perl on my laptop, using a
random salt, and then uploaded the files to a Unix server. The passwords check
out okay when used in a script. I believe crypt() should work no matter where
the "encrypting was done. 'Course, I've been wrong before. :-)

--

____________________________________
David Turley

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


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

Date: Thu, 04 Mar 1999 18:50:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <36ded3a2.16837423@news.skynet.be>

Larry Rosler wrote:

>Do you have any evidence to support that assertion -- either 
>experimental or in documentation?  I just verified that crypt() gives 
>the same result on HP-UX (big-endian) and Windows 95 (little-endian), 
>and I thought that was the expected behavior.

Experimental. Here is the test CGI script:

my $code = 'crypt("JAPH","xy")';
my $crypt = eval $code || $@;

print <<END;
Content-type: text/plain

Perl version = $]
OS = $^O
Server software = $ENV{SERVER_SOFTWARE}
Result of $code = $crypt
END

__END__

These are the results of this script on two servers. You can't really
say that crypt() returns the same on both:

Perl version = 5.004
OS = linux
Server software = Apache/1.3.3 (Unix) AuthMySQL/2.20 PHP/3.0.5
Result of crypt("JAPH","xy") = xyPfIrnqhqVQg

Perl version = 5.00404
OS = freebsd
Server software = Apache/1.3b5
Result of crypt("JAPH","xy") = $1$xy$xq0x31T65dzC9QFExn1I80

	Bart.


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

Date: Thu, 4 Mar 1999 11:32:15 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <MPG.11487f9a7b82742c9896d9@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36ded3a2.16837423@news.skynet.be> on Thu, 04 Mar 1999 
18:50:19 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Larry Rosler wrote:
> >Do you have any evidence to support that assertion -- either 
> >experimental or in documentation?  I just verified that crypt() gives 
> >the same result on HP-UX (big-endian) and Windows 95 (little-endian), 
> >and I thought that was the expected behavior.
> 
> Experimental. Here is the test CGI script:
 ...
> Perl version = 5.00404
> OS = freebsd
> Server software = Apache/1.3b5
> Result of crypt("JAPH","xy") = $1$xy$xq0x31T65dzC9QFExn1I80

On MSWin32 I get the same (correct) result as you did using Linux.  The 
results of this crypt() on FreeBSD are totally bogus.

`man 3 crypt` states that 'The first two characters [of the encrypted 
password] are the salt itself.'  It also says that the 'salt' characters 
must be chosen from the set

  [a-zA-Z0-9./]

AFAIK, the same character set applies to the (thirteen) characters in 
the output, though I haven't found either of these facts documented. 

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 04 Mar 1999 19:16:43 +0100
From: Tobias Brox <tobias@shark.td.org.uit.no>
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <xn6k8wxi0hg.fsf@shark.td.org.uit.no>

Staffan Liljas <staffan@ngb.se> writes:

> And there was a Y1.9K problem: in Sweden, at least, the population has
> been documented, with birthdates, since several hundred years. How do
> you know whether 89 is 1789 or 1889? You look at the front page of the
> book... It's all about context. 

Context is usually clear to humans, but usually never to
computers. y2k seems nothing but a display problem to me. The problem
is only occuring when storing dates as text. It seems rather silly to
me, both to store a date as a text, and to store it as an ambigious
text string.

-- 
TobiX			In a world without fences, who needs gates?
http://www.td.org.uit.no/~tobias/


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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