[13497] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 907 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 25 16:07:32 1999

Date: Sat, 25 Sep 1999 13:05:10 -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: <938289910-v9-i907@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 25 Sep 1999     Volume: 9 Number: 907

Today's topics:
    Re: "Pattern matching" (Kragen Sitaker)
        **Perl tutorials!** (IlIIIIIIII)
        Accessing Browser History <stevet@javanet.com>
    Re: Accessing Browser History (Kragen Sitaker)
    Re: can I do this easier? <crt@kiski.net>
        change files weekly <Webdesigner@NewWebSite.com>
    Re: change files weekly <tchrist@mox.perl.com>
        Connect timeout <freek@coolmail.net>
    Re: Connect timeout <tchrist@mox.perl.com>
    Re: cookbook: nonforker <gellyfish@gellyfish.com>
        HELP Why does the perl CGI choke from '@' twebster5402@my-deja.com
    Re: HELP Why does the perl CGI choke from '@' (Kragen Sitaker)
    Re: How to password a file? <dwoods@ucalgary.ca>
    Re: injecting "my" varibales into caller's scope <pjl@be-NOSPAM-st.com>
    Re: injecting "my" varibales into caller's scope <tchrist@mox.perl.com>
    Re: injecting "my" varibales into caller's scope <pjl@be-NOSPAM-st.com>
    Re: injecting "my" varibales into caller's scope <tchrist@mox.perl.com>
    Re: interpolation question (Jenda Krynicky)
    Re: Need a unique "ID" string <mikecard@my-deja.com>
    Re: Perl - CGI -MySQL <dwoods@ucalgary.ca>
    Re: Perl and Ms Personnal Web server <gellyfish@gellyfish.com>
    Re: PERL GUI Handlers for Winblows 95/98/NT ... (Jenda Krynicky)
    Re: sorting like numbers an array of strings (Matthew David Zimmerman)
        tom c.: pmtools download is broken <uri@sysarch.com>
    Re: tom c.: pmtools download is broken cw@dwc.ch
        weekly update suggestions <dwoods@ucalgary.ca>
    Re: why "system" can not be used in the CGI/Perl? (Randal L. Schwartz)
    Re: why does strict not warn about shaddowing declarati (Kragen Sitaker)
    Re: Windows NT 4.0 Scripting (Jenda Krynicky)
    Re: You should be admired (Jenda Krynicky)
    Re: You should be admired (Jenda Krynicky)
    Re: You should be admired (Matthew Bafford)
    Re: You should be admired <rra@stanford.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 25 Sep 1999 19:58:56 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: "Pattern matching"
Message-Id: <4Q9H3.1755$ru1.173003@typ11.nn.bcandid.com>

In article <x3y3dw67vmh.fsf@tigre.matrox.com>,
Ala Qumsieh  <aqumsieh@matrox.com> wrote:
>
>my $cap_words = my $punc_marks = my $blank = my $sentences = 0;
>
>while (<F>) {
>	# Check if empty line
>	/^\s*$/ && ++$blank && next;
>
>	# check for periods.
>	$sentences += tr/.//;

Note that this counts "Testing..." as three sentences, and "How? Where?
When?" as zero.

>
>	# check for punctuation marks (don't miss any!)
>	# are brackets punctuation marks? you decide.
>	$punc_marks += tr/;':",./?!@#$%^&*(){}~`[]//;

Ala, you have an extra slash here, which keeps your program from
compiling.  Perhaps you meant to backslash the / between the . and the
??

>	# check each word if capital
>	while (/(\S+)/g) {
>		my $word = $1;
>		$cap_words++ if $word =~ /^[A-Z_0-9]+$/;

Note that this counts "0" as a capitalized word.

>	}
>}

I think the concept of the script is relatively sound, except possibly
for the method of counting sentences.  It needs only minor tweaks.

Did the original poster ever say they thought their question had or
hadn't been answered?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sat Sep 24 1999
44 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 25 Sep 1999 17:18:19 GMT
From: iliiiiiiii@aol.com (IlIIIIIIII)
Subject: **Perl tutorials!**
Message-Id: <19990925131819.19053.00002414@ng-ff1.aol.com>

I found a bunch at http://devlibrary.tsx.org/ !


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

Date: Sat, 25 Sep 1999 15:04:59 -0400
From: SteveT <stevet@javanet.com>
Subject: Accessing Browser History
Message-Id: <37ED1CDB.CE07BCCE@javanet.com>

Is there a way to access the browser's history using PERL?

-Steve



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

Date: Sat, 25 Sep 1999 19:16:45 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Accessing Browser History
Message-Id: <xc9H3.1671$ru1.158312@typ11.nn.bcandid.com>

In article <37ED1CDB.CE07BCCE@javanet.com>, SteveT  <stevet@javanet.com> wrote:
>Is there a way to access the browser's history using PERL?

Netscape Communicator 4.5, at least, allows you to save your history
file as HTML, and the restricted form of HTML it outputs can easily be
parsed with Perl regexes.  This is occasionally useful when you want to
do something with the history like plot its distribution.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 23 1999
46 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 25 Sep 1999 13:01:17 -0400
From: "Casey R. Tweten" <crt@kiski.net>
Subject: Re: can I do this easier?
Message-Id: <Pine.OSF.4.10.9909251250160.17710-100000@home.kiski.net>

