[6464] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 89 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 11 16:34:32 1997

Date: Tue, 11 Mar 97 13:00:54 -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           Tue, 11 Mar 1997     Volume: 8 Number: 89

Today's topics:
     "My" ruminations (Luigi Mattera)
     Re: 10 commandments (was re: Which one is the best (pat <dbenhur@egames.com>
     Re: 10 commandments (was re: Which one is the best (pat <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
     All I want to do is subtract 180 days from a given date (Blake Swensen)
     Re: ANNOUNCE: eZone Online Interactive Courses (with ce <rootbeer@teleport.com>
     Re: Beginner - simple problem (Laurel Shimer)
     Re: Const.pm?  Where is module? <rootbeer@teleport.com>
     Re: Creating a structured email through perl (Jan Schipmolder)
     Re: Creating a structured email through perl <rootbeer@teleport.com>
     Re: flock() problem <rootbeer@teleport.com>
     help about rpcgen and perl <pmoutier@bplorraine.fr>
     Re: Help with Perl and Window95 (Parillo)
     Re: Help! Question about reading files (Tad McClellan)
     Re: Help! Question about reading files (Tad McClellan)
     Re: Help! Simple Question: Error 501: "Not Supported" <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
     Re: How to select either scripts for a form <rootbeer@teleport.com>
     Re: Need Help installing Perl for Os2 (Ilya Zakharevich)
     passing variables in Perl5 (Robert Parkin)
     perl and MQSeries (Denismont)
     Re: PLEASE, HELP A NEWBIE!! 2nd attempt <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
     porting script from unix to nt <james@timetrend.com>
     Problems with search engine. Please help <sonderby@vip.cybercity.dk>
     Re: Q:How to turn off taint checking locally in a funct <rootbeer@teleport.com>
     Re: Scope? <rootbeer@teleport.com>
     Re: So easy they do not explain pattern match. <rootbeer@teleport.com>
     Re: Using the print-command with colors (Jan Schipmolder)
     Re: Who makes more $$ - Windows vs. Unix programmers? (David Rudder)
     Re: Who makes more $$ - Windows vs. Unix programmers? (John Lockwood)
     Why don't this helpful suggestions work? <cherold@pathfinder.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 11 Mar 1997 18:44:37 GMT
From: mattera@ssga.ssb.com (Luigi Mattera)
Subject: "My" ruminations
Message-Id: <5g496l$ke2@svna0001.clipper.ssb.com>

  I recently slapped "use strict" into my Perl programs and watched
them crash and burn due to variables not being declared.  Ok, that was
no problem.  I found out that the correct way to do this was via the
"my" keyword.

  This immediately caused me to have FORTRAN flashbacks.  FORTRAN has
a keyword "common," which as you can guess by the name makes a
variable common to an entire program, I.E. global.  Why is this a bad
thing?  Well then, you haven't seen FORTRAN 77 code starting with
*pages* of common declarations.  If someone asks you to debug one of
these, you're better off shooting yourself on the spot.  My teacher
suggest that we never ever use this ability.

  The problem is that "my" seems too similar to be a coincidence.  Am
I misinterpreting this keyword?  Does Perl have a main() construct
which allows me to pass variables back and forth rather than make them
all global by force?  I do not want to fall into the "common" trap of
old FORTRAN 77 code, since I would like what I am doing to be readable
after I am done with it.  Thanks for any assistance.




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

Date: Tue, 11 Mar 1997 00:54:50 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 10 commandments (was re: Which one is the best (pattern matching))
Message-Id: <33251DDA.3B89@egames.com>

[mailed & posted]
Tom Christiansen wrote:
>> In comp.lang.perl.misc, dbenhur@egames.com writes:
> :> 9) Thou shall check return stati of functions
> 
> Oh boy, two grammatical errors in one sentence.

Thanks for the little English lecture, Tom, but I didn't
say the above.  I did extend the original posting with
a few additional commandmants in the same style as the 
original poster, but this line you have attributed to
me is not one I wrote.

--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks"  O-
    -- Sonia Orin Lyris



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

Date: Tue, 11 Mar 1997 13:54:46 -0500
From: Tim Lewis <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
Subject: Re: 10 commandments (was re: Which one is the best (pattern matching))
Message-Id: <3325AA76.4006@caesun.msd.ray.com.CLIP.THIS.PART>

Tom Christiansen wrote:
> 
> A word to the wise: don't use fancy forms out of yesteryear unless you
> really REALLY do know how they work(ed).  It just sounds silly.
> 

Jeez, one would think he wrote a book (or 1/3 of it) or something...

;-)

- Tim


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

Date: Tue, 11 Mar 97 15:43:19 GMT
From: blake@pbgi.com (Blake Swensen)
Subject: All I want to do is subtract 180 days from a given date!
Message-Id: <5g48mt$s75$1@nadine.teleport.com>

Really... thats all.  User inputs a date, and gets a date 180..0 days earlier. 
 

I have surfed, searched, read FAQs, downloaded, copied, hacked.  Can some kind 
soul give me the necessary nudge. 

Blake


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

Date: Tue, 11 Mar 1997 12:21:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Strickler <jstrick@mindspring.com>
Subject: Re: ANNOUNCE: eZone Online Interactive Courses (with certification!)
Message-Id: <Pine.GSO.3.96.970311121705.695S-100000@kelly.teleport.com>

On Mon, 10 Mar 1997, John Strickler wrote:

> Steven Katz wrote:
> 
> > The eZone is an innovative approach to online education, offering courses
> > in scripting and programming languages. Current courses include: Perl 5,
> > HTML 3, C++, Java, JavaScript, and Visual Basic Scripting Edition. Coming
> > soon: Office 97, Visual Basic 5, and ActiveX Scripting.

> The subject says "(with certification!)". Hmmmm.
> What kind of certification is available. Is there a non-partial
> institution out there that certifies HTML ~programmers, Office 97 users,
> ActiveX scripters, and, oh yeah, Perl programmers?
> 
> To recap: WHOSE certification? And what organizations demand or prefer
> this certification? 

I'm glad to hear that this is finally happening. I think some of us have
been certifiable for years.

But you ask a good question. With a little fancy paper stock and a nice
printer, it's easy to certify anything you want. You don't even need a
signet ring and hot wax anymore.

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 11 Mar 1997 11:20:52 -0700
From: autopen@quake.net (Laurel Shimer)
Subject: Re: Beginner - simple problem
Message-Id: <autopen-1103971120520001@l82.d22.quake.net>

Mark is this what you need?

shellx 44% perl5
use Cwd;
$dir = cwd();
print "$dir\n";

--- result of run---
/users/u1/autopen/learn.perl
shellx 45%


In article <5fedfo$vv@m1.cs.man.ac.uk>, turnerm@cs.man.ac.uk wrote:

> Hi,
> 
> I am a newcomer to perl and as much I am enjoying using perl I have a
little problem.  In my program I need the directory path.  I am trying to
use the UNIX pwd command from perl, using the system() command, and trying
to put the result into a variable $original_dir.  I have tried things like
> 
> 
> 
> system("pwd >$original_dir");
> 
> system("(pwd; >$original_dir &");
> 
> 
> 
> 
> without any success.
> 
> Can anybody help please.
> 
> Cheers,
> 
> Mark Turner....

-- 
        The Reader's Corner: Mystery, Romance, Fantasy 
         http://www.autopen.com/index.shtml 
     Subscribe to our free StoryBytes publication
 New: Fashion Challenges for the Time Traveling Heroine     http://www.autopen.com/romance.well.dressed.shtml


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

Date: Tue, 11 Mar 1997 10:48:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Williams <ken@forum.swarthmore.edu>
Subject: Re: Const.pm?  Where is module?
Message-Id: <Pine.GSO.3.96.970311103408.695K-100000@kelly.teleport.com>

On Mon, 10 Mar 1997, Ken Williams wrote:

> I found the following mention of a 'Const' module in an old article by
> Tom.  But looking through CPAN, I find no such module.  What has
> happened to it?  If it's gone, what's the current method of using
> un-alterable variables? 

I'm not the Tom you're looking for, but maybe I can help anyway.

> I'm not particularly fond of the subroutine method, i.e. sub pi
> {3.1415}. And creating a reference to a scalar (i.e. $pi = \3.1415) 
> isn't very helpful, because you have to dereference it to get the value,
> and when you do that you could accidentally assign to it. 

Well, there are variations on those methods which might be what you
want. You can use an empty-prototyped sub, for example.

    sub PI () { 3.14159 }		# Define a constant
    print "Circumference is ", PI * $diameter, "\n";

(Super cool fact: In the forthcoming version 5.004, Perl compiles that sub
inline. That is, there's no subroutine call overhead if you simply refer
to 2 * PI, for example, because the compiler automatically substitutes the
constant at compile time!)

Or, if you want to declare the constant at run-time rather than at compile
time, this method will work. It looks a little odd, though, at least to
me. (Note also that you need to use the dollar sign to get the value; it's
not a bareword.) 

    *PI = \3.14159;			# Define a constant
    print "Circumference is ", $PI * $diameter, "\n";

By an odd coincidence, though, something resembling this question came up
in a message I answered today on the p5p mailing list. Here's what I came
up with. 

file constant.pm
------------------------------------------------

package constant;

sub import {
    my($name, $val) = @_[1, 2];
    my($pack) = caller;
    eval "package $pack; sub $name () { $val }";
}

1;

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

Now you may

    use constant PI => 4 * atan2 1, 1;
    print "Circumference is ", PI * $diameter, "\n";

Documentation is left as an exercise. :-) Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 11 Mar 1997 18:42:30 GMT
From: schip@lmsc.lockheed.com (Jan Schipmolder)
Subject: Re: Creating a structured email through perl
Message-Id: <5g492m$3gr@butch.lmsc.lockheed.com>

Matt Park (student01@on.bell.ca) wrote:
: Hello,
: 
: Let me begin by saying that I am a beginner at the world of perl.
:  
: Is it possible to design a cgi script in perl that will process the

Please post your question in an appropriate www or cgi group.

--
jan.b.schipmolder@lmco.com


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

Date: Tue, 11 Mar 1997 11:03:15 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matt Park <student01@on.bell.ca>
Subject: Re: Creating a structured email through perl
Message-Id: <Pine.GSO.3.96.970311105743.695M-100000@kelly.teleport.com>

On Mon, 10 Mar 1997, Matt Park wrote:

> Is it possible to design a cgi script in perl that will process the
> information contained in an HTML form.  

Youbetcha.

> By "process" I mean taking each of the form element values, placing them
> into a standard email, and mailing the finished product to a designated
> recipient. 

You could do that, too.

> I tried to use the mailto: action & enctype: text/plain.  I am sure you
> are aware this simply displays the name/value for each element in the
> form.  I was under the impression a cgi script would be able to help. 
> Any information would be useful, the more detailed the better. 

Check out CGI.pm from CPAN. (You'll find it in the /modules/by-module/CGI
subdirectory.)

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/

Although this answer is short, the docs for CGI.pm are about as
comprehensive as you could ever want. There's more information in there
than in some books I own! Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 11 Mar 1997 11:11:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: yili@cse.bridgeport.edu, yli@eccubed.com
Subject: Re: flock() problem
Message-Id: <Pine.GSO.3.96.970311110353.695N-100000@kelly.teleport.com>

On 10 Mar 1997 yili@cse.bridgeport.edu wrote:

> I also have a lock problem with perl
> 
> in one program, I write:
> open (FH, "/path/file/);

I really hope you really check for error returns from that code. I'm not
sure that the trailing slash is what you want, is it? (And I _know_ you
can't mean to have omitted the trailing quote mark.)

   open FH, "/path/file/" or die "Can't open file: $!";

> flock(FH, $LOCK_EX);
> sleep(100);
> flock(FH, $LOCK_UN);
> close(FH);

You don't need to unlock before closing the file; closing does that
automatically. More importantly, if you've changed the file at all (which
you haven't) it is *vital* to ensure that the buffers are flushed before
unlocking - otherwise, the other process could do something before your
data gets written out. The easiest (and often best) thing to do is to
simply close the file, which forces the buffers to be flushed and releases
the lock. Later, if you need it, you can re-open and re-lock it.

> in another program, I write
> open (FH, ">> /path/file/);

Once again, checking for error returns could make you a very happy
programmer. And you've omitted another trailing quote mark. Hmmm.

> flock(FH, $LOCK_EX);
> print FH "TEST LINE\n";
> flock(FH, $LOCK_UN);
> close(FH);

Here again, skip the unlock. Just close the file.

> the file will still be written "TESTLINE" 

Not "TEST LINE\n"? :-)

> althought the firt program's process is alive; I also tested the
> returned value of those flock()s, they are 0's.

Well, something's wrong. Maybe it's your code. :-)  Try again, and good
luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 11 Mar 1997 20:19:47 -0800
From: Philippe Heitzmann <pmoutier@bplorraine.fr>
Subject: help about rpcgen and perl
Message-Id: <33262EE3.321@bplorraine.fr>

Is someone use rpcgen and perl

	thanks


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

Date: 11 Mar 1997 18:42:43 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: Help with Perl and Window95
Message-Id: <5g4933$32i@linet06.li.net>

I followed the following directions from the Perl for Win32 FAQ and was ok 
with PWS on Win95. My scripts are in C:\webshare\scripts\*.pl 
Maybe I was just lucky.
FAQ follows:


6.3. How do I configure Microsoft Internet Information Server to
support Perl for Win32?

Microsoft Internet Information Server (IIS) ships with Windows NT Server. 
Peer Web
Services (PWS) ships with Windows NT Workstation. Configuring the products 
is
essentially the same. First, you should consult Chapter 8, Publishing 
Information and
Applications, in the IIS documentation. 

Also read the Microsoft Knowledge Base article covering this issue, 
"Configuring and
Testing a PERL [sic] Script with IIS,"
(http://www.microsoft.com/kb/articles/q150/6/29.htm). 

You need to follow these steps to get Perl for Win32 scripts to run under 
IIS: 

     Associate the extension for your scripts with the appropriate 
interpreter in the script
     map for IIS. This is under the registry key HKEY_LOCAL_SYSTEM, with 
the
     sub-key "System\CurrentControlSet\Services\W3SVC\Parameters\Script 
Map".
     Many people map two extensions: one to perl.exe (like ".pl") and 
another to
     PerlIS.dll (like ".plx"). Note that mapping an extension in the 
script map is _not_ the
     same as associating the extension in Explorer. Use the full paths to 
the executable
     files in the script map. 
     Put your scripts in a virtual directory on the server that has 
Execute access but not
     Read access. You can add virtual directories or view their access 
with the Internet
     Service Manager. Remember that the URLs for your virtual directories 
can't overlap
     with URLs to directories in the WWW root directory. For example, You 
can't have
     a cgi-bin virtual directory and a real cgi-bin subdirectory of the 
WWW root. 
     Ensure that your scripts are readable by the account used by the IIS 
server. You set
     this account in Internet Service Manager; it is set to IUSR_[your 
server name] by
     default. See question 4.9. 
     Ensure that all supporting files, like the perl binary files, the 
perl library files, and the
     modules that you use, are all readable by the account used by the IIS 
server. See
     question 4.9. 

By default, Perl for Win32 install.bat maps the .pl extension to PerlIS. 
You can override the
extension used during installation. Because install.bat does this for you 
when IIS is already
installed, it can be easier to install IIS first, then install Perl for 
Win32. 

You need to restart the Web service after making the registry changes. 

Because IIS runs as a service (see question 4.8), you need to take special 
steps to make
sure that files and environment variables are available to it. 

Charlie Wu (charliew@atlml1.attmail.com) wrote:

: Can you post your configuration please - i.e. registry, filename
: association, virtual directory setting in pws, etc.

: I spent all weekend on this but all I got is the HTTP1.0 501 Not
: supported Error.

: Thanks.

: Charlie


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

Date: Tue, 11 Mar 1997 12:08:18 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help! Question about reading files
Message-Id: <i274g5.982.ln@localhost>

Harry Kas (harry@bci.se) wrote:
: Can somebody help me?

Yep.


: I have to read a textfile into an array (or variable) and must then be able
: to compare character by character.
: I have done something like this:


: open (HTML,"test.txt");
:   $i = 0;

:   while (<HTML>) {
:     $line[$i] = <HTML>;
:     $i++;
:   }
:   close(INFO);
          ^^^^

HTML ?


:   for ($j=0; $j<$i ; $j++ ) {
:     for ($x=0; $x < length($line[$j]) ; $x++ ) {
:       print "($line[$j][$x])";       ## here I hope to see character by
: character but I get only whole lines.
:     }
:   }
: }

: I get a whole line with $line[$j][$x] instead of the single character I
: expected.

: I have also tried to read a file with the getc command but that was not
: working at all.
: Can somebody help me? 


How's this:

----------------
open (HTML,"test.txt") || 
   die "could not open 'test.txt'  $!";     # check return value!
$file = join '', <HTML>;           # slurp whole file without changing $/
close(HTML);

foreach (split //, $file)
   {print "$_\n"}
----------------



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 11 Mar 1997 13:30:46 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help! Question about reading files
Message-Id: <6tb4g5.mm2.ln@localhost>

Nathan V. Patwardhan (nvp@shore.net) wrote:
: Harry Kas (harry@bci.se) wrote:

: : I have to read a textfile into an array (or variable) and must then be able
: : to compare character by character.
: : I have done something like this:

: Here's one method:
  ^^^^^^^^^^^^^^^^^

 ... which will only work if you add a line in front of it  ;-)


$/ = '';


: $file = 'file.txt';
: open(FILE, "$file") || die("file error: $!");
: $all = <FILE>;
: close(FILE);

: @lines = split(//, $all); # split on each char (by spliting on "nothing").

: for($i=0; $i<5; $i++) { ### print out five lines only - just to show you
: 		        ### that it's printing char by char
:    print $lines[$i]; #should print out each character
: }


Bet you had >= five chars on the first line of file.txt  ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 11 Mar 1997 14:10:31 -0500
From: Tim Lewis <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
Subject: Re: Help! Simple Question: Error 501: "Not Supported"
Message-Id: <3325AE27.7AC4@caesun.msd.ray.com.CLIP.THIS.PART>

Tad McClellan wrote:
> 
> readers see them as 'farting at the dinner table' because they don't
> know that they're expected to not do that.

Of course, then there are the non-newbies who have to bring stuff like
this up in what is meant to be polite conversation...

;-)

Seriously, I know you mentioned that a lot of stuff was being repeated
"ad nauseum".  I'm wondering if the FAQ should be updated, because it
seems as though some of the repeated questions aren't in the FAQ
(sometimes it's not in the man pages too).

- Tim


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

Date: Tue, 11 Mar 1997 12:12:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: bz7328113@ntuvax.ntu.ac.sg
Subject: Re: How to select either scripts for a form
Message-Id: <Pine.GSO.3.96.970311121039.695Q-100000@kelly.teleport.com>

On Tue, 11 Mar 1997 bz7328113@ntuvax.ntu.ac.sg wrote:

> Hi! I'm interested in finding how would I be able to select which perl
> scripts to run when I submitted a form. In other words, in the html
> file, there is a choice in < FORM ......ACTION= form1.cgi or ACTION =
> form2.cgi>

I don't believe that HTML has a way to do that, but if it does, the place
to ask would be a newsgroup about HTML, or its FAQ. On the other hand,
there's no reason that you couldn't write a script in Perl which would see
how the form was filled out and then exec the script of your choice. 
Well, no reason except security concerns! :-)  Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 11 Mar 1997 20:36:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Need Help installing Perl for Os2
Message-Id: <5g4fo3$q0b$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Erin McKean
<emckean@enteract.com>],
who wrote in article <5g43mv$p6j@eve.enteract.com>:
> Went out, got the new Camel from the Perl Institute,
> downloaded Ilya's Perl for OS2, unzipped it. . .and
> I'm stuck.

Sigh. Make _sure_ you've got the latest one (of last October).

Ilya


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

Date: 11 Mar 1997 16:19:21 GMT
From: rparkin@lynx.dac.neu.edu (Robert Parkin)
Subject: passing variables in Perl5
Message-Id: <5g40m9$srd@chaos.dac.neu.edu>

I'm new to Perl (using Perl5 on NT) and I'm trying to identify a way
to pass parameters from one script to another in a web application.
I'm using frames and I've got an href construct that passes a variable
from one frame to another.  The href in the first frame jumps to another
perl script (intermediary script) in another frame whose only job is to
set up 3 other frames.  The variable is successfully passed to the
intermediary frame by way ARGV; but, now I'd like to take the value in
ARGV and pass it along to one of the 3 new frames that are created.

Is this possible or am I simply going at it the wrong way?

Thanks in advance for any help you might offer!

Robert




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

Date: 11 Mar 1997 18:31:44 GMT
From: denismont@aol.com (Denismont)
Subject: perl and MQSeries
Message-Id: <19970311183101.NAA06418@ladder01.news.aol.com>

Has anyone written perl extension (XS) to get to the 
IBM MQSeries API.

I would be interested in it.

Thanks

Denis Montandon


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

Date: Tue, 11 Mar 1997 14:46:50 -0500
From: Tim Lewis <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
Subject: Re: PLEASE, HELP A NEWBIE!! 2nd attempt
Message-Id: <3325B6AA.2FF2@caesun.msd.ray.com.CLIP.THIS.PART>

Tad McClellan wrote:
> 
> Some news servers (Netscape) have a bug that truncates posts
> when they have a line with only a dot on them.
> 

The Netscape News Server works fine in this regard.  All NNTP news
servers will truncate a post when a "." by itself on a line followed by
a CRLF is received.  This is the way NNTP is defined.

I would be more inclined to say that his client didn't format the single
period correctly by appending another "." to it.

- Tim


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

Date: 11 Mar 1997 18:46:46 GMT
From: "James A. Tucker" <james@timetrend.com>
Subject: porting script from unix to nt
Message-Id: <01bc2e4b$f234c220$73591bcc@james.timetrend.com>

Are they any basic tips when porting from Perl 5.003 built on BSDI to Perl
5.003 for NT?  How do you adjust for the difference in paths, etc. I didn't
see any proting information in the FAQ.

TIA

James A. Tucker
Internet Administrator
Centuryinter.net - Region 1


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

Date: 11 Mar 1997 19:12:41 GMT
From: "Peter Sxnderby" <sonderby@vip.cybercity.dk>
Subject: Problems with search engine. Please help
Message-Id: <01bc2e50$f74b4d60$0681efc2@sonderby>

Hi there..

I4m working with a search engine which has to search a plain txt file. in
the format:

Filename |  filearea | description

I have two problems

1. When I get the search result the script cuts off the last letter. (eg.
ZIP becomes .ZI) ???? 

2 I would like to choose between 8 different txt files to search. I have
found a Perl script at http:www.technotrade.com which I have rewritten, but
i can4t implement the part concerning this problem..

Please take a look at http://www.oc.dk 

Here goes my script.  


Please reply in email sonderby@vip.cybercity.dk

-- 
Regards. Peter Sxnderby
Homepage at --> http://www.oc.dk


begin 600 opg.cgi
M(R$O8FEN+W!E<FP*(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C
M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,*"B,@("1L:6YK
M=&ET;&4L("1L:6YK9&5S8W)I<"P@)&QI;FMU<FP*"B,@9&5F:6YE('-O;64@
M9VQO8F%L('9A<FEA8FQE<PH*(" @("1F:65L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6YT("(\0E(^7&XB.PIP<FEN=" B/$)2/EQN(CL*<')I;G0@(CQ#14Y4
M15(^/$E-1R!34D,]7")H='1P.B\O=W=W+F]C+F1K+W!I8R]L:6YI934S,"Y'
M249<(B!W:61T:#TU,S ^/"]#14Y415(^7&XB.PIP<FEN=" B/$)2/EQN(CL*
M<')I;G0@(CQ#14Y415(^7&XB.PIP<FEN=" B/%1!0DQ%($)/4D1%4CTP(%=)
M1%1(/34R,"!#14Q,4U!!0TE.1STQ,#Y<;B(["@H@(" @)&-O=6YT97(@/2 P
M.PH*(" @('=H:6QE("@H)&QI;F4@/2 F<F5A9%]F:6QE*")&24Q%,2(I*2 F
M)B H)&-O=6YT97(@/" D<F5S=6QT<RDI('L*(" @(" @(" @(R!S<&QI="!T
M:&4@9FEE;&1S(&%T('1H92!\(&-H87)A8W1E<B @(" @"B @(" @(" @($!T
M86)L961A=&$@/2!S<&QI="@O7',J7'Q<<RHO+"1L:6YE("PD9FEE;&1S*3L*
M(" @(" @(" @("9C:&5C:U]R96-O<F0["B @(" @(" @("!I9B H)&9O=6YD
M(#T](#$I('L*(" @(" @(" @(" @)&-O=6YT97(K*SL*(" @(" @(" @(" @
M)G!R:6YT7W)E8V]R9#L*(" @(" @(" @('T*"B @("!]"B @("!C;&]S92A&
M24Q%,2D["B @(" C<')I;G0@(CPO54P^7&XB.PH*(" @(&EF("@D8V]U;G1E
M<B ]/2 P*2!["B @(" @("!P<FEN=" B/%12/CQ41#Y$97-VD7)R92 M(&EN
M9V5N(&]P9V%V97(@9G5N9&5T(3PO5$0^/"]44CY<;B(["B @("!]"B @(" *
M<')I;G0@(CPO5$%"3$4^7&XB.PIP<FEN=" B/"]#14Y415(^7&XB.PIP<FEN
M=" B/$)2/EQN(CL*<')I;G0@(CQ#14Y415(^/$E-1R!34D,]7")H='1P.B\O
M=W=W+F]C+F1K+W!I8R]L:6YI934S,"Y'249<(B!W:61T:#TU,S ^/"]#14Y4
M15(^7&XB.PIP<FEN=" B/$-%3E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92!R96-O
M<F0@<F5A9"!F<F]M('1H92!F:6QE+B D=&%B;&5D871A"@H@(" D;&EN:W1I
M=&QE(#T@)'1A8FQE9&%T85LQ73L*(" @)&QI;FMD97-C<FEP(#T@)'1A8FQE
M9&%T85LR73L*(" @)&QI;FMU<FP@(" ]("1T86)L961A=&%;,%T["B @(&-H
M;W H)&QI;FMU<FPI.PH*(" @("-B=6EL9"!T:&4@<V5A<F-H(&QI;F4@=VET
M:"!A;&P@9FEE;&1S('=E('=A;G0@=&\@<V5A<F-H(&EN"B @(" D<V5A<F-H
M;&EN92 ]("1L:6YK9&5S8W)I<#L*"@H@(" C<V5A<F-H(&)Y(&ME>7=O<F1S
M"B @(",@;VYL>2!P97)F;W)M('1H92!K97EW;W)D('-E87)C:"!I9B!T:&4@
M;&5N9W1H(&]F('1H92!S96%R8V@@<W1R:6YG(&ES(&=R96%T97(@=&AA;B R
M"B @(",@9&]N)W0@=&AI;FL@=V4@=V%N="!P96]P;&4@=&\@<V5A<F-H(&9O
M<B!A;F0@(&]R(&]R(&5T8RX*(" @)'-F;W5N9" ](# ["B @("1F;W5N9" ]
M(# ["B @("1N;W1F;W5N9" ](#$[( H*(" @)'-T;&5N(#T@;&5N9W1H*"1S
M96%R8VAS=')I;F<I.PH@("!I9B H)'-T;&5N(#X@,2D@>PH@(" @(" @0'=O
M<F1S(#T@<W!L:70H+R K+RPD<V5A<F-H<W1R:6YG*3L*(" @(" @("!F;W)E
M86-H("1A=V]R9" H0'=O<F1S*2!["B @(" @(" @(" @:68@*"1S96%R8VAL
M:6YE(#U^("]<8B1A=V]R9"]I*2!["B @(" @(" @(" @(" @(" @("1S9F]U
M;F0@/2 Q.PH@(" @(" @(" @('T@"B @(" @(" @(" @96QS92!["B @(" @
M(" @(" @(" @(" @("1N;W1F;W5N9" ](# ["B @(" @(" @(" @('T*(" @
M(" @(" @?0H@(" @('T*(" @(&EF("@D<V9O=6YD(#T](#$@)B8@)&YO=&9O
M=6YD(#T](#$I('L*(" @(" @(" D9F]U;F0@/2 Q.PH@(" @('T*"B @(" C
M(&EF('-E87)C:"!S=')I;F<@:7,@=&]O('-M86QL("XN('-E="!F;W5N9"!T
M;R Q"B @("!I9B H)'-T;&5N(#P](#$I('L*(" @(" @(" D9F]U;F0@/2 Q
M.PH@(" @?0H@(" @(VEF('!A9V4@9&]E<VXG="!H879E(&$@=&ET;&4@=&AE
M;B!R971U<FX@;F]T(&9O=6YD"B @(" D=&QE;B ](&QE;F=T:"@D;&EN:W1I
M=&QE*3L*(" @(&EF("@D=&QE;B \(#$I('L*(" @(" @(" D9F]U;F0@/2 P
M.PH@(" @?0I]"@H*"@IS=6(@<&%R<V5?9F]R;2!["@H@("!R96%D*%-41$E.
M+" D8G5F9F5R+" D14Y6>R=#3TY414Y47TQ%3D=42"=]*3L*(" @:68@*&QE
M;F=T:"@D8G5F9F5R*2 \(#4I('L*(" @(" @(" @)&)U9F9E<B ]("1%3E9[
M455%4EE?4U1224Y'?3L*(" @('T*( H@($!P86ER<R ]('-P;&ET*"\F+RP@
M)&)U9F9E<BD["B @(&9O<F5A8V@@)'!A:7(@*$!P86ER<RD@>PH@(" @(" H
M)&YA;64L("1V86QU92D@/2!S<&QI="@O/2\L("1P86ER*3L*"B @(" @("1V
M86QU92 ]?B!T<B\K+R O.PH@(" @(" D=F%L=64@/7X@<R\E*%MA+69!+48P
M+3E=6V$M9D$M1C M.5TI+W!A8VLH(D,B+"!H97@H)#$I*2]E9SL*"B @(" @
M("1&3U)->R1N86UE?2 ]("1V86QU93L*(" @?0I]"@H*"G-U8B!O<&5N7V9I
M;&4@>PH*("!L;V-A;" H)&9I;&5V87(L("1F:6QE;6]D92P@)&9I;&5N86UE
M*2 ]($!?.PH@( H@(&]P96X@*"1F:6QE=F%R+"1F:6QE;6]D92 N("1F:6QE
M;F%M92D@?'P*(" @("!D:64@*")#86XG="!O<&5N("1F:6QE;F%M92(I.PI]
M"@IS=6(@<F5A9%]F:6QE('L*"B @;&]C86P@*"1F:6QE=F%R*2 ]($!?.PH*
2(" \)&9I;&5V87(^.R @"GT*
`
end



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

Date: Tue, 11 Mar 1997 11:51:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Raymond Yu <rayyu@cup.hp.com>
Subject: Re: Q:How to turn off taint checking locally in a function?
Message-Id: <Pine.GSO.3.96.970311111208.695O-100000@kelly.teleport.com>

On Mon, 10 Mar 1997, Raymond Yu wrote:

> Can any one tell me how to turn off taint checking locally in a
> function?

You can't. Perl watches out for you even when you don't watch out for
yourself. :-)  (Actually, there is a way to turn off taint checking for
the rest of a process, but that won't help in this case.) 

> I would like to turn off taint checking because I need to do something
> like: 
> 
> 	unlink <*.dat>;
> 
> But with -T, I can't.

Sure you can. You need only to properly untaint things, and to ensure that
your PATH is set safely. See perlsec(1) for details. I think this will
work for most cases, though. 

    unlink map /(^\w+\.dat$)/ , glob("*.dat");

That is, it should work, and it will work, once you have version 5.004. In
current versions of Perl, you'll have to use something like this instead. 

    unlink map { if (/(^\w+\.dat$)/) { $1 } } glob("*.dat");

 ...although I'd generally prefer to unlink files one at a time, to check
each unlink for success or failure.

Why, you may well ask, does Perl not trust the glob function? (Or its
alias, <*.dat>.) The answer is a bit system-dependent, and what follows is
the Unix explanation.

The reason is that the current implementation of globbing has to call an
external process, usually /bin/csh, to do the work. Perl doesn't know
whether it can trust your csh to do the right thing. In some cases, it
will do something you might not have expected. For example,

    @sources = glob("*.c *.h Makefile");

In this case, @sources gets Makefile even if there isn't one. (This may be
fixed in a future version of Perl; then again, it may not.)

Incidentally, Perl won't let you pass tainted data to glob. And (since you
know that the argument of glob gets passed to csh) don't you rest more
easily to know that? 

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 11 Mar 1997 12:16:33 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Jonathan C. Willeke" <jwilleke@ix.netcom.com>
Subject: Re: Scope?
Message-Id: <Pine.GSO.3.96.970311121330.695R-100000@kelly.teleport.com>

On Tue, 11 Mar 1997, Jonathan C. Willeke wrote:

> According to the Camel book and the man pages, lexically scoped
> variables declared with my are not visible to to routines called in
> the current block.  

If they say that, they're mistaken. :-)  Lexically scoped variables are
only visible within their own scope, and scopes contained lexically within
their scope. Their scope extends from where they are created ('my $foo')
until the end of their enclosing block or file.

>     #!/usr/bin/perl -w
>     my $a = 1234;
>     print "called from main, \$a: $a\n";
>     scopeTest();
> 
>     sub scopeTest() {
>         print "called from scopeTest, \$a: $a\n";
>     }

Sure enough, the scope of &scopeTest is within the scope of that my
variable. Try putting your sub declaration before 'my $a' and it should do
what you expected. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 11 Mar 1997 12:09:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Geoffrey Hebert <soccer@microserve.net>
Subject: Re: So easy they do not explain pattern match.
Message-Id: <Pine.GSO.3.96.970311115345.695P-100000@kelly.teleport.com>

On Tue, 11 Mar 1997, Geoffrey Hebert wrote:

> Searching for an easy answer.  It must be easy, because the book did not
> explain what was meant. 

What book? Maybe you should take it back and ask for the Camel. :-)

> Perhaps if I were born into UNIX I would obviously know what is meant
> below. 

You mean born with a silver fork() in your mouth, no doubt.

> What do these mean -
> s/^/< /

The ^ is a "zero-width" assertion which matches at the beginning of a
line, in this case. (In fact, it's the beginning of the string, although
that distinction only matters if you might have a multi-line string.)
Since it's zero width, that means that there's nothing to replace.

Since the s/// operator here is not explicitly bound to any other argument
(see below), it's operating upon the default argument of $_ . So, it's
saying, "At the beginning of $_ , insert the string '< ' ." 

> $var=~s/\^/\n/          

In this case, the ^ is backwhacked. The backslash protects it from being
special, so it's just the caret character. Also, the =~ operator binds
this operation to $var instead of the default argument of $_ . And
finally, the \n refers to the newline character. So this statement is
saying, "Find the first caret character in $var, and if you find one
remove it and put the character newline in its place." Note that if there
is no caret character in $var, that statement won't change $var at all.

For further reading, I encourage you to read perlop(1) and perlre(1). It's
normal to need to read them more than once, even after you've been
programming Perl for a long time. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 11 Mar 1997 18:40:08 GMT
From: schip@lmsc.lockheed.com (Jan Schipmolder)
Subject: Re: Using the print-command with colors
Message-Id: <5g48u9$3gr@butch.lmsc.lockheed.com>

Mikael Hallendal (micke@cel95mhl.campus.mdh.se) wrote:
: I got a little problem.
: I want to use different colors in my output ..

That has nothing to do with perl (I think).
Why not post your question in an appropriate www or cgi group?
--
jan.b.schipmolder@lmco.com


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

Date: 11 Mar 1997 18:40:21 GMT
From: drig@accessccom.com (David Rudder)
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <5g48ul$glm@masters0.InterNex.Net>

Kenneth Lee (Kenneth_Lee@ml.com) wrote:
: On Fri,  8 Mar 1997 18:02:19 GMT, futureprog@bridge.net.NOSPAM.PLEASE
: (Future Programmer) wrote:

: Pray tell, what does this have to do with New York City food?  

Which brings up an important question.  Who eats better?  Unix admins or 
Windows admins?  Come to think of it, I'd bet that Apple people eat the best.
What with the name of the company being a fruit, they've got to get hungry.
And NYC is often called the "Big Apple".  So, perhaps we should stop annoying 
the rest of the world with this silly thread and talk about more important
things.

--
			-Dave
		   drudder@novitacom.com

Praise be to Simon's god Bugs Bunny


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

Date: Sun, 09 Mar 1997 16:01:03 GMT
From: johnl@calweb.com (John Lockwood)
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <5fumqk$35v$1@news.calweb.com>

"Terje A. Bergesen" <terjeber@eunet.spm-protect.no> wrote:

>> Unix appeals more to me and is more advanced technically, but I am
>> afraid that it is losing the market share to Windows 95.

Unix is more advanced technically?  That's interesting.  The last time
I installed a modem on Windows NT the OS found it for me.  The last
time I tried it on Unix I read about the nine files one had to edit,
then gave up.   It seems to me that Unix is losing market share
precisely because end users never make the programmer's mistake of
confusing technical advancement with obtuseness.

Regards,



John







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

Date: Tue, 11 Mar 1997 12:54:54 +0000
From: Charles Herold <cherold@pathfinder.com>
Subject: Why don't this helpful suggestions work?
Message-Id: <33255621.44EA@pathfinder.com>

Hi all,

I posted a query a few days back and got a couple of responses that
don't quite work, and I'm hoping someone can tell me why.  I have a
special circumstance, which is that I am not using Perl5 (explanation
below, since last time I got responses telling me I should use it).

Here's the problem.  I have this ugly set of if/else statements to set a
particular array, and I want a neater way to do it.  This is the code
that needs changing:

  if ($in{'op'} eq 'showcategory') {
        %scheme = %scheme_showcategory;
  } elsif ($in{'op'} eq 'showpage') {
        %scheme = %scheme_showpage;
  } elsif ($in{'op'} eq 'showbasket') {
        %scheme = %scheme_showbasket;
  } else {
        %scheme = %scheme_default;
  }
  if(!%scheme) {
        %scheme = %scheme_default;
  }  
  
  print "<head><title>Catalog Select</title></head>\n";

  print '<body';
  foreach $key (keys %scheme) {
 	print " $key=\"$scheme{$key}\"" if $scheme{$key};	
  } 
  print ">\n";


One response suggested something like this.  The fact that the map is in
there suggests he's ignoring the no perl5 limitation.  Anyway, line 3
won't work for me.

sub Header {
    my %scheme;
    $scheme && (%scheme = %{scheme_.$in{'op'}}) || (%scheme =
%scheme_default);
    print "<head><title>test</title></head>\n<body";
    print map { " $_=\"$scheme{$_}\"" if $scheme{$_}} keys %scheme;
    print ">\n";
}


The other guy gave a few perl4 responses.  He didn't mention how to set
up a foreach to try the first two, but the third one doesn't work.

	But even in perl4, there are several things you could do:

        print " $key = ",eval("\$scheme_$in{'op'}{\$key}"),"\"";

        print " $key=\"$scheme{$in{'op'}.$;.$key}\"";

        %scheme = eval('%scheme_'.($scheme?$in{'op'}:'default'));

Now, I tried an experiment to see if I could figure this out on my own. 
I found that scheme = %{'scheme_showpage'} works, and scheme =
%{"scheme_showpage"} doesn't, and this looks like the basic problem.

Any ideas?

WHY I'M NOT USING Perl5:

Alright, I am in production, not tech, i.e. I am not a programmer here. 
Since my boss knows I know a little Perl, she asked if it were possible
for me to modify a script, since tech was refusing to do it.  I looked
at the sc that the changes were generally within my field of knowledge,
and started working on it.  Unfortunately tech won't give me cgi-bin
permissions, so I'm just testing out chunks of this from the command
line.  Tech has now agreed to work on this in a couple of weeks, but in
the meantime I'm still modifying the script.  The script is in old perl,
I am not in tech, therefore I think it inadvisable of me to change this
script to perl5 and go through it fixing the things that must be fixed
when you make that change (i.e. changing @ to \@).  If I were in tech,
and this were actually my project I would change over, but I'm a wannabe
tech, with no leeway.

Okay?

-- 
Best regards,

       Charles Herold
         Production Assistant
          Pathfinder Production
           cherold@pathfinder.com
               (212) 522-5190


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

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

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