[18798] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 966 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 23 11:05:42 2001

Date: Wed, 23 May 2001 08:05:16 -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: <990630315-v10-i966@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 23 May 2001     Volume: 10 Number: 966

Today's topics:
    Re: "listen" to a file <hermann@holzerath.de>
    Re: columns <peb@bms.umist.ac.uk>
    Re: columns <root@novastar.dtdns.net>
    Re: columns <juex@my-deja.com>
        DBI Microsoft SQL Server. <vjayl@emc.com>
        dynamic time line as image from text <erlangen72@hotmail.com>
    Re: File listing on NT <Jenda@Krynicky.cz>
        Hash reference and copying (dave)
    Re: Hash reference and copying <pne-news-20010523@newton.digitalspace.net>
    Re: Hash reference and copying <andras@mortgagestats.com>
        Help a script to prompt to input and have those input a <stpham@qwest.net>
    Re: Help a script to prompt to input and have those inp <tony_curtis32@yahoo.com>
    Re: help getting data into hash from MySql <peb@bms.umist.ac.uk>
    Re: help getting data into hash from MySql <peb@bms.umist.ac.uk>
        Help needed - perl to download from secure website <djstall@mail.utexas.edu>
    Re: How to match the password created in Linux shadow s <khan@arcom.com.au>
    Re: How to store data in the session with perl? <Jenda@Krynicky.cz>
        How to tell what version of Perl (Sarah)
    Re: How to tell what version of Perl (Anno Siegel)
    Re: How to tell what version of Perl <lmoran@wtsg.com>
    Re: How to tell what version of Perl (Helgi Briem)
        htpasswd and crypt with perl problem <pizzadelivery@netscape.net>
    Re: htpasswd and crypt with perl problem <admin@the-piper.net>
        Implementing Orthogonality <lmoran@wtsg.com>
        Mathematical Combinations (similar to "Permuting days o <tom_mullenaux@agilent.com>
    Re: Mathematical Combinations (similar to "Permuting da <root@novastar.dtdns.net>
    Re: mod_perl & fast cgi (Randal L. Schwartz)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 23 May 2001 16:56:11 +0200
From: Hermann Fass <hermann@holzerath.de>
Subject: Re: "listen" to a file
Message-Id: <3B0BCF8B.27DC3D3C@holzerath.de>

"Peter Søgaard" wrote:

> Hi,
>
> Is it possible to have perl "listen to" a certain file, and then trigger
> some event when this file is updated( i.e. overwritten ).
> I can probably use sleep x seconds and then check the file status once in a
> while and decide whether the file has been updated since last time i
> checked...but is there a more correct way of doing this?...if so, how? :)

If you run such a status-checker as a cron-job you avoid a separate process.
The latest status should go into a tmp-file (I/O overhead if you need to check
very often) or in an environment-variable.



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

Date: Wed, 23 May 2001 14:02:51 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: columns
Message-Id: <3B0BB4FB.20B85B12@bms.umist.ac.uk>

Willem wrote:
> 
> I want to split records of a file into colums, and with a space
> between the colums.
> 
> Input from file:
> 02X123593791Y103970930X123593791Y103970930X123593791Y103970930X123593791Y10397093000
> etc.
> 
> output to file:
> 02 X123593791 Y103970930 X123593791 Y103970930 X123593791 Y103970930
> X123593791 Y103970930 00
> 

how about

while(<FILE>){
	@records = m/(\w?\d+)(?=\w)/g;
	print join(" ", @records), "\n";
}

you can make that a one liner

perl -ne 'print join(" ", m/(\w?\d+)(?=\w)/g), "\n"'

HTH

Paul


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

Date: Wed, 23 May 2001 17:45:02 +0200
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: columns
Message-Id: <990628943.111594@athnrd02.forthnet.gr>

The following is enough :    $_='02X12 ...';    s/(\D?\d+)/$1 /g;    print
$_;


"Willem" <smitw1@hotmail.com> wrote in message
news:1b8ngtc02ut15ft0vij7uka2o1rt6bb28h@4ax.com...
> I want to split records of a file into colums, and with a space
> between the colums.
>
> Input from file:
>
02X123593791Y103970930X123593791Y103970930X123593791Y103970930X123593791Y103
97093000
> etc.
>
> output to file:
> 02 X123593791 Y103970930 X123593791 Y103970930 X123593791 Y103970930
> X123593791 Y103970930 00
>
> Thanks in advance for the help!
>
> Wim




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

Date: Wed, 23 May 2001 07:54:17 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: columns
Message-Id: <3b0bcf23@news.microsoft.com>

"Willem" <smitw1@hotmail.com> wrote in message
news:1b8ngtc02ut15ft0vij7uka2o1rt6bb28h@4ax.com...
> I want to split records of a file into colums, and with a space
> between the colums.
>
> Input from file:
>
02X123593791Y103970930X123593791Y103970930X123593791Y103970930X123593791Y103
97093000
> etc.
>
> output to file:
> 02 X123593791 Y103970930 X123593791 Y103970930 X123593791 Y103970930
> X123593791 Y103970930 00

A simple substitute should do:
    s/\([XY]\)/ $1/g

jue




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

Date: Wed, 23 May 2001 10:42:58 -0400
From: Vjay LaRosa <vjayl@emc.com>
Subject: DBI Microsoft SQL Server.
Message-Id: <3B0BCC72.1E5F3954@emc.com>


--------------E517908C7EFB1DAA62B2CBD3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,

I was hoping that some one could help me. I need to access a SQL server
7.0 Database on Win2K.
Does any one have any expierience with this? If so and you are willing
to give me a few pointers
please E-mail me directly. Thanks!

vjl

--
 V.Jay LaRosa                           EMC Corporation
 Systems Administrator                  171 South Street
 (508)435-1000 ext 14957                Hopkinton, MA 01748
 (508)497-8082 fax                      www.emc.com



--------------E517908C7EFB1DAA62B2CBD3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<p>I was hoping that some one could help me. I need to access a SQL server
7.0 Database on Win2K.
<br>Does any one have any expierience with this? If so and you are willing
to give me a few pointers
<br>please E-mail me directly. Thanks!
<p>vjl
<pre>--&nbsp;
&nbsp;V.Jay LaRosa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMC Corporation
&nbsp;Systems Administrator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 171 South Street
&nbsp;(508)435-1000 ext 14957&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hopkinton, MA 01748
&nbsp;(508)497-8082 fax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www.emc.com</pre>
&nbsp;</html>

--------------E517908C7EFB1DAA62B2CBD3--



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

Date: Wed, 23 May 2001 13:43:35 GMT
From: "Mark_Pryor" <erlangen72@hotmail.com>
Subject: dynamic time line as image from text
Message-Id: <b8PO6.25679$BN6.1140602@newsread1.prod.itd.earthlink.net>

Hi,

I want to create an image of a timeline based on
event data passed as text. I know how to use
text::ParseWords and I have GD.pm/ImageMagick
installed.

Can anyone point me to an example to get me
started?

Thanks,
Mark Pryor
pgp KeyID: 0x1A966EC5




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

Date: Wed, 23 May 2001 14:18:25 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: Re: File listing on NT
Message-Id: <1103_990627505@JENDA>

On Sun, 20 May 2001 15:56:39 +1000, "James R" <reevehotNOSPAM@hotmail.com> wrote:
> I have a site search script which says (in part):
> 
> $ls = `ls $file`; # Where $file is something like "*.htm"
> 
> I believe ls is the directory listing function on a Unix system, however I
> run on an NT server and this command seems not to work.
> 
> Is there an equivalent to ls on Windows systems?

You should not use this even on unix.

	@files = <*.htm>;
or
	$file = "*.htm";
	@files = glob $file;
gives you the list of mathing files in current directory and
	stat($filesname) 
gives you size, creation date and everything else you need.

HTH, Jenda

P.S.: It seems that Perl on Win32 still uses perlglob.bat to glob the files so IMHO this all 
will work even better if you
	use File::DosGlob;




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

Date: 23 May 2001 06:30:17 -0700
From: usted@cyberspace.org (dave)
Subject: Hash reference and copying
Message-Id: <e2c00ae.0105230530.97cec28@posting.google.com>

I am grabbing values from a DB using DBI and I get the result via:

$hash_ref = $sth->fetchrow_hashref('NAME_lc');

I can then get to the values of each result via:

$hash_ref->{name_of_field}

My question is this:  How can I create a real hash from this reference
instead of dereferencing it in this way?  I would like to do:

%result = $$hash_ref;

and then be able to handle %result as a regular hash so that I can
copy it and strip it out of various things.

Thanks for any all help.

dave


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

Date: Wed, 23 May 2001 15:50:25 +0200
From: Philip Newton <pne-news-20010523@newton.digitalspace.net>
Subject: Re: Hash reference and copying
Message-Id: <4vfngtstj5b1uuibrqgq3hkc8h7e3i158k@4ax.com>

On 23 May 2001 06:30:17 -0700, usted@cyberspace.org (dave) wrote:

> My question is this:  How can I create a real hash from this reference
> instead of dereferencing it in this way?  I would like to do:
> 
> %result = $$hash_ref;

Close. %result = %$hash_ref;

> and then be able to handle %result as a regular hash so that I can
> copy it and strip it out of various things.

Well, you can use %$hash_ref nearly like a regular hash and copy it
around. (Not sure what you mean with "strip".)

More reading: perldoc perlref, perldoc perllol, perldoc perldsc.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 23 May 2001 10:13:12 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Hash reference and copying
Message-Id: <3B0BC578.4AA4FAC6@mortgagestats.com>



dave wrote:
> 
> I am grabbing values from a DB using DBI and I get the result via:
> 
> $hash_ref = $sth->fetchrow_hashref('NAME_lc');
> 
> I can then get to the values of each result via:
> 
> $hash_ref->{name_of_field}
> 
> My question is this:  How can I create a real hash from this reference
> instead of dereferencing it in this way?  I would like to do:
> 
> %result = $$hash_ref;

The thing on the left-hand-side starts with a %, the thing on the
right-hand-side starts with a $. That should be a dead giveaway. You are
trying to turn a scalar into a hash. You want %result=%$hash_ref
instead. Then you can play with your new hash all you want. See the
example below.

$hashref->{red}='rojo';
$hashref->{white}='blanco';
$hashref->{blue}='azul';

%realhash=%$hashref;

for (keys %realhash){
	print "$_ means $realhash{$_}\n";
};

print "You can also do this: red means $$hashref{red}\n";

C:\WINDOWS\Desktop>perl -w hash.pl
blue means azul
white means blanco
red means rojo
You can also do this: red means rojo

C:\WINDOWS\Desktop>


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

Date: Wed, 23 May 2001 09:53:52 -0500
From: "Steve" <stpham@qwest.net>
Subject: Help a script to prompt to input and have those input add or append certain lines in a text file
Message-Id: <P9QO6.220$a32.34759@news.uswest.net>

Hi all,

I am new to perl and I need help to write to perl script that will ask
certain values and have those values enter or modify on a certain of a
specific text file.

For example: Let say I have a text file that looks like this when I open
with a notepad.

        [UserDate]
           ComputerName = computer1

        [Params.TCPIP.Adapter1]
            IPAddress = 10.0.0.5
            SubnetMask = 255.0.0.0
            DefaultGateway = 10.0.0.1

        [Etc....]

I wanted to change or modify the line ComputerName, IPAddress, SubnetMask,
and DefaultGateway, Etc...

I would I go about writting a perl script to do that I think you are a perl
programmer it would not be so hard to write this script.

Thanks in advance,


Steve






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

Date: 23 May 2001 10:02:49 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help a script to prompt to input and have those input add or append certain lines in a text file
Message-Id: <87u22cjeg6.fsf@limey.hpcc.uh.edu>

>> On Wed, 23 May 2001 09:53:52 -0500,
>> "Steve" <stpham@qwest.net> said:

> For example: Let say I have a text file that looks like
> this when I open with a notepad.

>         [UserDate] ComputerName = computer1

>         [Params.TCPIP.Adapter1] IPAddress = 10.0.0.5
> SubnetMask = 255.0.0.0 DefaultGateway = 10.0.0.1

>         [Etc....]

> I wanted to change or modify the line ComputerName,
> IPAddress, SubnetMask, and DefaultGateway, Etc...

You'd probably want to start by looking at the

    Config::IniFiles

module.

> I would I go about writting a perl script to do that I
> think you are a perl programmer it would not be so hard
> to write this script.

Eh? :-)


