[7811] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1436 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 8 15:07:21 1997

Date: Mon, 8 Dec 97 12:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 8 Dec 1997     Volume: 8 Number: 1436

Today's topics:
     Re: A quick parsing question (Kjetil Skotheim)
     Re: Converting from Perl 4 to 5 (Colin Kuskie)
     Excessive Paranoia and crypt <cwatson@nuevo.com>
     File I/O under IIS 4.0 <rshah@sapient.com>
     Re: floating point comparisons <rootbeer@teleport.com>
     Re: grep <rootbeer@teleport.com>
     Re: grep <rootbeer@teleport.com>
     Re: Has anyone done much performance testing of study() (Greg Bacon)
     Help with text file searches on BSD Unix (Paul Heindselman)
     Improving CGI.pm (was: Re: Clearing a namespace) <rootbeer@teleport.com>
     Re: Intercepting Incoming Mail (Neil Briscoe)
     Re: New To PERL <rootbeer@teleport.com>
     Newbie Perl Sort Question <jonestl@Dont-even-try-it.com>
     Re: Newbie Perl Sort Question <dballing@speedchoice.com>
     Re: Password Protect.dat files <rootbeer@teleport.com>
     Re: pattern matching (Brock Sides)
     Re: PERL Backticks and Non-parsed Headers (NPH) (Hans-Georg Fischer)
     Perl for Solaris x86? <scott@pop.netobjects.com>
     Perl: Future directions? (Kevin White)
     Re: Perl: Future directions? (brian d foy)
     Re: Perl: Future directions? (Kevin White)
     Re: PerlShop "invalid transmission" (Dave Reed)
     Resource Kit Anomaly - O'Reilly Responds (John Dockery)
     Re: searching for value in array (Greg Bacon)
     Re: searching for value in array (Kjetil Skotheim)
     Re: searching for value in array <burleigh@hackberry.chem.niu.edu>
     Re: Simple/small socket script doesn't work <zenin@best.com>
     Strange behaviour when using /o in patterns (ProjektBoers)
     Re: Tracing memory usage & related questions <billw@airone.claircom.com>
     Re: Use of a hash to emulate a 'set' <ebohlman@netcom.com>
     Re: Wildcards <raconway@atos-group.com>
     Re: Wildcards nospam@minivend.com
     Re: Wildcards (Scott DiNitto)
     Re: {lc} vs. lc. also: lc is both called operator and f nospam@minivend.com
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 Dec 1997 18:13:24 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: A quick parsing question
Message-Id: <66hdc4$kba$3@ratatosk.uio.no>

In article <66fpct$rtr$1@Usenet.Logical.NET>, rlewis@amzmusiczine.com says...
>
>I have a perl script that analyzes a file line by line.  How do I go about 
>parsing the variable  $_ ?  I need to look at the first part of the line to 
>decide whether to print the whole line.  If I were to put a delimiter between 
>the area I need to examine and the rest of the line, what would be the best 
way 
>to isolate that part of the $_ variable so that I can do a comparison of the 
>text therein?
>

If for instance ' is your delimiting char:

while(<>){
  ($need_to_examine)=(/^([^']*)/);
  print if something about $need_to_examine;
}




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

Date: 8 Dec 1997 09:53:59 -0800
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Converting from Perl 4 to 5
Message-Id: <66hc7n$hfk@sarek.latticesemi.com>

In article <348703B5.20A7@lucent.com>,
Linda Manduley  <lmanduley@lucent.com> wrote:
>We have a large application written in Perl 4 that must be upgraded to
>Perl 5 or converted to another language.  Please recommend:
>
>   1. Any utilities to help moving from 4 to 5
A good text editor is highly recommended :)

Seriously, there is no had and fast rule for converting perl4 code to
perl5 code.  A lot of it depends on what kind of perl you've written.
I had to convert a department here at Lattice over and found that the
most frequent problem was the assumed default behavior of split.

>   2. Any documentation on converting

If you have perl5 installed, you should have a perltrap manpage.  I
believe that Bill Middleton also published an extensive list of
possible difficulties.  You might look around CPAN to find if
it's there.  If it's not, you could get his email address from
the modules list and ask him yourself.

>   3. Any language that would be easy to convert to

I don't think that converting it all over to another language
would be as easy as updating your existing code.

Hope this helps,
Colin Kuskie


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

Date: Mon, 08 Dec 1997 13:05:23 -0500
From: XXXXXXXXXXXX <cwatson@nuevo.com>
Subject: Excessive Paranoia and crypt
Message-Id: <348C36E3.52ED@nuevo.com>

I get the following message from a Perl script using version 5.004_02
for win32:

The crypt() function is unimplemented due to excessive paranoia. at
c:\GLAA\cgi-bin\LOGON2~1.PL line 195.

I haven't compiled Perl myself (it does not seem to readily compile with
Microsoft Visual C++ 4.0, though I understand it can be made to do so
--  perhaps it just doesn't like me), so I'm pretty sure it's someone
else's paranoia I am dealing with.  The program I downloaded is
specifically targeted for win32, so I assume there must be a win32
version of perl out there which supports crypt.  

I seek enlightenment.  Feedback from anyone familiar with this problem,
or who knows of a recent (5.003 or above) version of Perl which support
the crypt function, would be greatly appreciated.

TIA - Charlie Watson
      cwatson@nuevo.com
***********************************************************************
Never argue with a crazy person, people might not know the difference.
***********************************************************************


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

Date: Mon, 8 Dec 1997 14:10:06 -0500
From: Raj Shah <rshah@sapient.com>
Subject: File I/O under IIS 4.0
Message-Id: <0685A427A719D11197BB00A024D39945021120AD@delphi.sapient.com>

Hi,

Opening details:
	OS : NT 4.0 SP3
	Webserver: IIS 4.0
	Perl: 5, build 303 (from ActiveState)


	I'm trying to open a filehandle using a pipe similar to the
following
open (SM,"|windmail.exe -t");

I pass some text to the filehandle
and then try to close it.  
When run from a console window, the filehandle closes properly.  When
run through the webserver,
the filehandle does not.  The program (windmail.exe) is in a zombie
state, and I believe this is because of 
a File I/O problem under IIS 4.0.  I have already been to the Microsoft
KB, and set up the following
registry entry:


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters

      Value Name: CreateProcessWithNewConsole
      Data Type: REG_DWORD
      DateValue = 1

Has anyone else seen this problem under IIS 4.0

Thanks in advance
Raj Shah

Sapient


rshah@sapient.com




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

Date: Mon, 8 Dec 1997 11:43:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Terrence Brannon <brannon@surf.usc.edu>
Subject: Re: floating point comparisons
Message-Id: <Pine.GSO.3.96.971208114033.9753P-100000@user2.teleport.com>

On 8 Dec 1997, Terrence Brannon wrote:

> What exactly happens when I test if
> 
> 5e-6 = 0.000005
> 
> How many places are such comparisons made to and how can I alter this?

This depends heavily upon your system. But I usually recommend code like
this. 

    if ($foo > 4.9e-6  and  $foo < 5.1e-6) { ... }

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 8 Dec 1997 11:35:12 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Hu Geng <hu@nli-research.co.jp>
Subject: Re: grep
Message-Id: <Pine.GSO.3.96.971208113340.9753N-100000@user2.teleport.com>

On Mon, 8 Dec 1997, Hu Geng wrote:

> Subject: grep

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> The following script is intend to grep out files containing /* , but
> $ret is always 0 :
> 
> #!/sur/local/bin/perl -w
>  $file="foo.csv";
>  $ret=grep(/¥/¥*/,$file);

What's with the escape sequences? But I'd say that $ret is supposed to be
zero in that case, according to the docs for grep in perlfunc(1). Hope
this helps!

-- 
Tom Phoenix           http://www.teleport.com/‾rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 8 Dec 1997 11:36:12 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Hu Geng <hu@nli-research.co.jp>
Subject: Re: grep
Message-Id: <Pine.GSO.3.96.971208113527.9753O-100000@user2.teleport.com>

On Mon, 8 Dec 1997, Hu Geng wrote:

>  open FILE, $file;

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

>  $ret = grep (/¥/¥*/,<FILE>);

There are more efficient ways to do that... :-)

-- 
Tom Phoenix           http://www.teleport.com/‾rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 8 Dec 1997 16:59:47 GMT
From: gbacon@adtran.com (Greg Bacon)
To: andrew@edoc.com (Andrew Williams)
Subject: Re: Has anyone done much performance testing of study() ?
Message-Id: <66h923$n6$5@info.uah.edu>

[Posted and mailed]

In article <348c1e40.325494203@news.clark.net>,
	andrew@edoc.com (Andrew Williams) writes:
: Also in general I am looking for some information on when you actually
: win by studying a value and when the study takes more time that the
: regexp does in general.

Did you read the documentation on study in the perlfunc manpage?

    [study] may or may not save time, depending on the nature and number
    of patterns you are searching on, and on the distribution of
    character frequencies in the string to be searched -- you probably
    want to compare run times with and without it to see which runs
    faster.