On Fri, 24 Sep 1999, Cipo Fuzo wrote:

:I would  like to load in 8 line cunks from a text file. Is there an
:easier/nicer way, than this:
:
: [snip ugly code]

Sorry, didn't read the problem the whole way through, I didn't see that
there would be more 8 line chunks.  I composed a file of aprox 47 lines,
and used it as 'datafile'.

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


sub process {
    print @_;
    print "--------------\n";
}

my @chunk;
open DF, 'datafile'      or die $!;
flock DF, 2              or die $!;
while ( <DF> ) {
    if ( $#chunk == 7 ) {
        process @chunk;
        splice @chunk, 0, $#chunk;
    } else {
        if ( eof ) {
            process @chunk;
        } else {
            push @chunk, $_;
        }
    }
}
close DF                 or die $!;
__END__

This should help much better.

have fun!

 -- 
   Casey R. Tweten    <joke> This
    Web Developer      is 100% certified
HighVision Associates    virus and bug
 crt@highvision.com     free code. </joke>




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

Date: Sat, 25 Sep 1999 18:10:45 GMT
From: Floyd Morrissette <Webdesigner@NewWebSite.com>
Subject: change files weekly
Message-Id: <7sj36t$7jk$1@nnrp1.deja.com>

Hi, I am not looking for specific code but just some ideas for how to go
about doing this. I need a html page to change weekly and automatically.

I have 20 pages that I want to display. One each week and then start
over again. Rotate the pages weekly and in the same order. Want the
pages to change when the first person clicks on a link after Sunday
midnight.

Thanks

Floyd


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 25 Sep 1999 12:25:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: change files weekly
Message-Id: <37ed137e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Floyd Morrissette <Webdesigner@NewWebSite.com> writes:
:Hi, I am not looking for specific code but just some ideas for how to go
:about doing this. I need a html page to change weekly and automatically.

Run a cron job.

--tom
-- 
    "That's okay.  Anyone whose opinion he cares about already knows that
    he doesn't care about their opinion."
    	--Larry Wall


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

Date: Sat, 25 Sep 1999 09:48:08 -0700
From: frEEk <freek@coolmail.net>
Subject: Connect timeout
Message-Id: <37ECFCC6.5C32E0D9@coolmail.net>

Is there a simple way to make a connect timeout? Right now if I connect
to a non-existent or down IP, my script just hangs on the connect
indefinitely. I can't find anything about timouts in the docs.

Many thanks

--
Life is out to get me...
ERTW!




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

Date: 25 Sep 1999 11:05:51 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Connect timeout
Message-Id: <37ed00ef@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    frEEk <freek@coolmail.net> writes:
:Is there a simple way to make a connect timeout? Right now if I connect
:to a non-existent or down IP, my script just hangs on the connect
:indefinitely. I can't find anything about timouts in the docs.