hth
t
-- 
Just reach into these holes.  I use a carrot.


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

Date: Wed, 23 May 2001 14:25:43 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: help getting data into hash from MySql
Message-Id: <3B0BBA57.65866832@bms.umist.ac.uk>

Mike Solomon wrote:
> 
> I am querying a MySql database using DBI
> 
> I want to get the data into a hash where the key is the column name
> 
> the closest I have managed so far is :
> 
> my $sql = "select * from pers_add";
> my $sth = $dbh->prepare("$sql");
> $sth(execute);
> while (my $ref = $sth->fetchrow_hashref()) {
>    $date{'address1'} = $ref->{'address1'};
>    $data{'address2'} = $ref->{'address2'};
> 
>    etc.  ....
> }
> 
> As I have over 20 fields in my table this method is very laborious
> 
> Is there a better way of doing it.

how about

while (my $ref = $sth->fetchrow_hashref()) {
	%data = map { $_ => $ref->{$_} } keys %$ref;
}

HTH

Paul


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

Date: Wed, 23 May 2001 14:30:43 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: help getting data into hash from MySql
Message-Id: <3B0BBB83.33CDD027@bms.umist.ac.uk>

Paul Boardman wrote:
> 
> Mike Solomon wrote:
> >
> > I am querying a MySql database using DBI
> >
> > I want to get the data into a hash where the key is the column name
> >
> > the closest I have managed so far is :
> >
> > my $sql = "select * from pers_add";
> > my $sth = $dbh->prepare("$sql");
> > $sth(execute);
> > while (my $ref = $sth->fetchrow_hashref()) {
> >    $date{'address1'} = $ref->{'address1'};
> >    $data{'address2'} = $ref->{'address2'};
> >
> >    etc.  ....
> > }
> >
> > As I have over 20 fields in my table this method is very laborious
> >
> > Is there a better way of doing it.
> 
> how about
> 
> while (my $ref = $sth->fetchrow_hashref()) {
>         %data = map { $_ => $ref->{$_} } keys %$ref;
> }

