[13201] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 611 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 21 21:07:14 1999

Date: Sat, 21 Aug 1999 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 21 Aug 1999     Volume: 9 Number: 611

Today's topics:
        Can someone take a look at this? <splinter@monmouth.com>
    Re: Can someone take a look at this? (Bill Moseley)
    Re: Can someone take a look at this? <makkulka@cisco.com>
    Re: CGI.pm or here document for html <makarand_kulkarni@my-deja.com>
    Re: Creating a perl extension. (Abigail)
        Database manipulation Problems... Deleting a Line <webmaster@razorprices.wcq.com.au>
    Re: finding a running process on NT <carvdawg@patriot.net>
    Re: Help reading comma-separated values from file <bwalton@rochester.rr.com>
        Is there a similar Perl command to C's gotoxy? <akirby@cableregina.com>
        matching <jcorbin@apci.net>
    Re: matching (Scott Erickson)
        more regular expression questions (Bill Moseley)
    Re: more regular expression questions <bwalton@rochester.rr.com>
    Re: Newbie : tr/// question (Abigail)
        Permission problems: writing/running a .bat file via pe <pearse@drkoop.com>
    Re: qx(), WinNT, and another Perl script <bwalton@rochester.rr.com>
    Re: Request for Comments: www.perl.com (Abigail)
    Re: Shell vs Perl (Alan Barclay)
    Re: Split comp.lang.perl.misc (Abigail)
    Re: taint checking code, not data (Abigail)
    Re: Time as per IST?? (Abigail)
    Re: User session ID? <makkulka@cisco.com>
    Re: Why $|++ (was: Re: perl system()) (Abigail)
    Re: Why $|++ (was: Re: perl system()) (Abigail)
    Re: Why use Python when we've got Perl? <xah@best.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 21 Aug 1999 19:33:27 -0400
From: "Matt" <splinter@monmouth.com>
Subject: Can someone take a look at this?
Message-Id: <7pncvj$opl$1@news.monmouth.com>

Hi,

Could someone go to this address and analyze what happens when you try to
upload a file or image....

http://www.monmouth.com/~splinter/brians/upload.htm

You'll probably see that it doesn't upload anything...web browser or the
script?

The script can be downloaded at:

http://www.monmouth.com/~splinter/cgi-bin/upload1.pl

Thanks for any help..

-Matt




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

Date: Sat, 21 Aug 1999 16:53:02 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Can someone take a look at this?
Message-Id: <MPG.1228dbbc550eb76e9896ce@nntp1.ba.best.com>

Matt (splinter@monmouth.com) seems to say...
> Could someone go to this address and analyze what happens when you try to
> upload a file or image....
> http://www.monmouth.com/~splinter/brians/upload.htm
> The script can be downloaded at:
> http://www.monmouth.com/~splinter/cgi-bin/upload1.pl

Sounds like a contract to me.

Sure.  But on a Saturday, wow, that's expensive.

The clock is ticking....

Please read a few CGI faqs and check out the CGI news groups.  When you 
find the perl code that isn't running, well, check back then.

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 21 Aug 1999 16:56:16 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Can someone take a look at this?
Message-Id: <37BF3CA0.E23CD6BF@cisco.com>