% cd /usr/src/perl5.005_61/pod
% egrep -i 'time[^ ]*out' *.pod 
Win32.pod:=item Win32::InitiateSystemShutdown(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)
Win32.pod:supplied MESSAGE, within the specified TIMEOUT interval. Forces
perlfaq.pod:=item * How do I timeout a slow event?
perlfaq6.pod:wait for a pattern in the input stream, or timeout if it doesn't
perlfaq7.pod:    timeout( 30, sub { $line = <STDIN> } );
perlfaq7.pod:timeout() function to access the lexical variable $line back in its
perlfaq8.pod:arrange for an alarm handler to provide a timeout (see
perlfaq8.pod:that is, by raising an exception.  See the time-out handler for a
perlfaq8.pod:the section on signals, especially the time-out handler for a blocking
perlfaq8.pod:=head2 How do I timeout a slow event?
perlfunc.pod:	alarm $timeout;
perlfunc.pod:=item select RBITS,WBITS,EBITS,TIMEOUT
perlfunc.pod:      select($rout=$rin, $wout=$win, $eout=$ein, $timeout);
perlfunc.pod:Any of the bit masks can also be undef.  The timeout, if specified, is
perlfunc.pod:$timeleft equal to the supplied $timeout.
perlipc.pod:Signal handling is also used for timeouts in Unix,   While safely
perlipc.pod:using select() to do a timed-out wait for I/O.  To do something similar
perlipc.pod:    # timeout after 10.0 seconds
perlport.pod:=item select RBITS,WBITS,EBITS,TIMEOUT
perltoc.pod:find out if I'm running interactively or not?, How do I timeout a slow
perltoc.pod:=item How do I timeout a slow event?
perltoc.pod:FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT, semctl
perltoc.pod:RBITS,WBITS,EBITS,TIMEOUT, semctl ID,SEMNUM,CMD,ARG, semget
perltoc.pod:mask ( IO [, EVENT_MASK ] ), poll ( [ TIMEOUT ] ), events ( IO ), remove (
perltoc.pod:[ TIMEOUT ] ), can_write ( [ TIMEOUT ] ), has_exception ( [ TIMEOUT ] ),
perltoc.pod:count (), bits(), select ( READ, WRITE, ERROR [, TIMEOUT ] )
perltoc.pod:accept([PKG]), timeout([VAL]), sockopt(OPT [, VAL]), sockdomain, socktype,
perltoc.pod:mask ( IO [, EVENT_MASK ] ), poll ( [ TIMEOUT ] ), events ( IO ), remove (
perltoc.pod:[ TIMEOUT ] ), can_write ( [ TIMEOUT ] ), has_exception ( [ TIMEOUT ] ),
perltoc.pod:count (), bits(), select ( READ, WRITE, ERROR [, TIMEOUT ] )
perltoc.pod:accept([PKG]), timeout([VAL]), sockopt(OPT [, VAL]), sockdomain, socktype,
perltoc.pod:Net::Ping->new([$proto [, $def_timeout [, $bytes]]]);, $p->ping($host [,
perltoc.pod:$timeout]);, $p->close();, pingecho($host [, $timeout]);
-- 
    "A journey of a thousand miles continues with the second step." --Larry Wall


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

Date: 25 Sep 1999 19:26:17 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: cookbook: nonforker
Message-Id: <7sj7kp$bss$1@gellyfish.btinternet.com>

On 23 Sep 1999 18:33:08 +0200 Benjamin Schweizer wrote:
> +-->Rick Delaney <rick.delaney@home.com>:
> | > I´ve got a non forking daemon which is pretty nice. If I mark the
> | > following code as a comment it runs pretty nice, else Perl reports
> | > that IO::Select has no method has_exception.
> | 
> | If you want that method then you should upgrade your version of
> | IO::Select to the one that has that method.  Better yet, upgrade your
> | perl since this is a standard module.
> 
> I´ve upgraded my version from 5.005_2 to 5.005_3, but IO::Select
> doesn´t include "has_exception". What´s going wrong; is IO::Select not
> in the perl.rpm file?

Have you tried installing Perl from the source ?  We have no way of knowing
that the package you installed is correct -  on Linux there is no need to 
install pre-compiled binaries. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 25 Sep 1999 19:20:04 GMT
From: twebster5402@my-deja.com
Subject: HELP Why does the perl CGI choke from '@'
Message-Id: <7sj78r$abo$1@nnrp1.deja.com>

Below is a simple perl script that generates a response html
and emails the form values.  If I try to include a mailto: link
or even just use the '@' character in a print, I get an
InternalServer Error....WHY?  How can I use the '@' character, and
why does the script choke and die when it's there?????


#!/usr/local/bin/perl
#####################################################
# voices0.cgi
#
# AUTHOR: Troy Webster
# DATE: Aug. 1999
#
# This program does the usual CGI processing of strings
# generated by a form of an html page, and then executes
# two responses: 1>  an html page to the user
#                2> email message to acm@pcs.cnu.edu
######################################################

#---------------------generate html response page--------------------

%incoming = &read_input;



print "Content-type: text/html\n\n";
print "<HEAD>
      <TITLE>Thank you for joining the ACM at CNU</TITLE>
      </HEAD>
      <BODY BGCOLOR=WHITE TEXT=BLUE LINK=RED VLINK=BLACK ALINK=BLACK>
      <HR>
      <CENTER><H2><FONT FACE=VERDANA>Your membership registration has
been submitted for
      approval.</FONT></H2>
      <P><FONT FACE=VERDANA>A confirmation notice will be emailed to
you in the next few
      days.</P>
      <P> NOTE... You cannot become an active member until your dues
are received by the ACM.  </P>
      <P> email the treasurer ( emailhere@foo.edu ) to pay your
dues.</P>
      <HR><HR>
      <blockquote>
      ";


#--------------feed array the string values------------------

$firstname = $incoming{'FirstName'};

$author = $incoming{'LastName'};

$street = $incoming{'Homeaddress'};

$city = $incoming{'City'};

$state = $incoming{'State'};

$zip = $incoming{'Zip'};

$country = $incoming{'Country'};

$comments = $incoming{'comments'};

$major = $incoming{'Major'};

$year = $incoming{'Year'};

$live = $incoming{'Live'};

$email = $incoming{'Email'};

$url = $incoming{'Url'};
print "Thank you $firstname $author .";

print "<P><CENTER><IMG
SRC=\"~acm/images/penguin2.gif\" HEIGHT=150 WIDTH=150></CENTER>";

print "<BR><HR><HR><HR></BODY></FONT>";

#---------------------------------------
# generate text file that will be emailed
#----------------------------------------

open(VOICES, '>/home/guest/acm/www/cgi_reg/voices.txt');

print
VOICES "************************************************************\n";
print VOICES"\t\tFrom: ".$firstname."  ".$author."\n\nat address:
\n\n".$street."\n ".$city."\n".$state."\n".$zip."\n".$country."\n\n\n";

print VOICES"Other special comments or
requests.....\n\n".$comments."\n\n\n";
print VOICES"major......".$major."\n\n\n";
print VOICES"year.....".$year."\n\n\n";
print VOICES"Live on campus?....".$live."\n\n\n";
print VOICES"Email address....".$email."\n\n\n";
print VOICES"Web site to be linked......".$url."\n\n\n";

close(VOICES);

`/bin/mailx -s "NEW MEMBER signing on" acm
< /home/guest/acm/www/cgi_reg/voices.txt`;
`/usr/bin/rm /home/guest/acm/www/cgi_reg/voices.txt`;

#----------------------------------------------------------
#Subroutine to read CGI input.
#----------------------------------------------------------

sub read_input
{
    local ($buffer, @pairs, $pair, $name, $value, %FORM);

    $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
    if ($ENV{'REQUEST_METHOD'} eq "POST")
        {
            read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        } else
        {
            $buffer = $ENV{'QUERY_STRING'};
        }

    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs)
    {
        ($name, $value) = split (/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%(..)/pack("C", hex($1))/eg;
        $FORM{$name} = $value;
    }
    %FORM;

}








Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 25 Sep 1999 19:50:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: HELP Why does the perl CGI choke from '@'
Message-Id: <kI9H3.1745$ru1.171806@typ11.nn.bcandid.com>

In article <7sj78r$abo$1@nnrp1.deja.com>,  <twebster5402@my-deja.com> wrote:
>Below is a simple perl script that generates a response html
>and emails the form values.  If I try to include a mailto: link
>or even just use the '@' character in a print, I get an
>InternalServer Error....WHY?  How can I use the '@' character, and
>why does the script choke and die when it's there?????

It's trying to interpolate the array @foo, which doesn't exist.  Quick
hint: get hold of your web server's error log; it will contain an error
message which you can look up in perldoc perldiag; this would have
explained everything.

Also, use '' instead of "" when you don't mean to interpolate.

HTH.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sat Sep 24 1999
44 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 25 Sep 1999 12:50:31 -0700
From: Dan Woods <dwoods@ucalgary.ca>
To: Young-Soo Roh <ysroh@chat.carleton.ca>
Subject: Re: How to password a file?
Message-Id: <7sj5o2$e40@ds2.acs.ucalgary.ca>

Young-Soo Roh wrote:
> If anyone knows the way to solve this problme, please help!!
> 
> I have some files under my public_html and I want them to be somehow only
> downloadable by selected users off the net because I don't want anybody to
> download the file.

You're at a university, so ask around about using .htaccess and .htpasswd
files on Unix to restrict access to directories.  Once setup, a user trying
to go into a .htacess protected directory will be prompted with a popup
window for username and password.  Start with that, do your own research.

I use this method quite well to protect my "family" section to allow my
relatives to see the latest pictures of our kids, or anything else personal.

Thanks...Dan.
http://www.4loops.com


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

Date: 25 Sep 1999 17:26:09 GMT
From: "Paul J. Lucas" <pjl@be-NOSPAM-st.com>
Subject: Re: injecting "my" varibales into caller's scope
Message-Id: <37ed05b1$0$201@nntp1.ba.best.com>

In <DcvG3.940$V7.156747@news.itd.umich.edu> mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:

>The scheme I describe above is probably the most bletcherous I've ever
>conceived, and should not be attempted by anyone.  Why not tell us what
>you're trying to accomplish?  I guarantee you that there's a better way to
>do what you want.

	I want the caller to call some function that executes an SQL
	query.  The callee (the injector) would parse the query,
	specfically the SELECT attributes; it would then use DBI to bind
	the query resuts to "my" variables in the caller's scope.

	Normally, you have to do a SELECT, declare "my" variables, and
	do a bind.  This means you specify the same attributes list 3
	times.  It's ugly, verbose, and error-prone.

	- Paul


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

Date: 25 Sep 1999 11:46:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: injecting "my" varibales into caller's scope
Message-Id: <37ed0a72@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "Paul J. Lucas" <pjl@be-NOSPAM-st.com> writes:
:	I want the caller to call some function that executes an SQL
:	query.  The callee (the injector) would parse the query,
:	specfically the SELECT attributes; it would then use DBI to bind
:	the query resuts to "my" variables in the caller's scope.

Why doesn't your function simply return a hashref, or perhaps take an 
argument which is a hashref to fill out?  You could do what the
Alias::attr() function does, I suppose, but those are still dynamics
not lexicals.

--tom
-- 
    "Perl5, surprisingly, makes it very easy to do OO programming.  I suspect
    that it does this much better than Larry ever intended."
	--Dean Roehrich in <1994Oct5.140720.1511@driftwood.cray.com>


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

Date: 25 Sep 1999 17:40:42 GMT
From: "Paul J. Lucas" <pjl@be-NOSPAM-st.com>
Subject: Re: injecting "my" varibales into caller's scope
Message-Id: <37ed091a$0$225@nntp1.ba.best.com>

In <37ea8988@cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:

>In comp.lang.perl.misc, "Paul J. Lucas" <pjl@best.com> writes:

>> P.S.: E-mail replies preferred; remember to despam my address.

>That's your job, not mine.  Don't post such stupid addresses.
>You're giving in the criminals.  Stop that.  Fight them.

	First off, using such addresses is not giving in.  A person can
	use such addresses and fight them similtaneously.  I *still* get
	spam back from the days when I didn't use a spam-proof address,
	so I have plenty of spam to fight.  Opening myself up to more
	"on principle" does nothing for me.

	I used to vigorously fight spam.  Know what?  It didn't make a
	damned bit of difference.  I realize that I have better things
	to do with my time than to take the dozen or so spam e-mail
	messages that arrive in my mailbox over night, expand their
	headers, do nslookups, traceroutes, and send mail to ISPs who
	ignore them anyway.  The amount of spam hasn't decreased one
	bit.  Now I simply have elaborate mail filters in place
	(written in Perl, BTW).  I took the time to write the code
	*once*; now I can get a lot more done in a day without spending
	time fighting spam.

	California recently enacted a "no spam" (civil) law.  Has
	anything changed?  Nope.  Unless ISPs and people are going to
	take the time to haul offenders into court, nothing will
	change.  Have you got that kind of time?

	How many spammers have you hauled into court?  If the answer is
	"zero" then you're full of yourself.  Sure, you make yourself
	feel good by proclaiming to fight spam; you may even support a
	few anti-spam groups and have cute little "fight spam" icons on
	your home page.  Does it actually change anything?  Nope.

	Why don't you go go charge some windmills?

	- Paul


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

Date: 25 Sep 1999 12:07:04 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: injecting "my" varibales into caller's scope
Message-Id: <37ed0f48@cs.colorado.edu>

In comp.lang.perl.misc, 
    "Paul J. Lucas" <pjl@best.com> writes:
:>> P.S.: E-mail replies preferred; remember to despam my address.
:>That's your job, not mine.  Don't post such stupid addresses.
:>You're giving in the criminals.  Stop that.  Fight them.

:	Does it actually change anything?  Nope.

:	Why don't you go go charge some windmills?

I don't hide behind address mungeing, and I expect others to do likewise.
I have RBL sendmail hooks.  These kill about 20 messages per day.  I have
elaborate perl filters: these kill an additional 15 messages per day.
I get about five or so per week that sneak through.  BFD.  It doesn't
happen more than once.  This is a small price to pay for being part 
of the community.

I will not answer anyone with a bogus address.  Period.  If you expect
an answer, don't screw up your address.  Apparently my killfile was not
working as well as I'd expected it to, since I thought I was killing
on spam anywhere in the address.  Apparently it's fullname only, not
address.  I'll go back to killing the whole thing.  If you expect an
answer, stand up and take your lumps.  This is a public forum.  Post a
legal address, or don't post.  And certainly don't expect other people
to bend over backwards because of you.  Illegal addresses are ILLEGAL.
They can be dropped on the floor.  And should be.

It's like the income tax.  Income tax withholding is idiotic.  There
should be no withholding.  Everyone should pay up at the end of each
month or quarter, and in fivers.  Stop hiding from the problem.

I am very seriously considering resurrecting my page of bogus addresses
and their corrected translations and periodicly post on the web and
here all the correct addresses by people who munged to this group,
perhaps weekly.  Don't post illegal addresses.  Take it like a man.

--tom

-- 

    ObSig: Please don't spam pjl@best.com
-- 
    That means I'll have to use $ans to suppress newlines now.  
    Life is ridiculous. 
        --Larry Wall in Configure from the perl distribution


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

Date: Sat, 25 Sep 1999 18:24:48 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: interpolation question
Message-Id: <1106_938283888@prague_main>

On Fri, 24 Sep 1999 13:01:48 -0700, cLive hoLLoway <cLive@direct2u.co.uk> wrote:
> Well, I'm stumped. Looked around and can't find an answer....
> 
> How do I interpolate a variable into a string that is followed
> immediately by another alphanumeric???
> 
> eg,
> 
> $word = 'wonder';
> 
> $newword = "$wordful":
> 
> so that $newword is 'wonderful';
> 
> ....and no, $word.'ful' is not the answer!

"${word}ful"

:-)