oops!  That won't work... sorry.  

Each time round %data would be overwritten.

while (my $ref = $sth->fetchrow_hashref()) {
        for(keys %$ref){
		$data{$_} = $$ref{$_};
	}
}

that should work.

Paul


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

Date: Wed, 23 May 2001 09:36:24 -0500
From: David Stallcup <djstall@mail.utexas.edu>
Subject: Help needed - perl to download from secure website
Message-Id: <3B0BCAE8.2DF16888@mail.utexas.edu>

Hello everyone,

I am trying to emulate a http form on a secured website in order to
download a file directly to our unix box and I'm stuck.  Here are the
grisly details:

The URL is:
https://ncsistr.ic.ncs.com/neon/sampdata/$actsslx.htm

The relevant code that I created is:

*******

use Socket;

$ENV{"PGPPATH"} = "/local/tran/.pgp";
$report_path    = "/local/tran/log";   # used in log routine
system 'clear';                        # clear screen
&reset_variables;
&get_parms;
&get_act_file;

print "\nPress enter to return to menu.\n";
$pause = <STDIN>;                       # key pressed, will return to
menu
exit 0;
#
# ******************** SUBROUTINE SECTION **************************
#
sub reset_variables {
    $err_flag        = "N";
    $file            = "etsmail.log";  # used in the log routine

    $file_name       = "";
    $destdir         = "/local/tran/ets";          # constant
    $dfile           = "";
    $dfile_enc       = "";
    $acthost         = "ncsistr.ic.ncs.com";       # constant
    $actport         = "80";                      # constant
    $actdownload     =
"name:password\@ncsistr.ic.ncs.com/neon/aftfilx.htm";
    $newfile         = "";
    $pause           = "";
    $pgp             = "/local/tran/.pgp";         # constant
    $sfile           = "";
    $tempfile        = "/local/tran/tmp/tempfile";  # constant
    $type_file       = "";
}
#
# ******************************************************************
#
sub get_parms {
    print "\n\n               1 = SAT\n";
    print "               2 = GRE\n";
    print "               3 = GMAT\n";
    print "               4 = TOEFL\n";
    print "               5 = ACT\n\n";
    print "               Input Selection: ";
    $type_file = <STDIN>;
    chop($type_file);
    if ($type_file eq "5") {
           print "\n               Enter file name (e.g., c00790): ";
    } else {
           print "\n               Enter file name (e.g., utedi98.286):
";
    }
    $file_name = <STDIN>;
    chop($file_name);
}
#
# ******************************************************************
#
sub get_act_file {
    print
    "\n\nAbout to get $file_name from $acthost. \nWill put in
$tempfile.\n";
    &openSock;                                   # open socket to
website
    $content = "DSN=$file_name";
    &get($content);                              # perform HTTP Form GET 
    $wholePage = "";
    while ( <SOCK> ) {
             $wholePage .= $_;                   # retrieve output
    }
    close SOCK;                                  # close socket to
website

    if ($wholePage =~ /(-----BEGIN.*MESSAGE-----)/gs ) {
        $pgp_section = $1;                       # delete HTTP header
    } else {
        $pgp_section = $wholePage;
        $err_flag = "Y";
    }
    unlink $tempfile;
    open(OUTPUT,">$tempfile") || die "cannot open $tempfile\n";
    print OUTPUT $pgp_section;
    close OUTPUT || die "cannot close $tempfile\n";

    if ($err_flag eq "Y") {
        print "Download problem encountered. Please see $tempfile.\n";
        print "Program terminated due to download error.\n";
    } else {
        $dfile_enc = "$destdir/$file_name.txt";
        system "/bin/cp $tempfile $dfile_enc";
        print "Saved encrypted file as $dfile_enc\n";
    }
}
#
# ******************************************************************
#
sub openSock {
    $socketaddr= sockaddr_in $actport, inet_aton $acthost or die "Bad
hostname\n";
    socket 
    SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or die "Bad
socket\n";
    connect SOCK, $socketaddr or die "Bad connection\n";
    select((select(SOCK), $| = 1)[0]);
}
#
# ******************************************************************
#
sub get {
    $tempcontent = shift @_;
    print SOCK "GET https://$actdownload HTTP/1.0\r\n";
    print SOCK "Content-type: application/x-www-form-urlencoded\r\n";
    $contentLength = length $tempcontent;
    print SOCK "Content-length: $contentLength\r\n";
    print SOCK "\r\n";
    print SOCK "$tempcontent";
}
********************************

