[9927] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3520 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 24 01:01:31 1998

Date: Sun, 23 Aug 98 22:00:19 -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           Sun, 23 Aug 1998     Volume: 8 Number: 3520

Today's topics:
        Code Optimization-- Can I do this better? (WebGuyis1)
    Re: Code Optimization-- Can I do this better? (Mark-Jason Dominus)
    Re: Code Style (Was: How to sort this associative array (Jari Aalto+mail.perl)
    Re: database on the internet amaben@my-dejanews.com
    Re: directory chmod (Randy Kobes)
    Re: directory chmod <dan@fearsome.net>
    Re: directory chmod (Randy Kobes)
    Re: How to get data from Access-Database via CGI <antoy@cs.pdx.edu>
        LA Area perljockey needed ASAP <brad@loadmag.com>
    Re: LA Area perljockey needed ASAP (Abigail)
        Looking for Programmer/Job Opp. (FixingHole)
        mSQL on VMS? (Howard S Shubs)
    Re: Needing bmp2gif converter (Randy Kobes)
        O'Reilly CGI problem <seamusc@geocities.com>
    Re: O'Reilly CGI problem <ben@sofnet.com>
    Re: Perlscript: where is documentation <founder@pege.org>
    Re: Q: Sliding Window Sort With Perl? (Mark-Jason Dominus)
    Re: Script wanted to change /etc/passwd passwords. <antoy@cs.pdx.edu>
    Re: Sigh (Mark-Jason Dominus)
    Re: Simple question for doing a sort on a text file (Craig Berry)
    Re: Simple question for doing a sort on a text file (Abigail)
    Re: Simple question for doing a sort on a text file (Craig Berry)
    Re: Size of a JPG file <founder@pege.org>
    Re: Taint Question (Mark-Jason Dominus)
    Re: Why dont people read the FAQs (Jeffrey Drumm)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 24 Aug 1998 02:38:59 GMT
From: webguyis1@aol.com (WebGuyis1)
Subject: Code Optimization-- Can I do this better?
Message-Id: <1998082402385900.WAA24508@ladder03.news.aol.com>

This is what I have and I want to know if there is a better and more efficient
way of accomplishing my task.

Q: I need to generate three random numbers from 0 -> $limit .  All three
numbers must be unique and use the PERL language.

$limit = 4;

# Random Number Generator Engine
sub rndengine{
  srand(time|$$);
  $i = int(rand($limit));
  $i;
}

# Generate Numbers
sub generate{
	$num1 = &rndengine;
	$num2 = &rndengine;
	$num3 = &rndengine;

	while($num1 == $num2){
		$num2 = &rndengine;
		while($num2 == $num3){
			$num3 = &rndengine;
			while($num1 == $num3){
				$num1 = &rndengine;
			}
		}
	}
}

Any suggestions would be most appreciated!

Lance Wilson
(lance@webguy-prod.com)
WebGuy Productions, Inc.
President


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

Date: 23 Aug 1998 23:19:49 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Code Optimization-- Can I do this better?
Message-Id: <6rqm4l$456$1@monet.op.net>


In article <1998082402385900.WAA24508@ladder03.news.aol.com>,
WebGuyis1 <webguyis1@aol.com> wrote:
># Random Number Generator Engine
>sub rndengine{
>  srand(time|$$);
>  $i = int(rand($limit));
>  $i;
>}

You should never, ever, ever call `srand' more than once in your
entire program.  If you call it every time you generate a number, as
you do here, you substantially reduce the amound of randomness in the
generator.  Also, the global variable $i is superfluous here.  Do it
like this:

	sub rndengine { int rand $limit }

That said, I might write the generator like this:

# generate(n): generate n distinct random numbers and return list of them
sub generate {
  my $n = shift;
  my %r;
  while (keys %r < $n) {
    $r{randengine()} = 1;
  }
  keys %r;
}

Now `generate(3)' returns a list of three distinct random numbers.
The principle at work here it Tom's Pavlovian Conditioning Rule:
``When you hear the word `unique', say `hash'. ''


Of course, your random numbers are between 0 and 3, so the fastest and
easiest way to generate three of them is by simply choosing which of
the four possibilities you're going to *omit*, like this:

sub generate {
  my @goodnums = (0..3);
  splice @goodnums, rndengine(), 1;  # Remove one `bad' number from the list
  @goodnums;                         # Return the other three numbers
}



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

Date: 23 Aug 1998 16:45:29 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Re: Code Style (Was: How to sort this associative array?)
Message-Id: <tbemu7hkw6.fsf@blue.sea.net>

--pgp-sign-Multipart_Sun_Aug_23_16:45:05_1998-1
Content-Type: text/plain; charset=US-ASCII

| 1998-08-21 Zenin <zenin@bawdycaste.org> comp.lang.perl.misc
|         for (
|         ) {
|             ## Insert nifty code here
|         }

We use "modern" line-up style:

         for (
		..code
             ) 
	 {
             ## Insert nifty code here
         }

|     for (
|         sort {
|             $spool->{0}->{ng}->{$b}->{count}
|             <=>
|             $spool->{0}->{ng}->{$a}->{count}
|         } keys %{$spool->{0}->{ng}}
|     ) {
|         printf(
|             "\t    %-5s : %s\n",
|             commify($spool->{0}->{ng}->{$_}->{count}),
|             $_
|         );
|     }

And this would be:

     for ( sort 
	   {
		$spool->{0}->{ng}->{$b}->{count}
		<=>
		$spool->{0}->{ng}->{$a}->{count}
           } 
	   keys %{$spool->{0}->{ng}}
         ) 
     {
         printf(
             "\t    %-5s : %s\n",
             commify($spool->{0}->{ng}->{$_}->{count}),
             $_
         );
     }

In our style, the start/end delimiters can be leveled just 
above the function, like:

    use var qw
    (
	$VAR
	%HASH
	@LIST
    );


An in above that was adjusted to sort(), but could also be:

    my 
    (
	$arg1,
	$arg2,
	$veryLongArgNameOrSomethingLikeThat,
	$arg3

    ) = @ARG


jari
--pgp-sign-Multipart_Sun_Aug_23_16:45:05_1998-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit


Version: 2.6.3ia
Comment: Processed by Emacs TinyPgp 2.73

iQBVAwUBNeAc5cC67dVHFB01AQGkzgIAjmxhC5orPgyPFxXfXVNca9MfvNARRkqc
T8MgYihH6n5KLPegwl5LvlSeWof8voQ6AOe4uN6x1unDCiVH+l9Suw==
=CTyw
-----END PGP MESSAGE-----

--pgp-sign-Multipart_Sun_Aug_23_16:45:05_1998-1--


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

Date: Mon, 24 Aug 1998 04:45:40 GMT
From: amaben@my-dejanews.com
Subject: Re: database on the internet
Message-Id: <6rqr5j$mjf$1@nnrp1.dejanews.com>

Check out http://www.webfiler.com . You might find this product and service
(they can host your apps too) to be pretty easy.
In any case, it's worth a look. It's pretty powerful and you can configure the
whole thing from a web browser (at work or at home!).

Hope this helps,
-P. Ross

In article <35D56D2E.61E4@hotmail.com>,
  Tom <ms9x6sts@hotmail.com> wrote:
> but what can I do, if the sys admin does not allow it?
> I'm using hypermart.net, free web hosting, I'm not sure if
> it's allowed to install any modules.
>
> are there other solutions to a database-interface without installing
> anything?
>
> Thanks for you help.
>
> Tom
>

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


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

Date: 24 Aug 1998 02:09:03 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: directory chmod
Message-Id: <slrn6u1j94.shq.randy@theory.uwinnipeg.ca>

On Sun, 23 Aug 1998 23:16:09 +0100, Daniel Adams <dan@fearsome.net> wrote:
>Hi,
>
>I seem to be having little success writing directory permissions using
>chmod, and was wondering if someone would be so kind as to take 5 seconds to
>tell me which of the below is the correct syntax and why, puzzlingly, _none_
>of the below seem to work: Surely I got lucky on at least one! I tried
>checking various FAQs including the one at www.perl.com, but it didn't seem
>to contain any info pertaining specifically to directory chmoding - I know
>it must be almost identical to file permission chmoding, but it doens't seem
>to be working for me. Is there something I'm forgetting??
>
>chmod(0777, /foo/directory);
>chmod 0777, '/foo/directory';
>chmod(0777, /foo/directory/);
>chmod 0777, '/foo/directory/';
>
>--

Hi,
   A variation of
	chmod 0777, '/foo/directory';
seems to work for me ... Perhaps what you're forgetting is to check
whether or not it succeeded:
	chmod 0777, '/foo/directory' 
		or die "Can't chmod /foo/directory: $!";
Maybe you don't have the proper permission to do this?

-- 
		Best regards,
		Randy Kobes

Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theory.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: Mon, 24 Aug 1998 03:55:14 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: Re: directory chmod
Message-Id: <903927327.14188.0.nnrp-03.c2deb1c5@news.demon.co.uk>

When I manually chmod the directory, remove the script chmod line using
# chmod etc
then the script runs fine. So, it could be that the script doesn't have
permission to chmod the directory.

The other possibility however is that there is a problem in the way I am
specifying the directory path - it is actually a variable that is delivered
to the scipt through the QUERY_STRING which is somewhat strange and risky, I
know.

Anyway, the path is converted through url-unencoding and
format-checking/pattern-matching etc etc to '$bar' which has the value
'a/b/c' so my actual chmod line reads:
chmod 0777, '/foo/$bar';

I am starting to think that the script is trying to interpret this literally
and chmod a non-existent directory called $bar rather than $bar's value of
'/a/b/c'.

If anyone can give any further help, I'd be greatful.

Dan Adams
dan@fearsome.net

Randy Kobes wrote in message ...
>On Sun, 23 Aug 1998 23:16:09 +0100, Daniel Adams <dan@fearsome.net> wrote:
>>Hi,
>>
>>I seem to be having little success writing directory permissions using
>>chmod, and was wondering if someone would be so kind as to take 5 seconds
to
>>tell me which of the below is the correct syntax and why, puzzlingly,
_none_
>>of the below seem to work: Surely I got lucky on at least one! I tried
>>checking various FAQs including the one at www.perl.com, but it didn't
seem
>>to contain any info pertaining specifically to directory chmoding - I know
>>it must be almost identical to file permission chmoding, but it doens't
seem
>>to be working for me. Is there something I'm forgetting??
>>
>>chmod(0777, /foo/directory);
>>chmod 0777, '/foo/directory';
>>chmod(0777, /foo/directory/);
>>chmod 0777, '/foo/directory/';
>>
>>--
>
>Hi,
>   A variation of
> chmod 0777, '/foo/directory';
>seems to work for me ... Perhaps what you're forgetting is to check
>whether or not it succeeded:
> chmod 0777, '/foo/directory'
> or die "Can't chmod /foo/directory: $!";
>Maybe you don't have the proper permission to do this?
>
>--
> Best regards,
> Randy Kobes
>
>Physics Department Phone:    (204) 786-9399
>University of Winnipeg Fax:    (204) 774-4134
>Winnipeg, Manitoba R3B 2E9 e-mail:    randy@theory.uwinnipeg.ca
>Canada http://theory.uwinnipeg.ca/




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

Date: 24 Aug 1998 04:33:28 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: directory chmod
Message-Id: <slrn6u1rnt.c.randy@theory.uwinnipeg.ca>

On Mon, 24 Aug 1998 03:55:14 +0100, Daniel Adams <dan@fearsome.net> wrote:
[snip]
>Anyway, the path is converted through url-unencoding and
>format-checking/pattern-matching etc etc to '$bar' which has the value
>'a/b/c' so my actual chmod line reads:
>chmod 0777, '/foo/$bar';
>
>I am starting to think that the script is trying to interpret this literally
>and chmod a non-existent directory called $bar rather than $bar's value of
>'/a/b/c'.
[snip]

Hi,
   You've found the problem - variables within ' ' aren't
interpreted. Try using " ", as in
	chmod 0777, "/foo/$bar"
		or die "Can't chmod /foo/$bar: $!";
That should work ....

-- 
		Best regards,
		Randy Kobes

Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theory.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: Sun, 23 Aug 1998 21:20:36 -0700
From: Sergio Antoy <antoy@cs.pdx.edu>
To: Steve Linberg <linberg@literacy.upenn.edu>
Subject: Re: How to get data from Access-Database via CGI
Message-Id: <35E0EA14.2ADB0401@cs.pdx.edu>

Steve Linberg wrote:
> 
> In article <6rjqih$jgg$1@sun579.rz.ruhr-uni-bochum.de>, "Alexander
> Marquart" <info@kptkip.com> wrote:
> 
> > Hello there!
> >
> > I4ve got the problem to connect our Web-Server via CGI to the data on our
> > Access- Server.
> >
> > Does anybody know if it is possible to get the data out of the database with
> > CGI to implement these in my HTML-pages?
> 
> Yes, it is.  Go to www.activestate.com and look for Win32::ODBC; that's
> one way.  Then use dejanews and search this group's archives for code
> samples.  Good luck!
> _____________________________________________________________________
> Steve Linberg                       National Center on Adult Literacy
> Systems Programmer &c.                     University of Pennsylvania
> linberg@literacy.upenn.edu              http://www.literacyonline.org

I have used 5.004 for win32 and DBI and DBD::ODBC from
http://www.hermetica.com/technologia/DBI/index.html.
Simple examples come with the DB modules.

Sergio


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

Date: Mon, 24 Aug 1998 02:31:21 GMT
From: "Brad Sanders" <brad@loadmag.com>
Subject: LA Area perljockey needed ASAP
Message-Id: <Zf4E1.2940$_j.7081035@twinkie.callamer.com>

A "hot new internet startup," located just off the Sunset Strip in West
Hollywood, is looking for a perl coder who can hit the ground running to
assist in creation of a fairly complex, user-friendly backend.  We offer
long hours, terrible parking, an overbearing CEO, and all the Pepsi you can
drink.

We are looking to fill this position by 8/30/98 and be demo-ready in three
weeks. It's a big job - but if you're up for it (and live in the area - or
just like long commutes), please email credentials to brad@loadmag.com




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

Date: 24 Aug 1998 03:17:36 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: LA Area perljockey needed ASAP
Message-Id: <6rqm0g$9fc$1@client3.news.psi.net>

Brad Sanders (brad@loadmag.com) wrote on MDCCCXIX September MCMXCIII in
<URL: news:Zf4E1.2940$_j.7081035@twinkie.callamer.com>:
++ A "hot new internet startup," located just off the Sunset Strip in West
++ Hollywood, is looking for a perl coder who can hit the ground running to
++ assist in creation of a fairly complex, user-friendly backend.  We offer
++ long hours, terrible parking, an overbearing CEO, and all the Pepsi you can
++ drink.


I'm sorry, but I'm a coke person myself. (No, don't offer me all the coke
I can drink - building a parking garage is cheaper).



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 24 Aug 1998 04:11:26 GMT
From: fixinghole@aol.com (FixingHole)
Subject: Looking for Programmer/Job Opp.
Message-Id: <1998082404112600.AAA25340@ladder01.news.aol.com>

Need estimate for the following script...

Free subdomain script, in where the users page is loaded in the bottom frame,
in the top frame, an advertisement is loaded and traked, easy new user sign up,
and a cheat proof interface so that they cannot bust out of the frame...

For signup record the following info...
E-mail
Site Title
Site URL
Subdomain (whatever.domain.com)
and if they agreed to the TOS.

Please send your estimates, by e-mail to FixingHole@aol.com
Maxium amount I will pay over estimate is $40, so please be accurate


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

Date: Sun, 23 Aug 1998 22:50:24 -0500
From: hshubs@mindspring.com (Howard S Shubs)
Subject: mSQL on VMS?
Message-Id: <hshubs-2308982250250001@user-38lcgmt.dialup.mindspring.com>

Is there an mSQL version that runs on VMS?

-- 
Howard S Shubs         hshubs@bix.com
The Denim Adept        hshubs@mindspring.com


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

Date: 24 Aug 1998 01:51:32 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: Needing bmp2gif converter
Message-Id: <slrn6u1i89.shq.randy@theory.uwinnipeg.ca>

On Sun, 23 Aug 1998 21:38:59 GMT, 
	spiegler@cs.uri.edu <spiegler@cs.uri.edu> wrote:
>Hi,
>
>Any idea where I can find a program on the web that converts bmp2gif or
>bmp2jpeg on the fly? I want to have a script or program on a web server that
>converts incoming bmp images from a DB server to some www-supported graphical
>format for display to a browser client.

Hi,
   You might try the ImageMagick package, available at
	ftp://ftp.wizards.dupont.com/pub/ImageMagick/
which converts virtually anything to virtually anything. And since this 
is a perl newsgroup, you may want to also grab the associated 
modules in PerlMagick-1.42.tar.gz, under
	http://www.perl.com/CPAN/authors/id/JCRISTY/

-- 
		Best regards,
		Randy Kobes

Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theory.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: Sun, 23 Aug 1998 14:32:12 +0000
From: "Seamus J. Cranley" <seamusc@geocities.com>
Subject: O'Reilly CGI problem
Message-Id: <6rqj5g$gdb$2@news-2.news.gte.net>

Netscape 4.06 says, "Internal Server Error, etc...."
My http error log says, "Premature end of script headers"
I have RedHat linux 5.1 on two computers. The errors occur on both.
I am using Perl 5.004
The script runs fine from the command line.

Here is the CGI script, straight out of the book.

#ex_19-1
#Learning Perl Appendix A, Exercise 19.1
use strict;
use CGI qw(:standard);
print header(), start_html("Add Me");
print h1("Add Me");
if(param()) {
    my $n1 = param('field1');
    my $n2 = param('field2');
    my $n3 = $n2 + $n1;
    print p("$n1 + $n2 = <strong>$n3</strong>\n");
} else {
    print hr(), start_form();
    print p("First Number:", textfield("field1"));
    print p("Second Number:", textfield("field2"));
    print p(submit("add"), reset("clear"));
    print end_form(), hr();
}
print end_html();

All the other examples worked, except the one right after this one in
chapter 19 exercises.

Thanks for your help.





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

Date: 23 Aug 1998 23:07:09 -0500
From: BenJamin Prater <ben@sofnet.com>
Subject: Re: O'Reilly CGI problem
Message-Id: <35E0A020.A21D0E7D@sofnet.com>

Where is thy she-bang line? Ala #!/usr/bin/perl or #!/usr/local/bin/perl

Try typing simply the [script name] at the command line rather than perl
[script] and see what happens.


BenJamin Prater


Seamus J. Cranley wrote:

> Netscape 4.06 says, "Internal Server Error, etc...."
> My http error log says, "Premature end of script headers"
> I have RedHat linux 5.1 on two computers. The errors occur on both.
> I am using Perl 5.004
> The script runs fine from the command line.
>
> Here is the CGI script, straight out of the book.
>
> #ex_19-1
> #Learning Perl Appendix A, Exercise 19.1
> use strict;
> use CGI qw(:standard);
> print header(), start_html("Add Me");
> print h1("Add Me");
> if(param()) {
>     my $n1 = param('field1');
>     my $n2 = param('field2');
>     my $n3 = $n2 + $n1;
>     print p("$n1 + $n2 = <strong>$n3</strong>\n");
> } else {
>     print hr(), start_form();
>     print p("First Number:", textfield("field1"));
>     print p("Second Number:", textfield("field2"));
>     print p(submit("add"), reset("clear"));
>     print end_form(), hr();
> }
> print end_html();
>
> All the other examples worked, except the one right after this one in
> chapter 19 exercises.
>
> Thanks for your help.





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

Date: Sun, 23 Aug 1998 23:17:03 +0200
From: "Mosl Roland" <founder@pege.org>
Subject: Re: Perlscript: where is documentation
Message-Id: <6rqq04$gja$1@orudios.magnet.at>

David Hawker <dhawker@bigfoot.com> wrote in message
35e5698d.2908771@news.cableol.net...
>Try
>http://language.perl.com/info/documentation.html

And where is on this page a single word about
perlscript ?

Mosl Roland
http://pege.org/ clear targets for a confused civilization
http://salzburgs.com/ (did not find a slogan :-)




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

Date: 24 Aug 1998 00:14:38 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Q: Sliding Window Sort With Perl?
Message-Id: <6rqpbe$fbj$1@monet.op.net>


In article <35DD6DA9.3EE3@ind.uni-stuttgart.de>,
Johannes Faerber  <faerber@ind.uni-stuttgart.de> wrote:
>I like: to sort the lines after sec_since_1970 as they are passing 
>        my script - maybe:
>        - read n lines into list (size m)
>        - sort list
>        - write n lines from list
>        - check sequence
>
>Is that feasible? 

Sounds feasible to me.

>Can I put records into a list and sort it only after one field of my
>record?

Yes.  The way you do it is typically to split the records into
list-references, and the sort the list references, like this:

	# accumulate list of records
	while (<>) {
	  push @records, [split ..., $_];
	}

	# Sort list by field #17:
	@sorted = sort { $a->[17] <=> $b->[17] }

or else you use what's called the `Schwartzian Transform', where you
extract the key of interest from each record, and bundle it with the
record, ilke this:

	while (<>) {
	  my $time = extract_time($_);
	  push @records, [$time, $_];
	}

	# Sort list by time
	@sorted = sort { $a->[0] <=> $a->[1] }

	# Remove times again
	@sorted = map { $_->[1] } @sorted;


All that said, I wonder if it might be better to code an insertion
sort than to use Perl's built-in sort here.  The built-in sort is
usually `qsort', which has pathological running time when the records
are already almost sorted, as they are here; in contrast, insertion
sort performs well on almost-sorted data, and happens to match your
application well.  This is also that once-in-a-lifetime opportunity to
use bubble sort; bubble sort is just right for this application.

Try it several ways and see what works best.




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

Date: Sun, 23 Aug 1998 21:04:11 -0700
From: Sergio Antoy <antoy@cs.pdx.edu>
To: bill@fccj.org
Subject: Re: Script wanted to change /etc/passwd passwords.
Message-Id: <35E0E63B.796510B6@cs.pdx.edu>

Bill 'Sneex' Jones wrote:
> 
> Vincent Verhagen wrote:
> >
> > Hi.
> >
> > I'm looking for a CGI / Perl script that allows users of my Linux system to
> > change their /etc/passwd password via the web server. Does anybody know
> > if/where such a script is available?
> >
> > Thanks very much in advance!
> >
> > Vincent.
> 
> At http://www.perl.com Look under Security.
> 
> HTH,
> -Sneex-
> __________________________________________________________________
> Bill Jones | FCCJ Webmaster | Murphy's Law of Research:
>            Enough research will tend to support your theory.

http://www.perl.com opens URL http://www.perl.com/pace/pub.
The word "Security" does not occur on that page.
Maybe you meant something else?

Sergio Antoy


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

Date: 24 Aug 1998 00:05:37 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Sigh
Message-Id: <6rqoqh$43a$1@monet.op.net>


In article <35DC8D4F.1E222AC1@neweducation.com>,
Adam Rabung  <arabung@neweducation.com> wrote:
>Why have seemingly all of the programmers who actually know Perl
>appointed themselves to be the Universal Stewards of Moral
>Rightousness?  

So, are you part of the problem here?  Or the solution?  Wait, let me
guess.

I think your article census forgot to count articles from experts dis-
cussing deep technical matters, and a very large selection of helpful
answers to intelligent questions, a medium-sized selection of helpful
answers to stupid questions, and a certain amount of novel, cogent
Perl-related rambling.  Your census also forgot to count whiny art-
icles that complain about how unfriendly the climate is in the group.

Last week I was in the middle of an interesting discussion about
`diff', and I went away to the conference, and when I came back the
discussion was still going on.  Oh, I guess that's not important; what
is important is that people whould be able to come in and say that
it's URGENT that they be told how to tell if two strings are the same
and have fourteen people explain how to use the `eq' operator.  Right,
that's what the group is *really* about.  I must have forgot.  That's
why it's called comp.lang.perl.here-let-me-read-you-the-manual.

Excuse me.  I'd write more, but I've just received mail about how I
can MAKE $247,500 A YEAR!!! and now I have to rush off to read it.  
Since you promised to leave, I guess I'll see you in the next life.

>I retire from this newsgroup.

Don't let the door hit your butt on the way out!



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

Date: 24 Aug 1998 01:53:46 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Simple question for doing a sort on a text file
Message-Id: <6rqh3b$dau$1@marina.cinenet.net>

Gavin Cato (gavinc@geko.net.au) wrote:
: I'm having probs trying to do a very simple thing with a text file. 
: 
: I have a awk script that generates to STDOUT (or a file)  a listing that
: looks like this,
: 
: user1	6555
: user2	545
: user3 	10885
: user4	65757
: 
: I need to code a perl script that takes all these into a array then only
: print out the ones that exceed the number 10000.

Why take it into an array?  Unless you have requirements you haven't told
us, just do (presuming data on stdin):

  while (<>) {
    my @vals = split;             # Split $_ on whitespace.
    print if $vals[1] > 10_000;   # Note use of default $_ arg to print.
  }

: Any ideas? :) I'm sure it's only a 5-10 line piece of code but I can't
: see my way through it (whilst I am reading this book)

Well, good for you on getting the Llama and studying it.  And, as you can
see, it's more like 4 lines, and one of those is just a closing brace. :)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 24 Aug 1998 02:23:40 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Simple question for doing a sort on a text file
Message-Id: <6rqirc$6of$1@client3.news.psi.net>

Gavin Cato (gavinc@geko.net.au) wrote on MDCCCXIX September MCMXCIII in
<URL: news:35E0AF49.694B1BE5@geko.net.au>:
++ 
++ 
++ I need to code a perl script that takes all these into a array then only
++ print out the ones that exceed the number 10000.
++ 
++ I'm quite a newbie with perl and just bought my "
++ Learning Perl 2nd edition" yesterday but ain't quite there yet :)

You mean, you even haven't encountered relation operators yet?



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 24 Aug 1998 02:45:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Simple question for doing a sort on a text file
Message-Id: <6rqk42$dau$2@marina.cinenet.net>

Abigail (abigail@fnx.com) wrote:
: Gavin Cato (gavinc@geko.net.au) wrote on MDCCCXIX September MCMXCIII in
: <URL: news:35E0AF49.694B1BE5@geko.net.au>:
: ++ I need to code a perl script that takes all these into a array then only
: ++ print out the ones that exceed the number 10000.
: ++ 
: ++ I'm quite a newbie with perl and just bought my "
: ++ Learning Perl 2nd edition" yesterday but ain't quite there yet :)
: 
: You mean, you even haven't encountered relation operators yet?

I think this may be a bit unfair; the intent of the question seemed to
concern awk-ish text file filtering, as opposed to the simple question of
how to determine if $foo is greater than 10000.  (Of course, I've been
wrong before...which was it, Gavin?) 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Mon, 24 Aug 1998 06:34:17 +0200
From: "Mosl Roland" <founder@pege.org>
Subject: Re: Size of a JPG file
Message-Id: <6rqrjb$hil$1@orudios.magnet.at>

John Callender <jbc@west.net> wrote in message 35E0993D.45AB983D@west.net...
>Mosl Roland wrote:
>>
>> Mosl Roland <founder@pege.org> wrote in message
>> 6rpg2p$pts$2@orudios.magnet.at...
>> >I would need for use in a Perlscript something like
>> >
>> >
>> >sub get_jpg_size
>> >(
>> >  my ( $filename ) = @_;
>> >
>> >
>> >
>> >  return ( $width, $height )
>> >}
>>
>> Thanks, got answer per email, it is
>>     http://www.faqs.org/faqs/jpeg-faq/part1/section-22.html
>
>Also, the Image::Size module at CPAN does a good job on this type of
>thing.
>
>http://www.perl.com/CPAN/authors/id/RJRAY/Image-Size-2.7.tar.gz

Know this since half year, but was never able to bring it to work.
The other works :-)

Mosl Roland
http://pege.org/ clear targets for a confused civilization
http://salzburgs.com/ (did not find a slogan :-)




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

Date: 23 Aug 1998 23:51:29 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Taint Question
Message-Id: <6rqo01$frr$1@monet.op.net>

In article <m3zpcyvp1s.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
>Just because that's how tainting works.  

That's what I would have said.  Good answer, Russ!

>It taints anything used on the
>same line as the tainted expression, 

But this isn't quite right.

	($x = <>), ($y = 7);

$y does not become tainted here, even though it is on the same line as
the use of tainted data from <>.

I think what you are thinking of is that any use of tainted data
causes failure of unsafe operations in the same statement, even if the
data doesn't affect the operation, as in:

	($x = <>), (mkdir '/tmp/mjd', 0777);
	# mkdir causes taint failure

Anyway, the answer  to  the original   question is  that you  have  to
explicitly  use $1 to launder  tainted  data; merely assigning a back-
reference match isn't enough, and if you want  `why' the answer is the
same as for all other `why' questions: Because that's the way it is.
The teleology of Perl is in the source code.

The other thing you can do here is something I found etched on the
wall in a little cafe in Antarctica:

	# `The Dunwich Horror'
	sub untaint {(keys%{{$_[0],0}})[0]}   #  LOD

Then use $x = untaint($y) or whatever.  Larry said that The Dunwich
Horror might stop working in future versions of Perl, so you shouldn't
actually use it, except to drive people mad with revulsion.

I mentioned this technique in my security talk on Tuesday, and right
away someone wanted to know if it was more efficient than the
pattern-matching version.

I swear, if I had lived to be a thousand, I would never have thought
to ask that question.  

Anyway, Mike Mills said it isn't, and I am content to believe him.
Especially since I don't think he factored in the time you'd have to
spend in the insane asylum.  






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

Date: Mon, 24 Aug 1998 04:49:07 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Why dont people read the FAQs
Message-Id: <35e2eabb.135535060@news.mmc.org>

On Sun, 23 Aug 1998 17:51:57 GMT, gburnore@databasix.com (Gary L. Burnore)
wrote:

(deletia)

>The poster to which Abigail responded to so rudely only asked a question.
>Lvirden on the otherhand followed up to my posts with a smartassed tone
>suggesting that I was at fault for posting 7 or 8 times.   I responded in
>kind. If someone abigail had been the victim of the post above I'd have not
>only EXPECTED her to reply in kind, I'd have supported it.

lvirden's post, as quoted in your reply:

>>I sure wish folk WOULD wait a few weeks instead of sending 7, 8 or more
>>copies of the same posting to this newsgroup.

Now, *I* read this, and saw lvirden making a general comment about posting
multiple copies of articles, and *I* chose to believe he either didn't
check the headers or was uneducated as to the workings of Usenet. Not a
crime in my book, and certainly nothing to warrant something like "stfu."

You apparently chose to believe that he was being rude for rudeness' sake,
and responded with knee-jerk abusiveness. A simple misunderstanding that
generated a naive question on his part automatically produced abuse on
yours . . . does this not sound eerily familiar?

>>If you can't be bothered to practice what you preach, how can you possibly
>>expect anyone to take you seriously?

>If you can't be bothered to at least try to understand what you read, why
>should I care.

Sigh. Pointlessly combatative and (unfortunately) predictable. I guess I
should thank you for so tidily reinforcing my point.
-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

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

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