Jenda
http://Jenda.Krynicky.cz



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

Date: Sat, 25 Sep 1999 18:31:38 GMT
From: mike cardeiro <mikecard@my-deja.com>
Subject: Re: Need a unique "ID" string
Message-Id: <7sj4eb$8db$1@nnrp1.deja.com>

In article <7sik0c$9ou$1@winter.news.rcn.net>,
  "The Smiths" <smiths@erols.com> wrote:
> I need to generate a unique numeric string that gets recorded each
time my
> PERL cgi is invoked.


this is how i have solved that problem.  I made a psudo web counter
(with a little help from the faq)  but instead of using it to make a web
counter i just use the numbers as unique numbers ( i have it set to
reset at 10,000...i don't imagine i will ever have that many visitors in
a short period of time but you could make it higher.  here's the code

$id = new_id();
sub new_id {

	use Fcntl qw(:DEFAULT :flock);
	sysopen(NUTS, "../nuts", O_RDWR|O_CREAT) or die "no nuts: $!";
		$ofh = select(NUTS);
		$| = 1;
		select ($ofh);
		flock(NUTS, LOCK_EX)
			or die "no lockie: $!";
		$f_name = <NUTS> || 0;

		++$f_name;
		if ($f_name > 10000) {
			($f_name = 1);
		}
		seek(NUTS, 0, 0) or die "can't getto top of file: $!";
		print NUTS $f_name, "\n"
			or die "can't write: $!";
		truncate(NUTS, tell(NUTS))
			or die "no truncate: $!";
		return ($f_name - 1);
	}


mike cardeiro


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 25 Sep 1999 13:24:29 -0700
From: Dan Woods <dwoods@ucalgary.ca>
To: Neil <neil@pacifier.com>
Subject: Re: Perl - CGI -MySQL
Message-Id: <7sj7nk$e40@ds2.acs.ucalgary.ca>

> > Where is the MySQL newsgroup? I searched deja.com before I posted here,
> > but could not find such a newsgroup.
> 
> There is an incredibly helpful Mysql mailing list that you might consider.
> Send a message to mysql-subscribe@lists.mysql.com and join the list. There
> your question will not be off topic.
> Neil

Or you can find variations to different MySQL mailing lists at...
	http://www.mysql.com/doc.html

Thanks...Dan.
http://www.4loops.com


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

Date: 25 Sep 1999 19:30:58 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and Ms Personnal Web server
Message-Id: <7sj7ti$bt0$1@gellyfish.btinternet.com>

On Sat, 25 Sep 1999 10:19:38 -0400 Tom Kralidis wrote:
> Try IIS, it works great with Perl.
> 
> Configuration help: go to:
> 
> http://www.activestate.com/support/faqs/win32/perlwin32faq6.html
> 

Thats fine but this group is not the one you want to be talking about
various HTTP servers ...

[followups set]

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 25 Sep 1999 18:53:51 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: PERL GUI Handlers for Winblows 95/98/NT ...
Message-Id: <1108_938285631@prague_main>

On Wed, 22 Sep 1999 13:23:51 -0400, Kevin Genus <genus@ems.att.com> wrote:
> Do any modules exist that would allow perl to do some of the same
> functions as Winbatch for automation?
> Specifically, things like grabbing a window, issuing key strokes, etc...
> 
> Kevin Genus
> AT&T

Win32::Setupsup : see http://Jenda.Krynicky.cz/perl/Setupsup.pm.txt


Install via 

 c:\> PPM install --location http://Jenda.Krynicky.cz/perl/ Win32-Setupsup

HTH, Jenda
http://Jenda.Krynicky.cz



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

Date: 25 Sep 1999 19:55:57 GMT
From: mdz4c@node6.unix.Virginia.EDU (Matthew David Zimmerman)
Subject: Re: sorting like numbers an array of strings
Message-Id: <7sj9cd$298$1@murdoch.acc.Virginia.EDU>

In article <H%dG3.4085$QJ.252254@typ11.nn.bcandid.com>,
Kragen Sitaker <kragen@dnaco.net> wrote:
>
>Somebody really should code this particular example up into a benchmark.

Okay, I guess I'll do my part for the good of the clpm community. (One
note: I'm running this on one of my university's AIX RS/6000's. It's a
great computer for checking your email, but for selected computational
tasks, it can be mind-numbingly slow.) I haven't included Larry and Uri's
packed-default sort, because I don't really understand it. (Yet.) But cut
me some slack-- I'm just a biochemist.