My strange result is:

********************************

HTTP/1.0 200 OK

Content-Type: text/html

Pragma: no-cache

Refresh: 0;
URL=https://name:password@ncsistr.ic.ncs.com/neon/aftfilx.htm



<HTML></HTML>

********************************

Please respond here or email me at djstall@mail.utexas.edu

Thanks!

-Dave


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

Date: Wed, 23 May 2001 23:03:31 +0930
From: "Kevin Hancock" <khan@arcom.com.au>
Subject: Re: How to match the password created in Linux shadow suite?
Message-Id: <3b0bbe8d@kastagir.senet.com.au>

sub VerifyPass{
my($passwd, $user)=@_;
open(SHAD, $MYshad) or dienice (" Failed to open $MYshad\n\n");
while( <SHAD> ){
        @data=split(/:/, $_);
        if ( $data[0] eq $user ){
                if ($data[1] eq crypt($passwd , $data[1])){
                        close(SHAD);
                        return 1;
                }
        }
}
close(SHAD);
return 0;
}

This is what I do. I do not like it as it traverses the entire length of
/etc/shadow each time especially if a miss.

I am new so if my code sucks pls feel free to pick it to pieces. It does
work though copied direct from my code.


Joseph Chen wrote in message ...
>The reply has a misunderstanding about the statement of the problem.
>Whithout the Linux shadow suite, a common practice allows the password
>a user types in to be encryped and compared against the system password
>of the user in order to verify the access of the user. For a password
>read from the user, e.g., $passwd_read, we can do the following in
>perl to verify his/her access to the system.
>
>$salt = substr($passwd_read,0,2);
>$passwd_read_and_encrypted = crypt($passwd_read,$salt);
>if ($passwd_read_and_encrypted eq $user_passwd_encrypted_from_system) {
>   the user has access
>} else {
>   the usr has no access
>}
>
>Without using the shadow suite, we can get
$user_passwd_encrypted_from_system
>from /etc/passwd file. It does not require a 'root' access privilege to
>read this file and the above codes work!
>
>With the shadow suite, all user passwords in /etc/passwd are moved
>to /etc/shadow and the passwords in /ect/password are replaced by '*'.
>
>To solve this password moving issue, I can read the user password
>$user_passwd_encrypted_from_system from /etc/shadow instead of
>/ect/passwd. But, the major problem I could not solve is that
>the encrpyted password in /ect/shadow is longer than the password
>encrypted in /etc/passwd. They have different lengths. This is
>why my comparion if-statement in the above codes fails, even if
>the $passwd_read is the same as the password of the user before
>the password is encrypted by the shadow suite.
>
>Is it because the shadow suite uses a different encrypton method?
>And, how do I fix this problem using perl? Any help is appreciated.
>
>
>Joseph Chen
>
>P.S. I have root access to the machines I work on. So, please do not
>raise the root access issue anymore.
>
>abigail@foad.org (Abigail) wrote in message
news:<slrn9gcg31.sk5.abigail@tsathoggua.rlyeh.net>...
>> Joseph Chen (yen_hung@yahoo.com) wrote on MMDCCCXVIII September MCMXCIII
>> in <URL:news:bf927196.0105182003.1e825283@posting.google.com>:
>> ""  Dear Perl Users,
>> ""
>> ""  I move a CGI program from an IBM machine to a Linux machine.
>> ""  In the IBM machine, the program allows users to enter their
>> ""  login password and uses the password to match the one in
>> ""  /etc/passwd file. It works ok. But, after I move the program
>> ""  to the Linux machine. The password comparison fails.
>>
>>
>> Due to shadow passwords. This is a feature. It avoids security problems
>> like programs from other users asking for passwords and checking them.
>> A quick way to collect passwords from other people on the system.
>>
>> You are not experiencing "a problem", just like a bank robber isn't
>> experiencing "a problem" when facing the vault. You are both encountering
>> a safety device designed to keep you out.
>>
>>
>> Unless you are root, you have no business of collecting peoples
passwords.
>> And when you are, you shouldn't have to ask how to do it.
>>
>>
>>
>> Abigail




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