[ Matt wrote:

> The script can be downloaded at:
> http://www.monmouth.com/~splinter/cgi-bin/upload1.pl
>

Make sure that $SAVE_DIRECTORY has permissions
so that that script can create and write to a file here.
--



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

Date: Sat, 21 Aug 1999 23:13:14 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: CGI.pm or here document for html
Message-Id: <7pnbq4$9j5$1@nnrp1.deja.com>

[In article <37B8573E.34CA2782@gethits.com>,
  support@gethits.com wrote:
> I've been using here documents for html in my perl
> scripts which has been pretty convenient and
> malleable in the past. I'm considering converting
> to CGI.pm to generate web documents, but I'm
> wondering if it's worth it.
]

There is a good article by Randal Schwartz "Converting HTML
to CGI.pm" published in WebTechniques magazine October 1998.
You may want to read that and try converting some of your
HTML to CGI.pm calls using the code there and decide for
yourself. You might find this article in the archives
at www.WebTechniques.com.

--Makarand


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 21 Aug 1999 19:00:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Creating a perl extension.
Message-Id: <slrn7rufdn.c9p.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXXX September
MCMXCIII in <URL:news:37BDE726.14C93DD6@mail.cor.epa.gov>:
{} Arved Sandstrom wrote:
{} > 
{} > In article <37BDB6F2.BC6917BE@anlon.com>, Kangas <kangas@anlon.com> wrote:
{} > 
{} > > Where is the best place for some documentation on creating a perl
{} > > extension. I don't care if all it does is print 'Hello, World.'. I just
{} > > want to try it.
{} > >
{} > The 'perlxstut' manpage. This will get you started.
{} 
{} Hmm.  I guess it's a good thing I didn't answer Mike's post,
{} because this was totally different from what *I* thought he 
{} was asking.


That's why postings are first send to Arved before they get to you.



Abigail
-- 
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} #  Yet Another silly JAPH by Abigail
sub A::FETCH     {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 22 Aug 1999 10:27:57 +1000
From: David Rugendyke <webmaster@razorprices.wcq.com.au>
Subject: Database manipulation Problems... Deleting a Line
Message-Id: <37BF440D.DBBF4797@razorprices.wcq.com.au>

Hi All,

Ive recently downloaded a search engine script which ive been editing
for a while to add extra features. Until recently things were running
pretty smoothly, then I tried to code a new routine that would allow the
script to replace an existing extry if that URL already existed so that
it would 'update' the url by replacing the old URL with the new. At the
moment the script only recognises a duplicate URL and rejects it instead
of updating it.

I've tried several methods to get it to update but with no success, any
help on this database manipulation would be really welcomed. Below is
the current code that the search engine uses to recognise a duplicate
URL and reject it... how do I get it to update instead??

opendir(DIRECTORY, "data") || die "Can't open Database Directory";
 @datafiles = readdir(DIRECTORY);
 foreach $datafile (@datafiles){
  open(FDB, "data/$datafile");
  @dataentries = <FDB>;
  close(FDB);
  $founddup = grep(/\|\|$url\|\|/i, @dataentries);
  if($founddup > 0){&error("Sorry but your URL has already been
recorded.");}

Well thats it. Advanced thank you's to any replies :)

Regards,

David.



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

Date: Sat, 21 Aug 1999 19:55:08 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: finding a running process on NT
Message-Id: <37BF3C5B.37CF46CB@patriot.net>


Check out Win32::IProc at:

http://www.generation.net/~aminer/Perl/





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

Date: Sat, 21 Aug 1999 21:05:12 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help reading comma-separated values from file
Message-Id: <37BF4CC8.36D50C94@rochester.rr.com>

DC wrote:

> Please don't direct me to Text::CSV.  I'd like to use my own routine unless
> it's not possible.
>
> I have a data file called "testpost" which contains many values, each
> separated by a comma.  The end of each line of values contains a newline
> "\n" character.  I am attempting to read in a line of values, store them in
> an array, and then pop them off and do something with them.
>
> How can I read in only one line at a time and do something with the array of
> values, and then have it read in another line of values and do something
> with that line of comma-separated values, until all lines have been read in
> and processed?
>
> Here's what I have worked on so far.
>
> #!/usr/bin/perl -w
>
> open (INFILE, "testpost");

Dan, be sure to check that the open worked with something like:

open INFILE,"testpost" or die "Oops, $!\n";

or

open(INFILE,"testpost") or die "Oops, $!\n";

>
> while ( $line = <INFILE> ) {
>     chomp $line;
> @fields = split (/,/), $line;

Should be:

@fields = split /,/,$line;

or

@fields = split(/,/,$line);

>
> # do something in here with the values stored in @fields
> # then loop back up and grab another line of values and stick it in @array
> }
> close (INFILE);
>
> The testpost file looks something like this:
>
> Name,dan,Address,123 center Street,City,Tulsa,state,,zip,,
>
> The line length is not known, so there may be two values on the line, or
> there may be 50.
>
> thanks in advance..
>
> dan :)

Bob Walton



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

Date: Sat, 21 Aug 1999 17:29:30 -0600
From: "Anthony Kirby" <akirby@cableregina.com>
Subject: Is there a similar Perl command to C's gotoxy?
Message-Id: <37bf43c7.0@204.83.142.253>

I was wondering if there was a command that would allow me to move the caret
(block curser) in a ascii environment to a specific place on the screen?
    I am currently re-drawing all 24 lines in order to move the curser from
the bottom of the screen, to the top.

Anthony.
akirby@cableregina.com




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

Date: Sat, 21 Aug 1999 18:27:05 -0500
From: "John Corbin" <jcorbin@apci.net>
Subject: matching
Message-Id: <37bf369e.0@queeg.apci.net>

I am trying to pick apart a string that will contain a date in it formattted
as this

12:16 PM 8/9/99

So I need to convert the date to YYMMDD format and I thought I could do
something like:

$month_temp=~/[0-9]\//)

to get it into $1 for the month field and $2 should have the day field, but
its not working :( Could someone skool me in the matching that I am fouling
up?


--
John
jcorbin@apci.net
biggunn@stomped.com






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

Date: Sat, 21 Aug 1999 18:47:22 -0500
From: scottle@stribmail.com (Scott Erickson)
Subject: Re: matching
Message-Id: <scottle-2108991847220001@ddsl1-17.ddsl.mr.net>

In article <37bf369e.0@queeg.apci.net>, "John Corbin" <jcorbin@apci.net> wrote:

One solution is to use split.


my($time, $ampm, $date) = split ' ', $string;
my($month, $day, $year) = split /\//, $date;


> I am trying to pick apart a string that will contain a date in it formattted
> as this
>
> 12:16 PM 8/9/99
>
> So I need to convert the date to YYMMDD format and I thought I could do
> something like:
>
> $month_temp=~/[0-9]\//)
>
> to get it into $1 for the month field and $2 should have the day field, but
> its not working :( Could someone skool me in the matching that I am fouling
> up?


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

Date: Sat, 21 Aug 1999 16:46:44 -0700
From: moseley@best.com (Bill Moseley)
Subject: more regular expression questions
Message-Id: <MPG.1228da3cdb1059589896cd@nntp1.ba.best.com>

I've got a basic search and replace program.

It reads the s/// patterns from a file and places them in a hash called 
%replace.  The file has a fixed delimiter between the search and replace 
parts so I can easily load the hash.

In my s/// string I use the single quote -- I don't want variable 
interpolation within the program.  

The problem is if a pattern I read from the file has a single quote then 
the pattern in my program is terminated at the wrong place.

I've just spent quite a bit of time in perlop and perlre and seem to be 
missing something important.

Here's how I build my s/// expressions:

my @substitutions = map { "s'$_'$replace{$_}'go" } keys %replace;

And this is how I do my actual substitutions:

foreach my $expr ( @substitutions ) {
   if ( eval $expr ) {
        $changed_lines++;
                     
        printf(LOG '%04d:%s', $line, $old_line );
        print( LOG "    :$_\n" )
   }
}

I don't want to blindly use \Q as I want the expressions to be able to 
use metachars.

What am I doing wrong?

BTW -- isn't there a \I type metachar to say ignore case in this 
pattern?  I'd like to be able to say ignore case on only some of the 
patterns in the input file.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 21 Aug 1999 20:38:54 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: more regular expression questions
Message-Id: <37BF469E.16E14705@rochester.rr.com>

Bill Moseley wrote:

> I've got a basic search and replace program.
>
> It reads the s/// patterns from a file and places them in a hash called
> %replace.  The file has a fixed delimiter between the search and replace
> parts so I can easily load the hash.
>
> In my s/// string I use the single quote -- I don't want variable
> interpolation within the program.
>
> The problem is if a pattern I read from the file has a single quote then
> the pattern in my program is terminated at the wrong place.
>
> I've just spent quite a bit of time in perlop and perlre and seem to be
> missing something important.
>
> Here's how I build my s/// expressions:
>
> my @substitutions = map { "s'$_'$replace{$_}'go" } keys %replace;

Bill, you'll have to backslash quote any ' characters that appear in your
regular expression, since ' is your delimiter.  Here is one way to do it:

@substitutions=map{s/'/\\'/g} @substitutions;


>
> And this is how I do my actual substitutions:
>
> foreach my $expr ( @substitutions ) {
>    if ( eval $expr ) {
>         $changed_lines++;
>
>         printf(LOG '%04d:%s', $line, $old_line );
>         print( LOG "    :$_\n" )
>    }
> }
>
> I don't want to blindly use \Q as I want the expressions to be able to
> use metachars.
>
> What am I doing wrong?

See above

>
> BTW -- isn't there a \I type metachar to say ignore case in this
> pattern?  I'd like to be able to say ignore case on only some of the
> patterns in the input file.
>

Use the (?i) to turn on case insensitivity within a pattern, and (?-i) to
turn it off.  See perlre for documentation.

>
> --
> Bill Moseley mailto:moseley@best.com
> pls note the one line sig, not counting this one.

Bob Walton



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

Date: 21 Aug 1999 18:23:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Newbie : tr/// question
Message-Id: <slrn7rud8g.c9p.abigail@alexandra.delanet.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXX September
MCMXCIII in <URL:news:7pjuj3$a1v$1@lublin.zrz.tu-berlin.de>:
!! 
!! Hmmm...  I was going to say
!! 
!!      tr/ \t\n\r\f/|/s;
!! 
!! is more efficient, but it ain't so.  In fact I find no difference when
!! "\s" characters are rare.  When they're frequent, and hence a lot of
!! string-shortening is going on, the s/// version is faster by a factor
!! of 3, probably because s/// has an optimized substitution operation.
!! 
!! I still don't like to engage the huge regex machinery for what a
!! lightweight like tr/// can do, but occasionally it pays.


You forgot to mention that s/\s+/|/g doesn't require you to remember
or lookup what \s stands for.



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 22 Aug 1999 00:53:06 GMT
From: "Robert Eric Pearse" <pearse@drkoop.com>
Subject: Permission problems: writing/running a .bat file via perl under IIS
Message-Id: <SRHv3.5170$L96.2938788@typhoon1.austin.rr.com>

hi,

[i apoligize in advance for my cross posting. this problem seems to span
both configuration managment, perl and iis issues. tia.]

i've built a web application that pulls files from Visual SourceSafe based
on the file name and label. user input files, labels, comments, etc. into a
web form that stores the data in SQL Server. when we want to test or deploy
the files (typically asp and graphics) we just hit a submit button and the
files are placed in a build directory.

in effect, the user will pass a list of files and a label to a perl script.
the perl script then creates a .bat file and then runs it like so:

$result = `$batfile > $output 2>&1`; #parse $output and make sure it got all
the files.

the problem is that the web server (devadmin01) sits on a different server
then the SourceSafe database (devwenb01). i am unable to get access to the
shared directory that holds the SourceSafe db with the current web
configuration.

i created a simple perl script to test this. and it always gives me "Access
Denied". i also found a win32 version of "whoami". and guess what. . .the
user the script runs as is "SYSTEM".

i guess the question is "how do i make the perl script run as another user
then SYSTEM?" is the problem with IIS or is it with the perliis.dll from
ActiveState?

i tried to change the user that IIS runs as in the Services applet, but it
seems that System Account is my only option. keep in mind that i've mapped
this web to the default SiteSever Membership Instance. i did this to sniff
for user names automatically based on their domain logon.

also, putting the web server on the same machine as the ss db is an option.
but i would like to keep them seperate. i give our developers free reign in
the dev environment -- if i place this app on the same machine, i'd have to
lock it down.

thanks,

robert pearse
systems configuration manager
pearse@drkoop.com




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

Date: Sat, 21 Aug 1999 20:52:05 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: qx(), WinNT, and another Perl script
Message-Id: <37BF49B4.E9CE698C@rochester.rr.com>

SCLunapark wrote:

> I'm a bit puzzled by the use of qx() on Windows NT (and, unfortunately, I'm
> stuck with NT in this instance) with ActiveState Perl, Build 518. To
> troubleshoot a more complicated program, I distilled what I'd like to do to a
> pair of Perl scripts. Pipe.pl is meant to launch display.pl (the arbitrarily
> named, stripped-down test scripts I wrote), collect it's output, and send it to
> the screen. Here's the code for the two programs (stored, of course, in
> separate files):
>
> pipe.pl:
>         print "Here we go...\n";
>
>         $output = qx(display.pl);

Shaun, try:

$output = qx(perl display.pl);

That works, assuming Perl is on your path.  Win32 in all its flavors has a pretty
braindead command shell.  You might improve things by using Cygwin's bash shell
instead.

>
>         print "$output\n";
>
> display.pl:
>
>         print "This is the output of display.pl\n";
>
> What I get for output from the NT command line is:
> C:\pipe.pl
> Here we go...
>
> C:\
>

 ...

> the case of ping, but not disply.pl. Am I missing something in the way I wrote
> this, or are NT or ActiveState Perl simply broken in their ability to produce a

                                                                   ^^^^^ it's Win32
that's broken

>
> second instance of the perl interpreter, or what the heck is going on here?
>
> thanks in advance,
> Shaun

Bob Walton



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

Date: 21 Aug 1999 18:34:44 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Request for Comments: www.perl.com
Message-Id: <slrn7rudu7.c9p.abigail@alexandra.delanet.com>

John Stanley (stanley@skyking.OCE.ORST.EDU) wrote on MMCLXXX September
MCMXCIII in <URL:news:7pjoal$5mo$1@news.NERO.NET>:
<> In article <Pine.HPP.3.95a.990820141043.20918E-100000@hpplus03.cern.ch>,
<> Alan J. Flavell <flavell@mail.cern.ch> wrote:
<> >What the heck do you think you mean, "sites designed specifically with
<> >lynx in mind".  If a site is designed _for_ the WWW, then Lynx is not
<> >excluded.  
<> 
<> That is not true. There is a big difference between designing a hot web
<> site and doing it with text browsers in mind. The number of sites
<> that do nothing at all without having javascript in yor browser are
<> growing every day, and forgetting to have ALT text for images is common. 
<> So is the use of an imagemap as the only navigation method.

And your point is? Just because there are so many ignorant and incompetent
"web designers" out there doesn't mean that "designing for the WWW"
excludes text and speech browsers. Any site that requires you to use a
browser that displays images and/or does javascript isn't a WWW site;
no matter how many times you say so. It's an LW (limited web) site.



Abigail
-- 
    Anyone who slaps a "this page is best viewed with Browser X" label
    on a Web page appears to be yearning for the bad old days, before the
    Web, when you had very little chance of reading a document written on
    another computer, another word processor, or another network.
	    [Tim Berners-Lee in Technology Review, July 1996]


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 22 Aug 1999 00:47:42 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Shell vs Perl
Message-Id: <935283101.453229@elaine.drink.com>

In article <7pkh1j$e79$1@nnrp1.deja.com>,  <kcounts@my-deja.com> wrote:
>The system administrator at my workplace doesn't believe
>that a  Perl program  can be written to mimic the functionality of the
>below shell script and still keep as simple as the shell script.

Maybe not. Nothing wrong with using shell scripts for things which
are easy in shell. However there are many problems which are very
very complex to do in shell script and very easy to do in Perl.
There are far fewer problems which are easy in shell and complex
in Perl.


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

Date: 21 Aug 1999 19:09:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Split comp.lang.perl.misc
Message-Id: <slrn7rufvo.c9p.abigail@alexandra.delanet.com>

James Williamson (james.williamson@bbc.co.uk) wrote on MMCLXXX September
MCMXCIII in <URL:news:7pj6kp$gsv$1@nntp0.reith.bbc.co.uk>:
() 
() James Liu wrote in message ...
() >There really should be more perl newsgroups.  There are too many posts
() here.
() >I guess we could add
() >
() >comp.lang.perl.reg
() >                       .io
() >                       .win32
() >                       .llama   #for newbie posts. this one should
() >definately be moderated, with an automated look in FAQ response
() >                       .database
() >                       .otherlangs  #for arguning about which langs are
() >better, discussing a2p s2p.
() >
() >that should really clear up traffic and make finding what people want much
() >easier.  please suggest others.
() 
() What about comp.lang.perl.spam? I'd definitely subscribe to that one....


What about comp.lang.perl.sex?



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 21 Aug 1999 19:11:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: taint checking code, not data
Message-Id: <slrn7rug30.c9p.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXXX September
MCMXCIII in <URL:news:37BDA1F7.70A90D99@mail.cor.epa.gov>:
 .. 
 .. You don't think Abigail's code is the most evil available?


Not yet. I can do better.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 21 Aug 1999 19:49:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Time as per IST??
Message-Id: <slrn7ruiai.c9p.abigail@alexandra.delanet.com>

Sreshth Kumar (skumar@deutech.com) wrote on MMCLXXXI September MCMXCIII
in <URL:news:7pmfsb$c3u$2@news.vsnl.net.in>:
-- Suppose I want to display all times according to IST (GMT + 5:30) the
-- easiest way to do it would be to add 5 hours and 30 minutes to the time
-- returned by gmtime(). How do I do this?

    #!/opt/perl/bin/perl -w

    use strict;

    sub addtime {
        # Some holy numbes with magical properties.
        my @magic = (3 * 4 * 5 => 2 * (15 + 15) => 7 - 6);
        while (@magic) {
            my $var = shift;
            while ($var --) {sleep eval join "*" => @magic;}
            shift @magic;
        }
        return gmtime ();
    }

    use vars qw /$AUTOLOAD/;  # This *still* isn't fixed?
    sub AUTOLOAD {
        @_ = map {$_ || 0} $AUTOLOAD =~
                 /add(?:_(\d+)_hours)?(?:_(\d+)_minutes)?(?:_(\d+)_seconds)?/
             or die "No such subroutine ($AUTOLOAD)\n";

        goto &addtime;
    }

    print scalar gmtime (), "\n";
    print scalar add_5_hours_30_minutes (), "\n";

    __END__
    Sun Aug 22 00:47:19 1999
    Sun Aug 22 06:17:19 1999


-- Or for that matter how does one increment / decrement time by a given number
-- of hours/minutes/seconds?

Just use add_<H>_hours_<M>_minutes_<S>_seconds () with the amount of
hours/minutes/seconds you want.

It doesn't quite work for incrementing time though.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 21 Aug 1999 16:19:05 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: User session ID?
Message-Id: <37BF33E9.C2D478C0@cisco.com>

[ Overstreet wrote:

> Is there a Perl5 equiv of the VBScript "Session" variable?

No.

> I have tried to use the ENV variable, but it seems to lose the
> entries I set when the next page tries to read it.  Any ideas?

You cannot use ENV to store session variables to pass to a new script.
This is set fresh everytime a CGI script starts. You have to generate your own
session variables using the present time ( using time()) and the pid of the perl
process ( and
optionally some random stuff ). You have to now 'bind' your session variable
names
and values to this value and store it away to be retrieved later.
==




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

Date: 21 Aug 1999 18:46:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why $|++ (was: Re: perl system())
Message-Id: <slrn7ruekp.c9p.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXXX September
MCMXCIII in <URL:news:37BDA698.897F9A50@mail.cor.epa.gov>:
'' Abigail wrote:
'' > 
'' > Why "$|++;"? I've seen this before, and frankly, it baffles me why
'' > someone would want to use this instead of "$| = 1;".
'' 
'' > Would it be faster? No... a simple benchmark shows it's slower,
'' > by almost a factor of 2.5:
'' [snip of benchmark]
'' 
'' Thanks.  It never occurred to me that there would be a
'' difference, so I never ran Benchmark.  Given the number of
'' reps, do you consider this difference to be important?  Real?

No. But I just wanted to prevent someone else from raising the speed
issue. The speed difference didn't surprise me a single bit though; ++
needs to fetch the old value, then perform arithmetic on it, then store
the result.  = 1 only needs to store the result.

'' > Would it be clearer? Well, no, not at all. "$| = 1;" tells it all, while
'' > to know what "$| ++;" does, you would need the previous value of "$|".
'' > 
'' > Is it that "$| = 1;" isn't always correct? Well, in fact, "$| = 1;" will
'' > *always* turn of buffering, while "$| ++;" would enable buffering if, for
'' > whatever reason, "$| == -1;".
'' 
'' You're complaining about giving less-than-transparent answers?

I am not complaining. But it's being used by people don't seldomly give
obscure code.

'' But you are right here.  I don't think I have written any code
'' where I used $|--; to recover previous state and decide when to
'' turn buffering back on.  So what is the point?

Not only that, but that's why we have blocks and local.... ;-)



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 21 Aug 1999 18:56:36 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why $|++ (was: Re: perl system())
Message-Id: <slrn7ruf7c.c9p.abigail@alexandra.delanet.com>

Neko (tgy@chocobo.org) wrote on MMCLXXX September MCMXCIII in
<URL:news:7pkk4a$32p$2@216.39.141.200>:
~~ On 20 Aug 1999 00:42:32 -0500, abigail@delanet.com (Abigail) wrote:
~~ 
~~ >David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXXX September
~~ >MCMXCIII in <URL:news:37BC9BE1.C225EA2D@mail.cor.epa.gov>:
~~ >## 
~~ >## $|++;
~~ >
~~ >
~~ >Why "$|++;"? I've seen this before, and frankly, it baffles me why
~~ >someone would want to use this instead of "$| = 1;".
~~ 
~~ I saw this construct first in one of Randal's Web Techniques columns (or
~~ maybe Unix Review).  I just looked at it for awhile.  I thought it was
~~ unnecessarily obfuscated.  But now I've seen it so often, that it's
~~ idiomatic.

That's scary. Did Randal explain his use of $| ++ over $| = 1? Or did an
explained construct by a well known person just became idiomatic? That's
cargo cult programming, that's far, far worse than script kiddes copying
Matt's stuff. It's scary.

"Because Randal did it" isn't an excuse. "Because <whoever> did it" is
never an excuse. Never, ever use code you cannot explain. Else, you'll
be cargo cult programming.

~~ >Would it be faster? No... a simple benchmark shows it's slower, 
~~ >by almost a factor of 2.5:
~~ 
~~ There are better things to benchmark.  And I do not see how you got a factor
~~ of 2.5.  Maybe 1.25?
~~ 
~~ >    Benchmark: timing 1000000 iterations of empty, plusplus, set...
~~ >         empty: 13 secs (11.35 usr  0.00 sys = 11.35 cpu)
~~ >      plusplus: 19 secs (17.32 usr  0.02 sys = 17.34 cpu)
~~ >           set: 15 secs (13.81 usr  0.00 sys = 13.81 cpu)


        17.32 - 11.35
        ------------- ~ 2.43.
        13.81 - 11.35



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 21 Aug 1999 17:09:44 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37bf3fc9$0$205@nntp1.ba.best.com>



----------
In article <37b634a2@cs.colorado.edu>, Tom Christiansen 
<tchrist@mox.perl.com> wrote:


>      [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc, thehaas@my-deja.com writes:
> ...
> I think I can safely say, that the Perl
> :community is quite arrogant, especially to people new to it.
>
> It certainly didn't start out that way, and for many years Perl was
> famous for being precisely exactly the opposite of hostile.  It was
> about a programming community of mutual benefit.
>

> Think back to the 80s and early 90s.  The change, if it really happened,
> came with the upty-gazillion CGI script kiddies who couldn't program
> 2+2, yet who wanted *us* to write *them* these persistent, encrypted,
> crossplatform, multiscreen shopping carts for e-commerce, complete with
> dynamically-generated animated vanity counters, each and every time
> they stepped up to the feeder.

isn't that what perl republic wanted? If we want popularity, we cannot look
down on script kiddies. They are the ones who made Perl ubiquitous. Besides,
with Perl's DWIM (pronounced dim-wit) feature, much of what these kiddies
want are half done already.

> As a result, There's not much left of a spirit of a programming community
> of mutual benefit when it becomes numerically dominated by people who
> don't want to study or to work or EVEN TO PROGRAM, and who all seem to
> think you owe them something.

yeah I can grok that. Before I became a Perl expert, I was one of those
tedious perfectionist. Since then my brain has been freed. The Perl way(s)
has taught me the virtues of good programer. These days I can just fart and
food comes to my mouth, and I think everyone owes me something.

> When > 90% of the newsgroup postings are ill-formatted garbledy-gook
> that also fall into the category of not having bothered to have first
> checked the online docs or faqs that come with Perl, these things add up.
> And eventually, it risks breaking our spirit.  There's just no way to deal
> with the never-ending onslaught of non-programmer CGI script kiddies, who
> seem to outnumber the rest of us zillions to one.

Although I've been brain-washed for good, but one of my old trait --
documentation readings -- remained. I read all fags and your 4-camel books.
However, I no longer read them fastidiously. Perl has taught me to grok
docs, suck cheesiness, wallow in ambiguity, and swallow imprecision. Life
has never been as fun. Now I always think in contexts. As you can see, even
my writings are very context sensitive now.

> So what do you do?  You either bail out of this untenable situation, as
> Larry Wall has done, or else "customer-service battle fatigue" sets in.
> When that happens, people end up getting snapped at, sometimes mistaking
> an honest learner for yet another beggar looking for handouts.

Oh wait a min Tommy my leader. We are proud of calling ourselves mongers.
should the term 'beggar' not be used in a scary context? y'know, that might
muddy our reputation.

>  I dare
> say this would happen even in the best of families, given equivalent
> circumstances.

I concur to dare say that too. The big ass functional language family(ies)
never faltered on issues of quality, yet their collective newsgroup activity
is pitifully small. It's like a diamond lost in space.

> I do think that earnest individuals seriously wanting
> to work hard are still given the same helping hand they always got.

Yes. With you leading the way, we always benefits. It's like a prodding
cattle; there are always more than one way to get people going.

> Be careful what you wish for.
>
> --tom

Didn't _Larry_ said that sometimes in his life? Sorry I'm off topic here.

> --
> Emacs is a fine operating system, but I still prefer Unix. -me

Me 2. Don't you sometimes wish that you could just wipe the entire planet's
emac'ers off your face? Gnu is Not Unix my Ass, because it is.

Lastly, it is my wish that one day I'll soar into a Perl demigod status like
you. For one thing, you taught me how to advocate perl pretty well, have I?

with Perl virtues,

 Xah
 xah@best.com
 http://www.best.com/~xah/PageTwo_dir/more.html
 "The three principle virtues of Perl programers: mundaneness, sloppiness,
and fatuousness."



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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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