#####
#!/usr/bin/perl -w

use strict;
use Benchmark;

print "4 data points:\n";
do_timethese(10000, makedata(4));
print "100 data points:\n";
do_timethese(1000, makedata(100));
print "100000 data points:\n";
do_timethese(10, makedata(100000));

sub do_timethese {
  my $count = shift;
  my @data = @_;
  timethese($count,
    {
    "schwartz" => sub { map  { $_->[0] }
                        sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] }
                        map  { [ $_, (split /\s*,\s*/)[0,1] ] }
                        @data;
                      },
    "simple"   => sub { join ("\n", sort {
                           my ($a1, $a2) = split /\s*,\s*/, $a;
                           my ($b1, $b2) = split /\s*,\s*/, $b;
                           return $a1 <=> $b1  or $a2 <=> $b2;
                        } @data );
                      }
    }
  );
  return;
}

sub makedata {
   my $count = shift;
   my @lines;

   for (my $i = 0; $i <= $count; $i++) {
      push @lines, (sprintf "%2i , %2i , randomtext\n", int(50*rand), 
                   int(100*rand));
   } 

   return @lines;
}
#####

-----
4 data points:
Benchmark: timing 10000 iterations of schwartz, simple...
  schwartz: 11 secs ( 6.01 usr  0.52 sys =  6.53 cpu)
    simple: 10 secs ( 6.49 usr  0.53 sys =  7.02 cpu)