Read the documentation on the Benchmark module (which comes with the
standard perl distribution) for more information on how you might
compare run times.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Mon, 08 Dec 1997 19:32:24 GMT
From: webmaster@radcliffe-waye.com (Paul Heindselman)
Subject: Help with text file searches on BSD Unix
Message-Id: <348c48ee.196496877@news.dx.net>

Hello, 

I am trying to write a perl scrip to do a search on a text file and if
it finds the string it goes to a JavaScript script (external .js file)
If it doesn't find the string I want it to write the string to the
file, then go to the JavaScript script. So far I've gotten the script
to write to the file, I'm using glimpse to search the file, but can't
figure out how to set up the if-else statement. Below is what I have
so far:
-------------------------------------------------------------------------------------
#!/usr/bin/perl -w

#print "Content-type:text/html¥n¥n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
     @pairs = split(/&/, $buffer);

     foreach $pair (@pairs)
     {
         ($name, $value) = split(/=/, $pair);
         $value =‾ tr/+/ /;
         $value =‾ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
         $value =‾ s/‾!/ ‾!/g;
         $FORM{$name} = $value;
     }

sub logsub
    {
    system( "/usr/contrib/bin/glimpse -i -w $FORM{'loginText'}
 ./callsign.txt" );
    }

$loginname = &logsub;

    if ( $loginname == $FORM{'loginText'} )
    {
    print "Yes¥n";
    }

    else
    {

    open (CALLSIGN,">>callsign.txt");

    print CALLSIGN "$FORM{'loginText'}¥n";
    close (CALLSIGN);
    print "No¥n";
    }
---------------------------------------------------------------------
I get an error about an uninitialized variable ( I think from the
$buffer variable) and it likes to return Yes all the time.

If anyone has any suggestions that might help they would be greatly
appreciated.

Paul Heindselman
Webmaster - RealVision Inc.
webmaster@realvision-inc.com


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

Date: Mon, 8 Dec 1997 11:16:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tushar Samant <scribble@tekka.wwa.com>
Subject: Improving CGI.pm (was: Re: Clearing a namespace)
Message-Id: <Pine.GSO.3.96.971208110911.9753J-100000@user2.teleport.com>

On 7 Dec 1997, Tushar Samant wrote:

> CGI.pm should have a method which returns a hash of all the params.

I'd agree, but what to do about parameters which can return more than one
item? If the hash uses a listref there, that's likely to cause confusion -
but maybe that's not unwarranted. :-)

-- 
Tom Phoenix           http://www.teleport.com/‾rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 8 Dec 1997 19:24:11 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Intercepting Incoming Mail
Message-Id: <memo.19971208192411.63213A@skep.compulink.co.uk.cix.co.uk>

In article <348B7FCD.97CD3198@connix.com>, markh@connix.com (Mark
Hunnibell) wrote:

> Hello:
>
> I am trying to sort out a rather unique requirement. My biggest
> problem is that it looks like it will be on an NT 4.0 system.  The
> second problem is that I don't even know if I could do it with
> sendmail on a Unix system.  Here is what I want to do:
>
> I would like all incoming e-mail to be evaluated before they are
> delivered to the addressee.
>
> I know that in Unix I can direct an individual address to a script
> using pipes and such in the /etc/aliases directory, but I haven't a
> clue about doing that with NT (I'll have my first look at the system
> this week).  Is it possible to intercept all incoming mail and then
> pass it on to sendmail (or the NT equivalent whatever that is)?
>
> The application is that I want to be able to check the header
> information for From:, To:, etc., information and then modify it as
> programmed and in some cases re-directing the message to a different
> address. The perl comes in for the database lookup stuff that will be
> done when each message comes in.  One idea I had was to have a perl
> process running on port 25 at all times and then have the real
> sendmail program answering on another obscure port known only to the
> systems admins.
>
> Has anyone done anything like this? Is there a place I can go to learn
> more?
>
> Thanks in advance
>

I can think of two solutions, both of which would end up using Perl.

One is to get the NT port of sendmail from Metainfo
(http://www.metainfo.com).  If you can't achieve what you want by munging
the sendmail.cf - you could at least divert incoming mail to a perl
script.

The second solution is the N-Plex server from Isocor
(http://www.isocor.com) which supports various API's, one of which would
allow you to write a robot in Perl.

Regards
Neil



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

Date: Mon, 8 Dec 1997 11:28:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Maracle <psychose@vaxxine.com>
Subject: Re: New To PERL
Message-Id: <Pine.GSO.3.96.971208112809.9753M-100000@user2.teleport.com>

On Mon, 8 Dec 1997, Jason Maracle wrote:

> Subject: New To PERL

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

>     1.  The Script I have will run if I put it in a submit button on a
> web page, but not if I call it from a web page. 

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN. Hope this helps!

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

-- 
Tom Phoenix           http://www.teleport.com/‾rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 08 Dec 1997 11:18:39 -0500
From: "T. Jones" <jonestl@Dont-even-try-it.com>
Subject: Newbie Perl Sort Question
Message-Id: <348C1DDE.7C5989C5@Dont-even-try-it.com>

My script takes in a large file, splits the line and parses.   How do I
make it sort the resulting output  by one of the fields that I've
split?  In the example below, I want to sort the output by the  last
name.

$line = $_;
@fields = split /¥|/, $line;
print <<STUFF;
Last Name:  $fields[2]   Phone:  $fields[5]
STUFF


--
Very funny scotty!  Now beam down the rest of my clothes.




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

Date: Mon, 08 Dec 1997 11:26:37 -0600
From: Derek Balling <dballing@speedchoice.com>
Subject: Re: Newbie Perl Sort Question
Message-Id: <4F96FA36EC7801AB.F2383ADA86BF3DAC.79B1053391733B52@library-proxy.airnews.net>

> $line = $_;
> @fields = split /¥|/, $line;
> print <<STUFF;
> Last Name:  $fields[2]   Phone:  $fields[5]
> STUFF

One possible solution follows...

while (<INPUT_FILE_HANDLE>)
{
  $line = $_;
  @fields = split /¥|/, $line;
  $ln = $fields[2];  $fn=$fields[5];
  $foo{$ln} = $fn;
}
foreach $ln (sort(keys(%foo)))
{
  print <<STUFF;
Last Name: $ln   Phone: $foo{$ln}
STUFF
}

Other more graceful solutions exist, I'm sure.


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

Date: Mon, 8 Dec 1997 11:48:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: SCSYR01 <scsyr01@aol.com>
Subject: Re: Password Protect.dat files
Message-Id: <Pine.GSO.3.96.971208114347.9753Q-100000@user2.teleport.com>

On 8 Dec 1997, SCSYR01 wrote:

> I have seen many cgi's that offer the ability to create "files" for
> password protect web-pages or other data fields. 
> 
> My question is, once this information is in the .dat file, how does one
> edit it or delete records that are no longer appropriate. 

It's possible that you're talking about files which are somehow protected
from access - in which case, you may not be able to make a program in Perl
(or in any other language) which can work with them. If your programs can
read and write them at all, it's done from Perl in the same way you would
work with any other files from Perl. A good introductory book on Perl,
such as the Llama book, should help you to get started. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/‾rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 08 Dec 1997 13:30:35 -0600
From: cbks@NOSPAM.magibox.net (Brock Sides)
Subject: Re: pattern matching
Message-Id: <cbks-0812971330360001@dave.magibox.net>

In article <348b08d2.347180@news.tornado.be>, bart.mediamind@tornado.be
(Bart Lateur) wrote:

> >       i want to see if there is a smaller string (just an apersand,
> >       "@") within a bigger string, and, if so, to do something. so i 
> >       constructed the following:

> Now you have $1 and $2 containing the "before" and "after" part. Careful
> with greediness: $1 will containg EVERYTHING containing upto (but
> excluding) the last ampersand, including any other ampersands.
> 
> HTH,
> Bart.

FYI, the ampersand is the character "&", not "@". This isn't a mere
semantic quibble: I do tech support at an ISP, and things don't work so
well when I tell people to type "AT&F1" and they instead type "AT@F1".

-- 
Brock Sides
cbks@NOSPAM.magibox.net
http://www.magibox.net/‾brock/
To reply by email, remove the string "NOSPAM." from reply address.


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

Date: Mon, 08 Dec 1997 18:19:59 GMT
From: hgf@berlin.snafu.de (Hans-Georg Fischer)
Subject: Re: PERL Backticks and Non-parsed Headers (NPH)
Message-Id: <348c1e2b.25021358@news.snafu.de>

Your print ` cann't work because it is no loop, it has to wait for
completition befor it can start printing.
So you have to implement a loop:

open( INP,"/home/p_sattle/cgi-bin/nphcall.pl & |");
# The trick is placing nphcall.pl with 4&4 in the background
while (<INP>){
  print $_;
  }
>print "All done!¥n";
>print "</PRE></BODY></HTML>¥n";
>
>exit;
--
Hans-Georg Fischer


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

Date: Mon, 08 Dec 1997 09:50:54 -0800
From: Scott Kahn <scott@pop.netobjects.com>
Subject: Perl for Solaris x86?
Message-Id: <348C337E.FFCCA0E7@pop.netobjects.com>

Where can I get already-compiled Perl 5.x for the Solaris x86/Intel
Edition?

thanks,

scott




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

Date: 8 Dec 1997 12:38:00 -0500
From: kwhite@apache.tsc.ohio-state.edu (Kevin White)
Subject: Perl: Future directions?
Message-Id: <66hb9o$kbu$1@apache.tsc.ohio-state.edu>

This question isn't about web.  (I've never used perl for web.)  This
question isn't even about anything specific.  I'm just curious:

What are perl's future directions?  What's going into perl 6?  Does
Larry know?  Does anyone know?

I came into the Perl world at the first public releases of Perl 5
stuff.  I was learning 4, but I knew there were some great new,
completely re-written, things coming soon.  (In fact, I actually
helped the porters at the time get it to compile on the only Unix
platform I had to play with: NeXT black boxes.  And my name is still
in hints/next_3_0.sh.  Wow...)

Any that point, the world knew what was coming.  Perl 5 was going to
be cool.

But then this WWW thing happened, and all the Perl'ers disappeared to
wherever they've hidden, and this ng is full of wars and dumb
quetsions.  Randall is the only one trying (which I appreciate.)

So, since this stuff isn't normally discussed here any more, I just
thought I'd ask, in case anyone knows, and anyone wants to talk.
What's coming?  What's the grand plan?  Is making Perl 5 rule even
more the deal, or are bigger things in mind for a Perl 6?

Just thought I'd ask...

Kevin



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

Date: Mon, 08 Dec 1997 13:14:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl: Future directions?
Message-Id: <comdog-ya02408000R0812971314100001@news.panix.com>

In article <66hb9o$kbu$1@apache.tsc.ohio-state.edu>, kwhite@apache.tsc.ohio-state.edu (Kevin White) wrote:


>But then this WWW thing happened, and all the Perl'ers disappeared to
>wherever they've hidden, and this ng is full of wars and dumb
>quetsions.  Randall is the only one trying (which I appreciate.)

i suppose that wasn't meant as a slight to the rest of us that are
trying...

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 8 Dec 1997 13:38:18 -0500
From: kwhite@apache.tsc.ohio-state.edu (Kevin White)
Subject: Re: Perl: Future directions?
Message-Id: <66heqq$kls$1@apache.tsc.ohio-state.edu>

In article <comdog-ya02408000R0812971314100001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>In article <66hb9o$kbu$1@apache.tsc.ohio-state.edu>, kwhite@apache.tsc.ohio-state.edu (Kevin White) wrote:
>
>
>>But then this WWW thing happened, and all the Perl'ers disappeared to
>>wherever they've hidden, and this ng is full of wars and dumb
>>quetsions.  Randall is the only one trying (which I appreciate.)
>
>i suppose that wasn't meant as a slight to the rest of us that are
>trying...

Gosh, no...not at all!  Actually, I was kind of referring to the
people who's names are on the covers of the books...the people who are
on the newsgroup, fielding the questions?  Thank you!  Thanks to all
of you!

Kevin


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

Date: Mon, 08 Dec 1997 13:00:10 -0500
From: daveSTOP*SPAMreed@webshowplace.com (Dave Reed)
Subject: Re: PerlShop "invalid transmission"
Message-Id: <daveSTOP*SPAMreed-0812971300100001@d158.b66.cmb.ma.ultra.net>

In article <348589c1.209504801@woody.wcnet.org>, jzawodn@wcnet.org (Jeremy
D. Zawodny) wrote:

> I'm not sure how many people on this group have *any* idea what
> PerlShop.cgi is. I've done a fair amount of CGI hacking in Perl, and
> I've never run across it.

It's a shopping cart system offered as "adverware" -- free if you carry
their logo and link.  Several stores are operating on the web.

> So, I'm forced to make some assumptions.
> 
> (1) You've read the docs and they didn't help.

Yes. The docs are very limited and did not help.

> (2) You contacted the script's author/maintainer and that didn't help.

Yes. No response.  (None promised, since it's free.)

> (3) You've read the CGI FAQs and they didn't help.

Yes.

> (4) You've searched the web and usenet for references to
> "PerlShop.cgi" to see if anyone else has published material related to
> it, and that hasn't helped.

Yes.

> (5) You have nowhere else to turn.

Yes.
 
> I spent the 30 seconds worth of effort needed to search AltaVista and
> found: http://elaine.teleport.com/support/webweave/cgi/perlshop.html
> 
> The documentation appears to be semi-complete, and there is
> information about contacting the author. Have you?

That site merely repeats the author's brief Manual.  Yes.  No response. 

> You don't seem to have posted enough code to make the problem easily
> solvable. I have no idea what it in most of those variables or what is
> supposed to be.
> 
> Have you tried sticking in some debugging code to see what is
> happening?
> 
Here's more detail:

I've set up PerlShop at

http://www.webshowplace.com/cgi-bin/vr?antiq/perlshop.cgi

with entry page at

http://www.webshowplace.com/AntiqBooks/home.htm

but I keep getting the error message

               "Cannot open tokens/572592245 for writing"

with a different random number each time.

Apparently the error message is being invoked by this:

    if ($token_exists == 0) {
         srand(time() ^ ($$ + ($$ << 15)));
         $rand_len = '9' x ($id_length - 3);     

         do      {
               $unique_id = &zero_fill(abs($$),3) .
&zero_fill(int(rand($rand_len)),$id_length - 3);           
               $token_file_name = "$token_directory/$unique_id";
                   }
         until (! (-e $token_file_name)); ### Now check if really unique
(i.e. does it already exist?)

          ### Create a random token to use with SHA signature
          $token = int(rand(1000000));

          open(token_file, ">$token_file_name") || &err_trap("Cannot open
$token_file_name for writing¥n");

But I can't discover what I'm doing wrong.

(I've set permissions 777 on the /tokens directory.)

Any help would be appreciated.  Thanks!

(I'm totally new to Perl and CGI and apologize if I have introduced this
question inappropriately or in an inappropriate forum.)

-Dave          davereed@abaweb.com


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

Date: 8 Dec 1997 18:33:59 GMT
From: johndoc@shore.net (John Dockery)
Subject: Resource Kit Anomaly - O'Reilly Responds
Message-Id: <66hein$bna@fridge.shore.net>

RE:  The Perl Resource Kit

We are doing some conversions right now and the following material 
from the Perl Resource Kit documentation will be available online at
perl.oreilly.com within the next week:

Utilities Guide: Table of Contents and Chapters 1-3
Programming with Perl Modules: Table of Contents, Chapter 1 and Chapter 4
Perl Module Reference Volume 1: Table of Contents and Chapters 1-2
Perl Module Reference Volume 2: Table of Contents

These excerpts will describe all of the modules covered in the Resource
Kit and will include several examples of chapters that cover these modules,
and will include the description of Larry Wall's JPL toolkit for Java-Perl
integration.  

Thanks for your imput.

Sincerely,

John Dockery



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

Date: 8 Dec 1997 17:35:31 GMT
From: gbacon@adtran.com (Greg Bacon)
Subject: Re: searching for value in array
Message-Id: <66hb53$n6$6@info.uah.edu>

In article <01bd03e7$eb7e65e0$c82da8c0@akilles.ittek.org>,
	"Robert Friberg" <robert.friberg@your_clothes.eductus-vast.com> writes:
: I've heard that grep is inefficient when searching for
: a certain value in an array, like: 
:     print "$_ found!¥n" if scalar( grep /$_/, @list);
: 
: Why?

[snip]

: is there a simpler/faster/more perlish way?

Both of your questions are answered in the FAQ list.  Did you check
there before posting?  Read the perlfaq manpage, or perhaps visit

    http://www.perl.com/CPAN/doc/FAQs/FAQ/PerlFAQ.html

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 8 Dec 1997 17:44:26 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: searching for value in array
Message-Id: <66hblq$kba$1@ratatosk.uio.no>

In article <01bd03e7$eb7e65e0$c82da8c0@akilles.ittek.org>, 
robert.friberg@your_clothes.eductus-vast.com says...
>
>I've heard that grep is inefficient when searching for
>a certain value in an array, like: 
>    print "$_ found!¥n" if scalar( grep /$_/, @list);
>
>Why?
>
>I use the following: 
>  print "found!¥n" if &ismember('bart', @simpsons);
>  sub ismember{
>  $_ = shift;
>     foreach $v (@_) { 
>        return 1 if $_ eq $v 
>    }
>  return 0
>  }
>
>is there a simpler/faster/more perlish way?


If you instead can store the simpsons in an assosiative array,
you can search faster:

for(@simpsons){$ismember{$_}=1}    #do this initiation once

print "found!¥n" if $ismember{bart}; #search fast with a.array
                                   #many times


The more simpsons there are, the more time you will save by
searching with assosiative arrays.




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

Date: Mon, 08 Dec 1997 13:09:37 -0600
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: searching for value in array
Message-Id: <348C45F1.7A30@hackberry.chem.niu.edu>

Kjetil Skotheim wrote:
> 
> In article <01bd03e7$eb7e65e0$c82da8c0@akilles.ittek.org>,
> robert.friberg@your_clothes.eductus-vast.com says...
> >
> >I've heard that grep is inefficient when searching for
> >a certain value in an array, like:
> >    print "$_ found!¥n" if scalar( grep /$_/, @list);
> >
> >Why?
> >
> >I use the following:
> >  print "found!¥n" if &ismember('bart', @simpsons);
> >  sub ismember{
> >  $_ = shift;
> >     foreach $v (@_) {
> >        return 1 if $_ eq $v
> >    }
> >  return 0
> >  }
> >
> >is there a simpler/faster/more perlish way?
> 
> If you instead can store the simpsons in an assosiative array,
> you can search faster:
> 
> for(@simpsons){$ismember{$_}=1}    #do this initiation once
> 
> print "found!¥n" if $ismember{bart}; #search fast with a.array
>                                    #many times
> 
> The more simpsons there are, the more time you will save by
> searching with assosiative arrays.

-- 

I often use something like:
$match = join( '|', @simpsons);  # -- do this once

then

print "found " if ( $thing =‾ /^($match)$/ );

is that grossly less efficient?
is there any significant difference in creating the 
associative array vs. the match string?
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
¥¥//¥¥//.¥¥//¥¥//.¥¥//¥¥//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: 8 Dec 1997 19:32:48 GMT
From: Zenin <zenin@best.com>
Subject: Re: Simple/small socket script doesn't work
Message-Id: <881609768.663087@thrush.omix.com>

[ posted & mailed ]

Atif Ahmad Khan <aak2@Ra.MsState.Edu> wrote:
	>snip<
: print <$remote> ;

	This is your problem.  The "<$remote>" statement is being called in
	array form, and as such it will not return that array until getline()
	returns undef (eg, EOF -The server closes the connection).  What you
	want is just one line from $remote, so call it in scalar context:

	print scalar <$remote>;

	Or, a little cleaner (IMHO);

	print $remote->getline();

	Hope this helps!

--
-Zenin (zenin@best.com)
 The Bawdy Caste (San Jose, CA)       http://www.netmagic.net/‾dmcgrath/bawdy/
 Barely Legal   (Berzerkly, CA)                    http://www.barelylegal.org/
 Zenin's Rocky Horror Archive (I MOVED!)     http://www.archive.rhps.org/rhps/


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

Date: 8 Dec 1997 18:11:19 GMT
From: proboers@hp5.econ.cbs.dk (ProjektBoers)
Subject: Strange behaviour when using /o in patterns
Message-Id: <66hd87$ssm$1@news.uni-c.dk>

I have found a strange behaviour in Perl when using /o to compile patterns
only once.

Consider the following script:
---------------------------------
#!/usr/bin/perl

$pat = 'First |‾‾| Second |‾‾| Third';

$delimiter = '¥s*¥|¥‾¥‾¥|¥s*';

($first,$second,$third) = split /$delimiter/, $pat, 3;

print "Without /o flag:¥n 1:$first: 2:$second: 3:$third:¥n";

($first,$second,$third) = split /$delimiter/o, $pat, 3;

print "With /o flag 1st run:¥n 1:$first: 2:$second: 3:$third:¥n";

exit;
--------------------------------------
Output:
--------------------------------------
Without /o flag:
 1:First: 2:Second: 3:Third:
With /o flag 1st run:
 1:First : 2: Second : 3: Third:
--------------------------------------

As you can see perl splits differently whether I use/o or not.

According to Programming Perl there should be no difference.
Is this a feature in Perl or a bug in my script?

				-Tommy


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

Date: Mon, 08 Dec 1997 09:41:09 -0800
From: William Warner <billw@airone.claircom.com>
To: Boris Statnikov <boris@cs.jhu.edu>
Subject: Re: Tracing memory usage & related questions
Message-Id: <348C3135.7354@airone.claircom.com>

Boris Statnikov wrote:
> 
> Is there a way to trace memory usage inside my Perl program?  Inside
> the (Perl) modules it uses?  The ideal trace would say: This reference
> has X bytes associated with it.
> 
> Also, is there a way to see the amount of memory which is free
> internally but is not given back to the system?
> 
> Is it possible to kick off the garbage collector on demand?
> 

Have exactly the same questions.

-- 
   William Warner                           bill.warner@attws.com


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

Date: Mon, 8 Dec 1997 18:31:25 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Use of a hash to emulate a 'set'
Message-Id: <ebohlmanEKvvGD.Du0@netcom.com>

Martien Verbruggen <mgjv@comdyn.com.au> wrote:
: 2) furthermore, and this is more important, for each line, you have to
:    search through every element in @list, and do a regex match against a
:    variable. Very expensive. You could replace the /$age/ with something
:    like $_ eq $age or even $_ == $age (since it's numerical anyway) to
:    speed things up considerably. (I like the block version of grep
:    better, but that's just a preference)

:    unless ( grep { $_ == $age } @list );

That's really an example of trying to speed up an inherently inefficient 
algorithm by tuning it.  Regardless of how fast you can get the list 
search to go, when you process the Nth input item, you have to search 
through potentially N-1 stored items, so unless nearly all the input 
items are duplicates, the number of comparisons needed is going to 
include an N**2 term.  Twice as many items, four times as many 
comparisons; that's not a recipe for speed.



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

Date: Mon, 8 Dec 1997 17:46:28 +0100
From: "R. Allen Conway" <raconway@atos-group.com>
Subject: Re: Wildcards
Message-Id: <14953E9BAF17D111926800805FA66B71393C18@hermes.atos-group.com>

You could single-quote everything - then it's up to you to do all the hard
work!

Scott DiNitto a icrit dans le message
>. ....... How else can I tell
>perl that a wildcard was used if the shell translates the wildcard
>before perl can even see that a wildcard was used!




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

Date: 8 Dec 1997 16:42:54 GMT
From: nospam@minivend.com
Subject: Re: Wildcards
Message-Id: <66h82e$ost$2@news.one.net>

Scott DiNitto <sdinitto@kronos.com> wrote:
> I can, in perl, invoke command line options in to my scripts. However,
> when using a wildcard (*) as an option, I have no way of telling perl
> that a wildcard was used. The shell that I am using will automaticly
> convert the wildcard to the logical filename. Therefore the variable
> that holds my command line option (*.txt) is really holding the
> filename (filename.txt) instead of the actual input (*.txt) becuase of
> the shell automaticly translated the wildcard. How else can I tell
> perl that a wildcard was used if the shell translates the wildcard
> before perl can even see that a wildcard was used!

This is normal on any shell I have ever seen. Perl doesn't do wild
cards in the sense you are thinking -- I don't know what you are
after here.

It is easy to escape the argument with ¥*.txt or '*.txt'.

--
Regards,
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Few blame themselves until they     131 Willow Lane, Floor 2  | ||  _ ¥
have exhausted all other            Oxford, OH  45056         | || |_) |
possibilities.                      <mikeh@minivend.com>     |___|  _ <
 -- anonymous                       513.523.7621 FAX 7501        |_| ¥_¥


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

Date: Mon, 08 Dec 1997 19:39:44 GMT
From: sdinitto@kronos.com (Scott DiNitto)
Subject: Re: Wildcards
Message-Id: <348c4b96.247874975@news>


>This is normal on any shell I have ever seen. Perl doesn't do wild
>cards in the sense you are thinking -- I don't know what you are
>after here.
>

I am not debating that... I am just looking for a workaround. A way to
tell perl that a wildcard is being used, even if it means perl not
seeing the wildcard itself! Or maybe I just have to accept the fact
perl won't take it. It's funny because I originally needed this for a
program that removes new line characters. Someone had transferred a
bunch of ascii files using binary transfer and that left a bunch of
newline characters in the file. After unsuccessfuly finding a utility
that could remove these easily, I decided to write a small perl
program to do the trick. Now, I could have coded this easily to
process all *.txt files without using the wildcard convention. But I
was going to pass this program along to anyone else who would have a
need for it... and that would mean more flexibility. So, although not
a pressing problem, I have run into another "impossible to do in perl"
challenge and now want to overcome it. But if it truly IS impossible,
then I guess I can let it go. It's funny, because I originally coded
this on win32 (that is where the files I needed to convert were held)
and the wildcard convention works just great. It's just while testing
on the unix end I have encountered this reaction.

SD


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

Date: 8 Dec 1997 16:34:25 GMT
From: nospam@minivend.com
Subject: Re: {lc} vs. lc. also: lc is both called operator and fn in Blue Camel
Message-Id: <66h7ih$ost$1@news.one.net>

Terrence Brannon <brannon@surf.usc.edu> wrote:
> on p.33 of Blue Camel, the following Perl sentence is shown:

> print reverse sort map {lc} keys %hash;

> I would like to know why lc is in brackets. At first I thought it was
> because it was an operator, but under the Alphabetical List of
> Functions, it is (errantly?) called a function.

It is a function, the one that is used to internally to implement
the ¥L quoting operator. I use it constantly for clarity, as I
find $hash{lc $key} easier to read than $hash{"¥L$key"}.

This was an example of how NOT to rely on precedence and defaults
in your idiom, if I recall.

--
Regards,
Mike Heins

This post reflects the 
opinion of my employer.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 1436
**************************************

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