Date: Wed, 23 May 2001 14:34:43 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: Re: How to store data in the session with perl?
Message-Id: <1104_990628483@JENDA>

On 22 May 2001 01:57:45 -0700, yburtin@freesurf.fr (Yannick) wrote:
> Hi,
> 
> In an html page with a perl script inside, I'd like to store a
> variable in the session in order to access it later in another page.
> How can I do that?
> 
> Thank you.
> 
> Yannick

If the other page is going to be an ASP you will have to write even the script as an ASP.
Using PerlScript of course.

It will be probably enough to wrap it in

<%@ Language=VBScript%>
<%
	use Win32::ASP; # instalable via "ppm install Win32::ASP"
	your perl code here
%>


You may use $Session, $Request, $Response and $Server objects just like in VBScript.
Of course with slightly different syntax.

I guess 
	$Session->{"myvar"} = "ahoj Jendo";
is all you will need anyway.

Or maybe
	$Session->{"myvar"} = \@array;
which will be accessible via
	Session("myvar")(index)
in VBscript.

I believe Win32::ASP contains more info.

HTH, Jenda




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

Date: 23 May 2001 07:06:10 -0700
From: sarah.felske@owens-ill.com (Sarah)
Subject: How to tell what version of Perl
Message-Id: <f804e614.0105230606.3133824a@posting.google.com>