100 data points:
Benchmark: timing 1000 iterations of schwartz, simple...
  schwartz: 21 secs (15.03 usr  0.73 sys = 15.76 cpu)
    simple: 56 secs (53.71 usr  0.04 sys = 53.75 cpu)
100000 data points:
Benchmark: timing 10 iterations of schwartz, simple...
  schwartz: 319 secs (275.63 usr  4.54 sys = 280.17 cpu)
    simple: 740 secs (671.65 usr  4.35 sys = 676.00 cpu)
-----

HTH! Matt
-- 
Matthew Zimmerman ------------  http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program --------- University of Virginia
| "You got to be very careful if you don't know where you're going, |
| because you might not get there."                   -- Yogi Berra |


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

Date: 25 Sep 1999 12:13:32 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: tom c.: pmtools download is broken
Message-Id: <x7aeqb2clv.fsf@home.sysarch.com>


someone repost this so tom sees it. he is still killfiling me even after
he told me at the conference he would change that.

http://mox.perl.com/misc/pmtools-1.00.tar.gz

that file is a broken gnuzip file. i get a crc error with it.
the size i download is 24066. this is both with
netscape and GET so it is not a HTTP problem.

this is linked to from perl.com and purl on #perl references the same
url.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sat, 25 Sep 1999 18:22:23 +0200
From: cw@dwc.ch
Subject: Re: tom c.: pmtools download is broken
Message-Id: <37ECF6BF.EBA93501@dwc.ch>

Uri Guttman wrote:
> 
> someone repost this so tom sees it. he is still killfiling me even after
> he told me at the conference he would change that.
> 
> http://mox.perl.com/misc/pmtools-1.00.tar.gz
> 
> that file is a broken gnuzip file. i get a crc error with it.
> the size i download is 24066. this is both with
> netscape and GET so it is not a HTTP problem.
> 
> this is linked to from perl.com and purl on #perl references the same
> url.
> 
> uri
> 
> --
> Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
> uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
> Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
> The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sat, 25 Sep 1999 13:52:31 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: weekly update suggestions
Message-Id: <7sj9c6$91s@ds2.acs.ucalgary.ca>

I have a need to rotate a web page "once a week" only,
like a 'special of the week'.  I have no problem with
a perl script (or ksh) to do this if I can use cron
jobs. However, this user uses a host provider that 
does not do that.  I prefer to NOT have a link on a
web page that calls a Perl/CGI which tests the date
and then decides if it needs to be rotated (with
some flag added to a file to record it was done).
Besides this is a lot of pointless overhead.

Can you think of any way to for a Perl script to
do this weekly without cron jobs, no telnet 
access, and avoid using CGI ?

Thanks...Dan.
http://www.4loops.com


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

Date: 25 Sep 1999 10:57:28 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: why "system" can not be used in the CGI/Perl?
Message-Id: <m1k8peq3g7.fsf@halfdome.holdit.com>

>>>>> "Jonathan" == Jonathan Stowe <gellyfish@gellyfish.com> writes:

Jonathan> Does your program 'a' produce any output to STDOUT ?  If so
Jonathan> it probably wants to be within your HTML tags.

Jonathan> You really should also check the $? variable after the
Jonathan> system() to determine its success (or not) - read the
Jonathan> perlfunc entry for system for more on this.

Jonathan> Also are you sure that the program *is* in the CGI program's
Jonathan> current working directory ?  Have you tried supplying the
Jonathan> full path to the program ? Of course this might be blown up
Jonathan> if your program is running in a chroot environment - you
Jonathan> will need to talk to the administrator of the system about
Jonathan> that.

All good advice, and one additional point:

If buffering is on (which it is, by default), the child
process could appear to output stuff in the "wrong" order.

Solution: either use backquotes and print:

	print `child process goes here`;

or unbuffer STDOUT at the beginning of the program:

	$|++;

-- 
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: Sat, 25 Sep 1999 19:24:44 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: why does strict not warn about shaddowing declarations ?
Message-Id: <0k9H3.1681$ru1.156503@typ11.nn.bcandid.com>

In article <938260249.889037@clint.waikato.ac.nz>,
Stuart Yeates  <syeates@manuka.cs.waikato.ac.nz> wrote:
>of course what happens is that one declaration shaddows the other, 
>so the $Y that gets written to is the inner one not the outer one.
>
>is there a good reason why strict doesn't scream about this ?

The whole point of lexical variables -- indeed, of local variables in
general -- is that you can decide whether a certain piece of your
program works without reference to its environment.  You know that
changes you make elsewhere in the code will not make it stop working
correctly.  You know you can transplant it into a different program, or
call it from a different part of the same program, without it ceasing
to work.

Having several of your functions suddenly fail to compile when you add
a new global variable is somewhat in opposition to this principle.

I once thought that warning or dying on shadows would be a good idea.
I think I was wrong.

DrScheme has a nifty feature which would have helped you find that bug
-- whenever you move the mouse pointer over a variable reference in the
source code editor, an arrow appears connecting the variable reference
to the declaration to which it refers.  (Of course, it works with
Scheme, not Perl.)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 23 1999
46 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 25 Sep 1999 18:37:10 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: Windows NT 4.0 Scripting
Message-Id: <1107_938284630@prague_main>

On Fri, 24 Sep 1999 18:29:19 GMT, dpekkarinen@latinschool.org wrote:
> I want to create a script which will edit permissions on a multitude of
> directories (each directory with a unique set of permissons). Has anybody
> tried this before?

Sure.

You need Win32::Perms : http://www.roth.net/perl/perms/

Jenda
http://Jenda.Krynicky.cz



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

Date: Sat, 25 Sep 1999 17:32:44 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: You should be admired
Message-Id: <1104_938280764@prague_main>

On Thu, 23 Sep 1999 12:52:27 -0400, Elaine -HFB- Ashton <elaine@chaos.wustl.edu> wrote:
> Henry Penninkilampi wrote:
> > the argument?) and tried to have a go at me instead.  I responded by
> > isolating her behavioural problem and delivered it to her on the end of a
> > sharp tongue.  That had the desired effect - it shut her up and put her
> > back in her place (for now).
> 
> As an academic curiosity, would you have done the same if she were a he?
> I ask because there has been some speculation as to why there are so few
> women in the Perl community who are active participants. 
> 
> Either way, I'm curious because of the way you worded it 'put her back
> in her place' as this is generally a chauvenistic boast.