Understand that I have never used Perl, but need to know what version
we are running on a server.  Anyone know how?


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

Date: 23 May 2001 14:14:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to tell what version of Perl
Message-Id: <9eggjo$jt3$3@mamenchi.zrz.TU-Berlin.DE>

According to Sarah <sarah.felske@owens-ill.com>:
> Understand that I have never used Perl, but need to know what version
> we are running on a server.  Anyone know how?

Most of us know that.  "perl -v" for all you need, and "perl -V" for
more than you want to know about your Perl version.

Anno


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

Date: Wed, 23 May 2001 10:15:20 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: How to tell what version of Perl
Message-Id: <jehngt4sn3gumha5rle3gfhedlhk9lphlu@4ax.com>

On 23 May 2001 07:06:10 -0700, sarah.felske@owens-ill.com (Sarah)
wrote wonderful things about sparkplugs:

>Understand that I have never used Perl, but need to know what version
>we are running on a server.  Anyone know how?

perl -v
--
BSOD? In my day we didn't have 0000FF!
lmoran@wtsg.com


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

Date: Wed, 23 May 2001 14:31:27 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: How to tell what version of Perl
Message-Id: <3b0bc96b.3711025812@news.isholf.is>

On 23 May 2001 07:06:10 -0700, sarah.felske@owens-ill.com
(Sarah) wrote:

>Understand that I have never used Perl, but need to know what version
>we are running on a server.  Anyone know how?

perl -v

Regards,
Helgi Briem



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

Date: Wed, 23 May 2001 15:11:10 +0200
From: Christian Bäumle <pizzadelivery@netscape.net>
Subject: htpasswd and crypt with perl problem
Message-Id: <pizzadelivery-614768.15111023052001@news.unisource.ch>

What's going wrong here? The code below works find and writes a 
user/password pair into the .htpasswd-file. Accessing the secure 
directory by browser the I'm not able to manage with this user/pass 
values.

If I use htpasswd by telnet there is not any problem.

The crypted pasword looks like the one by htpasswd:
test:xt2XrVg4lTs6s   example by perl
muster:cJIRKV5yW/Duo example by htpasswd/telnet

I'm using FreeBSD 4.2-RELEASE and Apache 1.3

Thanks for any help
Christian

#--> code

#!/usr/local/bin/perl
#############################
# variables for testing    #
#############################
$password   =  "123";
$dirname =  "test";

#############################
# defining salt            #
#############################
srand(time ^ $$);
@saltchars=('a'..'z','A'..'Z',0..9,'.','/');
$salt=$saltchars[int(rand($#saltchars+1))];
$salt.=$saltchars[int(rand($#saltchars+1))];

#############################
# crypting              #
#############################
$cpw = crypt($password,$salt);

#############################
# write into .htpasswd-file   #
#############################
open (wdata, ">>/etc/.htpasswd_elco-direct") or &error("Unable to write 
to the data file");

print wdata "$dirname:$cpw\n";
close(wdata); 

#############################
# confirmation          #
#############################
print qq~
<html><body>That's it!</body></html>
~;

#--> end code


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

Date: Wed, 23 May 2001 15:28:48 +0200
From: "Tom Klinger" <admin@the-piper.net>
Subject: Re: htpasswd and crypt with perl problem
Message-Id: <3b0bbc2d$1@news.i-one.at>


"Christian Bäumle" <pizzadelivery@netscape.net> wrote in message
news:pizzadelivery-614768.15111023052001@news.unisource.ch...
> What's going wrong here? The code below works find and writes a
> user/password pair into the .htpasswd-file. Accessing the secure
> directory by browser the I'm not able to manage with this user/pass
> values.
>
You're not able to manage what? The password or to login into your secured
realm?


> srand(time ^ $$);
> @saltchars=('a'..'z','A'..'Z',0..9,'.','/');
> $salt=$saltchars[int(rand($#saltchars+1))];
> $salt.=$saltchars[int(rand($#saltchars+1))];
>
I'd rather use

my $salt = join '', ('.', '/', 0..9, 'A'..'Z','a'..'z')[rand 64, rand 64];

Tom




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

Date: Wed, 23 May 2001 09:06:16 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Implementing Orthogonality
Message-Id: <svcngtgtbmuuighloblk4lgqqlq7oqlqfv@4ax.com>

--Besides Perl I don't have a lot of programming experience (.bat
files, Lotus Notes App Dev) and have never had any "formal" training
in programming.

--I was recently handed The Proagmatic Programmer and I read it and I
am currently on my second pass.  The first time I read it I realized
around page 50 that if this book was "right" I was doing nearly
everything wrong regarding programming.

--I agree totally with the orthogonality concepts but I don't know how
I would use them using Perl.  Well, I have some ideas but I am looking
for others.  (Password databases, conversion tables...)

--I'm not certain that I am ready for (or need to) read an OOP book or
attempt that sort of programming.  Still, I am intrigued by this idea
(as I am fairly lazy and C-x C-v my own code often) and would like
your ideas on the subject.

Thanks. 
--
BSOD? In my day we didn't have 0000FF!
lmoran@wtsg.com


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

Date: Wed, 23 May 2001 08:34:37 -0600
From: "Tom Mullenaux" <tom_mullenaux@agilent.com>
Subject: Mathematical Combinations (similar to "Permuting days of the week" thread)
Message-Id: <990628478.613542@goodnews.cos.agilent.com>

I'm testing some software and would like to programmatically generate a list
of all possible combinations of command-line options. Any ideas?

Thanks

-Tom




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

Date: Wed, 23 May 2001 17:59:50 +0200
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: Mathematical Combinations (similar to "Permuting days of the week" thread)
Message-Id: <990629826.394739@athnrd02.forthnet.gr>

You mean something like that ?

@options=qw/a b c/;

for $i (0..$#options)
{
 for $j (0..$#options)
 {
  for $k (0..$#options)
  {
  print "summer -$options[$i] -$options[$j] -$options[$k]\n"
  }
 }
}




"Tom Mullenaux" <tom_mullenaux@agilent.com> wrote in message
news:990628478.613542@goodnews.cos.agilent.com...
> I'm testing some software and would like to programmatically generate a
list
> of all possible combinations of command-line options. Any ideas?
>
> Thanks
>
> -Tom
>
>




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

Date: 23 May 2001 07:32:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: mod_perl & fast cgi
Message-Id: <m1wv78i1b0.fsf@halfdome.holdit.com>

>>>>> "Tom" == Tom  <tom@hotversion.com> writes:

Tom> I'm a little confused about mod_perl and fast cgi which one is faster ?

I'm a little confused about cars and trucks which one is faster?

I'm a little confused about apples and oranges which one is tastier?

Your question can't be answered without context.  "faster" in what
application, what business model, what scalability, what familiarity,
what features needed?

They're really two different things: two different ways to get past
the knee in the curve on the "fork on each response" mode of mod_cgi.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

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


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