Blah, blah, blah.

A bit too much time spent with AFBs? 

Chauvenistic? Get real, honey, there's no male plot anywhere. 
If you believe so you'd better see a doctor.

There is NO antifemale sentiment in here, it's not our fault there are so few of them. 
They simply are not interested, what are we to do about it?

"put her back in her place" ... I realy do not think he meant kitchen, or whatever
those feminists keep saying we mean.

I realy hate it when some AFB tries to put us all down with these malehating statements.

> e.

Jenda, conversely to popular belief MALE
http://Jenda.Krynicky.cz

Wow, did we drift quite far from the original topic, didn't we? Not that I know what it was.



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

Date: Sat, 25 Sep 1999 18:00:41 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: You should be admired
Message-Id: <1105_938282441@prague_main>

On Sat, 25 Sep 1999 19:18:08 +0930, spamfree@metropolis.net.au (Henry Penninkilampi) wrote:
> In any case, if such a suggestion *is* being made about 50 times a year,
> then that sounds like an *awful lot of people* who want to change the way
> this group works.  Rather than constantly defending the status quo, have
> you ever *seriously* contemplated just letting 'them' have their way?

Well, the question is "Would it help?"
I dunno. 

For if all gurus and seasoned Perlers move to comp.lang.perl.gurus who will answer the questions in 
comp.lang.perl.newbies ? So the newbies would shortly follow.

Even if there stayed some people in ...perl.newbies how do you know if your question 
is easy or hard? How do you know if you need a guru or not? The question is hard for you, 
otherwise you would not ask. So you will go and post in ...perl.gurus immediately, just to be sure
you get the best.

I'm afraid if we'd split the group this way, we would end up with an empty ...perl.newbies
and ...perl.gurus would look the same ...perl.misc does now.

> No matter how much you help, no matter how much you know, no matter how
> hard you try, no matter how much time you spend, you can't withstand the
> flood forever.  Eventually you'll burn out and get swamped.  A short fuse
> is evidence that you are already on your way.

Sure. Did you see Larry here lately? 

So we should try to lessen the load for real gurus and answer what we can 
(of course we should test our suggestions, even if we think we know what are we saying)

I understand why some loosers get flamed, I do it now and then myself. 
Because, it's sad to have to say that, sometimes it's necessary.

> Hey, it's your call.  It's your time.  It's also your health.  Do what you will.
> 
> Henry.

Jenda
http://Jenda.Krynicky.cz



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

Date: Sat, 25 Sep 1999 17:11:16 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: You should be admired
Message-Id: <slrn7upusv.1c4.*@dragons.duesouth.net>

On Sat, 25 Sep 1999 19:18:08 +0930, spamfree@metropolis.net.au (Henry
Penninkilampi) enriched us with: 
: In article <slrn7uolme.faj.abigail@alexandra.delanet.com>,
: abigail@delanet.com wrote:
: > Have you ever read this group? Your suggestion is being made, oh, 
: > about 50 times a year.
[snip]
: So, I've been actively 'reading' this group for about two years and this
: is the first time I've ever stumbled across the issue.  Either I have been
: amazingly un/lucky, or the threads that discuss the issue don't have
: interesting subject lines (to me, that is), or you are exaggerating the
: frequency.

Hell no.  If nothing else, Abigail is being conservative in her estimate.

I would have said closer to 52 times per year.

: In any case, if such a suggestion *is* being made about 50 times a year,
: then that sounds like an *awful lot of people* who want to change the way
: this group works.  Rather than constantly defending the status quo, have
: you ever *seriously* contemplated just letting 'them' have their way?

We have.  Common example of why this won't work is alt.unix.wizards.  Try
searching for that in clpm.

: No matter how much you help, no matter how much you know, no matter how
: hard you try, no matter how much time you spend, you can't withstand the
: flood forever.  Eventually you'll burn out and get swamped.  A short fuse
: is evidence that you are already on your way.

The problem is not that we don't have enough separation in our groups,
but that we have a bunch of clueless people posting here.  The clueless
will NOT respect the group splitting.

: Henry.

--Matthew


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

Date: 25 Sep 1999 10:32:02 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: You should be admired
Message-Id: <ylu2oiganh.fsf@windlord.stanford.edu>

Henry Penninkilampi <spamfree@metropolis.net.au> writes:

> Has anyone ever considered CFDing [comp.lang.perl.worthy] and (veteran
> Perl users) moving serious discussions to that group?

The only way you can do this and enforce it is to moderate the group.  We
did that.  comp.lang.perl.moderated is about as close to that sort of
group as you can get (questions from new Perl programmers are certainly
allowed, but FAQs and non-Perl questions aren't posted so what's left are
fairly high-quality questions).  If you want a newsgroup without those
sorts of posts (and the responses to and flames of them), read that group
instead.

> That would give carte blanche to Abigail (et al) to shred those that
> stray off the yellow brick road.

Abigail didn't like comp.lang.perl.moderated, for whatever reason.

> It would also lighten the tone in *this* newsgroup, which would make it
> more appealing to newbies.

It didn't seem to work.  The only conclusion that I can draw is that there
are people posting to this group who enjoy yelling at and being rude to
people who ask stupid questions but have no intention of trying to avoid
said questions.

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


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 907
*************************************


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