[12228] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5828 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 29 14:07:18 1999

Date: Sat, 29 May 99 11:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 29 May 1999     Volume: 8 Number: 5828

Today's topics:
        ActiveState/ActivePerl <edmundp@bigfoot.com>
    Re: Can someone help me on this challenging problem? (Tad McClellan)
    Re: clearing output??? <portboy@home.com>
    Re: cont'd (Ronald J Kimball)
    Re: Dealer Locator <gellyfish@gellyfish.com>
    Re: file handling <rootbeer@redcat.com>
    Re: file handling (Larry Rosler)
        file upload <cyberjeff@sprintmail.com>
    Re: how can i produce graphical invoices using perl? <gellyfish@gellyfish.com>
    Re: installing module fails SOLVED!!! <hector29@icubed.com>
    Re: Is 'Global symbol "%s" requires...' Fatal? <rootbeer@redcat.com>
    Re: Is 'Global symbol "%s" requires...' Fatal? (Ronald J Kimball)
    Re: List lvalues and do - parser idiosyncrasy (Ronald J Kimball)
    Re: More errors I don't understand <rick.delaney@home.com>
    Re: pattern matching <rick.delaney@home.com>
    Re: perl -w, "uninitialized" variables, and the Perl la <macintsh@cs.bu.edu>
    Re: Perl and FUD [was: Safe.pm necessary for secure CGI nospam@domain.com
    Re: Perl scripts won't run on Linux (Tad McClellan)
    Re: Recursion with filehandle <rootbeer@redcat.com>
    Re: Upload file problem (Larry Rosler)
    Re: Using $_ on nested foreach degrades speed. <rick.delaney@home.com>
    Re: Using $_ on nested foreach degrades speed. (Ronald J Kimball)
    Re: Win32: using CPAN with Perl 5.005-03 and Cygnus too <gellyfish@gellyfish.com>
    Re: Y2K infected Perl code (Chris Nandor)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 29 May 1999 18:21:41 +0100
From: "Edmund Paddington" <edmundp@bigfoot.com>
Subject: ActiveState/ActivePerl
Message-Id: <375022a3@newsread3.dircon.co.uk>

I wonder if anyone can help me?

I've just started learning perl and CGI.  I am running windows 95 on an AMD
K6.  I've downloaded the ActiveState ActivePerl installer and at the same
time DCOM95 and I have installed both (DCOM first).  As I understand it,
output from any perl script is supposed to be routed to the browser,
allowing you to test cgi that is embedded in HTML documents from within your
browser, without having to bother your ISP (they want to vet each script
before allowing it to run).

This doesn't happen at all on my kit.  I didn't get the option during the
install which would allow me to specify output to the browser although I was
able to associate the filetype .pl with perl.exe.  In fact the only way I
can run a script is to double-clock on the .pl file, but what happens is
that a dos box appears and then disappears so rapidly that I cannot read
what it says.

Is this because I'm running IE5, not IE4 which is the browser mentioned in
the documentation.  I've read the install notes most thoroughly and I've had
a look at the website, but I can find no mention of IE5.

I have tried de- and then re-installing twice to see if I did something
wrong, and I am using the most recent build from the ActiveState site

Edmund Paddington




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

Date: Sat, 29 May 1999 05:18:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Can someone help me on this challenging problem?
Message-Id: <2eboi7.sbr.ln@magna.metronet.com>

adamfman@my-deja.com wrote:
: <snip> ... but because of
: > reasons out of my control, I will not be getting any new books for a
: long
: > time + I don't allready have an algorithm book.

: Why not try the library?  *Algorithms in C* by Robert Sedgewick is a
: classic.  It should be at most good libraries.


   Another popular book is:

      "Introduction to Algorithms", Cormen, Leiserson, Rivest

      ISBN: 0-07-013143-0


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 29 May 1999 08:13:01 -0700
From: "Mitch" <portboy@home.com>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: clearing output???
Message-Id: <199905290813010550.02DD2F95@mail>

Have a look at Perl FAQ 8..."How do I clear the screen?"

 .Mitch

*********** REPLY SEPARATOR  ***********

On 5/22/99 at 4:27 AM yfmayes@my-dejanews.com wrote:

>Hi,
>This is a really dumb question.  However, for
>some reason, I can't seem to find an answer in
>any indexes.  All I want to do is when is clear
>the screen in the script.  It would be just like a
>'clear' in unix or 'cls' in dos.
>thanks
>jm
>
>
>--== Sent via Deja.com http://www.deja.com/ ==--
>---Share what you know. Learn what you don't.---
>
>
>





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

Date: Sat, 29 May 1999 13:34:16 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: cont'd
Message-Id: <1dskhyx.cqadcts9g3mgN@p59.tc2.metro.ma.tiac.com>

Uri Guttman <uri@sysarch.com> wrote:

> look, several people have responded to you and we still don't understand
> your problem. you can embed newlines directly in single quoted
> strings. you can't interpolate \n into a single quoted string. so what
> are you actually trying to do? you show output you want but no data so
> how could we divine what you have? 

I hate to say this, Uri (no, actually, I don't :) but I understood
perfectly the question as asked in the original post.  The poster wants
to know the best ways to print newlines in various types of quoted
strings.


In double-quoted strings, one can use \n, or literal newlines.

print "Here is a newline\nand here is another
and that's it.";

Of course, one can print as many newlines in a single string as one
wants.

print "Here is a whole bunch of newlines\n\n\n\n\n\nand that's it.";


In single-quoted strings, one cannot use \n for newlines, but one can
still use literal newlines.

print 'Here is a newline
and here is another
and that\'s it.';


One way the poster is probably not familiar with is here-docs.

print <<END;
Here is a newline
and here is another
and that's it.
END


Of course, lest a newbie think here-docs are only for printing...

$string = <<END;
Here is a newline
and here are two more

and that's it.
END


The poster was clearly confused about the use of `, however, and should
read perlop for that.


Frankly, if you do not understand a poster's question, I would suggest
that it is more appropriate to wait and see if someone else understands,
rather than repeatedly harassing the poster.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 May 1999 15:16:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Dealer Locator
Message-Id: <7ip0d5$2pl$1@gellyfish.btinternet.com>

On Sat, 29 May 1999 00:19:52 GMT Benjamin Franz wrote:
> In article <7in2r0$p5n$6@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>>In article <374F11AD.82CF8977@coastalpet.com>,
>>	Webmaster <webmaster@coastalpet.com> writes:
>>: Does anyone know how to build a dealer locator? I've seen a quite a few
>>: web sites running them. I need the user to be able to input their zip
>>: code in a form and for that zip code to be compared to a text file on
>>: the server. The script will find the zip code on the text file that is
>>: closests to the zip code that was input by the user. In a nutshell I
>>: need to give the website user the ability to type in there zip code and
>>: find the nearest dealer in their area. I've seen this done but I'm not
>>: real sure how to go about doing it. Any help would be greatly
>>: appreciated.
>>
>>Maybe you didn't see this the first time around:
> 
> [big snip]
> 
> MJD is a little too pessimistic. It *IS* possible to make geographic searches
> usefully on things like _ZIPCode_. In my case, on telephone area code and
> local exchange. You buy the _coordinate based_ database from the appropriate
> people and _translate_ the numbers to the correct coordinates. Then you
> return a list of 25 or so closest locations according to Cartesian geometry.
> 

Same in the UK.  The Ordnance Survey in association with the Post
Office publishes the Address Point dataset that (theoretically )
gives the co-ordinates of every postal address in the country (Off to
comp.infosystems.gis if you want to talk about how good it is :) The thing
with UK post codes however is that they are bound to addresses rather than
to spatial co-ordinates - TN34 3DE is Tackleway, Hasting, TN34 3BJ is
All Saints street numbers 20 - 74 etc however you could conceivably find
some 'centre' if nothing more than the average Eastings, Northings.

I havent got a sample dataset at the moment otherwise I'd do some examples,
I'll try and find some and get back.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 29 May 1999 09:00:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: file handling
Message-Id: <Pine.GSO.4.02A.9905290859220.4499-100000@user2.teleport.com>

On Sat, 29 May 1999, pommes frites wrote:

> open(Ziel,">lva.dat");
> open(Quelle,"<lva.tmp");

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.
Also, it's generally a good idea to use all caps for naming filehandles
(ZIEL and QUELLE). Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Sat, 29 May 1999 09:43:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: file handling
Message-Id: <MPG.11b9b91b6f4ed231989b32@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <374fb0b2.5979876@news.univie.ac.at> on Sat, 29 May 1999 
09:25:42 GMT, pommes frites <pommes.frites@gmx.net> says...
> hi i am a beginner in perl and i have the following problem ...
> i create a file "lva.tmp" in my progarm (its a file with text entries)
> and i want to overwrite the entries in "lva.dat" with those in
> "lva.tmp".
> i have written this code and it doent work
> 
> open(Ziel,">lva.dat");
> open(Quelle,"<lva.tmp");

I won't repeat TomP's trenchant observations about these opens and the 
filehandles.

> while(<Quelle>) {
>   print Ziel $_;
> }
> 
> so my questions ...
> is this code ok?

Sure.  But you could write the copy loop simply as:

  print Ziel <Quelle>;

if the file isn't too large to fit conveniently in memory.

  print Ziel while <Quelle>;

is the same as your loop, with less punctuation.

> does anyone know a better one? (dele .dat file and rename .tmp file)

The snippet above copies the file.  If all you want to do is rename it, 
then do so.

perldoc -f rename

> do i have to set special rights for these files?

The user account under which the program is running has to have 
read/write/execute permission for the directory in which the new file is 
being created.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 29 May 1999 12:06:06 -0400
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: file upload
Message-Id: <3750106D.A20C30C2@sprintmail.com>

   I'd like to be able to upload a file to a server. I can do this using
CGI.pm and '<input type=''FILE">' to create the file handle. If I pass
this without using <input type="FILE"> I'll upload zero bytes.

   I'm unsure of the differences between reading a file handle created
by FILE and just writing the assignment.

  I realize this is a stupid newbie question and that this is more a CGI
question but I can't post to comp.infosytems.www.authoring.cgi (???) so
you are stuck with me!!!

Jeff




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

Date: 29 May 1999 15:51:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how can i produce graphical invoices using perl?
Message-Id: <7ip2ep$2ps$1@gellyfish.btinternet.com>

On Thu, 27 May 1999 08:09:35 GMT smnayeem@my-deja.com wrote:
> I need to produce reports using perl, say with different font size and
> then also using symbols etc. does anyone how i can do this, i cant seem
> to be able to print anything other than ordinary big text using perl.
> can anyone help?

I have a bunch of programs that make nroff marked up output that can
be postprocessed by well nroff (or whatever) works nicely if you can
learn nroff.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 29 May 1999 11:18:04 -0400
From: LordHector <hector29@icubed.com>
Subject: Re: installing module fails SOLVED!!!
Message-Id: <3750052C.1550F05B@icubed.com>

Hi all,

	Silly me... I forgot to make sure /usr/src/linux was a symlink to
/usr/src/linux-2.0.36 (my current kernel source tree).

	I was able to successfully compile the lastest version of perl... now
off to get the Tk module I wanted in the first place...

Hector

LordHector wrote:
> 
> Hi,
> 
>         I wanted to install some modules from CPAN. Seemed to work great until
> the compile stage. The compile gives errors about not being able to find
> stuff, and wont install without force. I can't seem to find any doc that
> will tell you what is required.
> 
>         I have a regular install of perl 5.004_04 that came with linux and
> seemed to work (perl -e 'print "Hello, Dork"\n'). I know how to use cpan
> and indeed, installed some modules on a different machine just fine.
> (Same distribution of Linux and perl -v).
> 
>         Has this happened to anyone else, am I just forgetting to set some
> environment variables or what...Should I just reinstall perl?
> 
> Thanks for help!


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

Date: Sat, 29 May 1999 09:19:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Is 'Global symbol "%s" requires...' Fatal?
Message-Id: <Pine.GSO.4.02A.9905290901470.4499-100000@user2.teleport.com>

On Sat, 29 May 1999, Makoto Ohnuki wrote:

> I want to create subroutine in eval '' . (subroutine body is defined
> another file by somebody) For find strange code , I create sub with
> 'use strict qw(vars subs refs)' .
> 
> But, in case of above program, I get this result,
> 
>     Global symbol "$no_var" requires explicit package name at (eval 1)

> Why I cannot catch this error at eval-1?

For reasons unknown to me, the error message is going through the warn
mechanism rather than being trappable by the eval. Could be a bug in Perl.

But you can use that warn mechanism to make the error trappable. I'm
appending some sample code showing one way to do it by trapping warnings
which happen inside a "naked" block. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/

#!/usr/bin/perl -w

use strict;

# Uncomment one of these two lines in order to make this work.
# my $global;
# use vars qw/ $global /;

my $non_strict_code = q{
    sub bad {
	++$global;
    }
};

{
    local $SIG{'__WARN__'} = sub {
	# Make strict warnings (and others) fatal during compilation.
	die @_;
    };
    eval $non_strict_code;
    die "Error message caught by eval: '$@'.\n" if $@;
}

print &bad, " ", &bad, " ", &bad, "\n";

__END__



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

Date: Sat, 29 May 1999 13:34:14 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Is 'Global symbol "%s" requires...' Fatal?
Message-Id: <1dskhds.1tqtw6ag0frz4N@p59.tc2.metro.ma.tiac.com>

Makoto Ohnuki <yu5m-oonk@asahi-net.or.jp> wrote:

> I want to create subroutine in eval '' . (subroutine body is defined another
> file by somebody)
> For find strange code , I create sub with  'use strict qw(vars subs refs)' .
> 
> But, in case of above program, I get this result,
> 
>     Global symbol "$no_var" requires explicit package name at (eval 1) line
> 4.

That's one of the errors you get when you 'use strict;' and don't
actually write strict code.  As the documentation for the strict pragma
explains, you must predeclare or qualify your variables:

use strict;
use vars qw($no_var);
$no_var = 10;

use strict;
my($no_var);
$no_var = 10;

use strict;
$package::no_var = 10;


I'm not sure why you're trying to return the value of a variable that
doesn't exist, so I don't know which of the above would be most
appropriate in your code.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 29 May 1999 13:34:15 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: List lvalues and do - parser idiosyncrasy
Message-Id: <1dskhnw.d70031fsmgjzN@p59.tc2.metro.ma.tiac.com>

Brian McCauley <B.A.McCauley@bham.ac.uk> wrote:

> Is this bug or what?
> 
> ( do { @a } ) = ("x","y");
> 
> Error: Can't modify array deref in scalar assignment
> 
> Why is this seen as a scalar assignment?

And why is it seen as an array dereference?


> I could understand this if singleton lists of lvalues usually resulted
> in scalar assignments - but they don't:
> 
> ( $a ) = ("x","y");  # Sets $a to "x" not 2.
> 
> I can work arround this idiosyncrasy as follows:
> 
> ( do { @a }, undef ) = ("x","y");

Interestingly, the above line gives an error in the debugger:

Bizarre copy of ARRAY in leave at (eval 3) line 2


Perhaps the lesson here is that you shouldn't use do { } as an lvalue.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 29 May 1999 16:56:25 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: More errors I don't understand
Message-Id: <37501BE3.E4E20BD4@home.com>

[posted &mailed]

Bill Moseley wrote:
> 
> First, the copy (backup) of the database files failed.  My log file 
> had this in it:
> 
>   Maintenance run started at: Mon May 24 02:00:02 1999
>   ERROR: copy (cp) returned '65535' attempting to copy 'Mon' backup
> 
> And the perl that generated this error is:
> 
>     # using a shell for globbing
>     my $rc = 0xffff & system("cp *\.db Backup.$day");

If you're going to shell out to a command, then log the stderr from the
command, not just it's exit value.  See perlfaq8, "How can I capture
STDERR from an external command?"

[snippage]

 
> The other problem is that the "open3: fork failed" was a fatal error 
> and processing didn't continue after that error.
> 
> Any suggestions on how I can trap the "open3: fork failed" fatal error 
> so I can continue processing?  I don't want the program to stop 
> running just because it failed to send mail.

perldoc -f eval

eval {
    open3( $in, $out, $err, $params )
};

print LOG $@ if $@;

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 29 May 1999 16:00:59 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: pattern matching
Message-Id: <37500EEE.C201CE74@home.com>

[posted & mailed]

Frank Hale wrote:
> 
> How can I match newlines in patterns?

I'm going to assume you mean, "match newlines in strings".  The pattern
is what's between //, the string is in the scalar to the left of =~.

I'm assuming this because there are no newlines in the pattern
/template{(\d\D)}/.

> for example:
> 
> if ($token =~ /template{(\d\D)}/) {
>         print $token."\n";
> }

The only part of this pattern that would match a newline is \D since \n
is not a digit.  Setting

$token = 'template{5
}';

gives a match for me.  Perhaps you meant to ask something else?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 29 May 1999 17:32:08 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ip8ao$901$1@news1.bu.edu>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> The danger is that the values of your variables were probably left
> uninitialized by mistake.  For example:

My issue is with the concept of "probably."  In the situations you
listed, there's no ambiguity about what will happen with the
"uninitialized" values.  If they really are uninitalized, you'll
get undef or an empty string.  Big-brother-ish second-guessing of
programmer intentions in the hopes of spotting errors is not part
of The Perl Way, IMO.  Yes, that's why -w is optional, but it's a
shame that -w is straddled with such a mix of what could probably
be considered "warning levels."

The shenanigans required to make -w completely happy are well
beyond the scope of "good programming practices," IMO, and venture
into the land of "serve the machine"-type busywork.  I cringe
every time I see a "# to satisfy -w" comment next to some obscure,
needlessly complex programming construct*.  But the genuinely good
bits of -w are so compelling that most serious perl programmers
develop under it anyway.  I'd like to see some sort of separation
within -w in the future.  Maybe -w1, -w2, etc. to indicate the
level of persnicketiness.

* See "$foo = ${[split(' ', $goo)]}" in another recent clpm thread.

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: Sat, 29 May 1999 17:11:28 GMT
From: nospam@domain.com
Subject: Re: Perl and FUD [was: Safe.pm necessary for secure CGI?]
Message-Id: <37501fc0.1b85$347@news.op.net>

Greg McCann (gregm@well.com) wrote:
:>Greg McCann wrote:
:Thanks Simon. I've been reading up on security issues. I think I'm starting to
:get a handle on it, but I don't know enough to deal with FUD as quickly as some
:people can sling it.


"Program testing can be used to show the presence of bugs,
but never their absence."  (Edsger Dijkstra)

The same is true of security holes.  

Whenever someone starts complaining about security issues, 
the best thing to do is to demand specifics.  If the person
believes that there really are security problems with a piece
of software, then they should be able to describe the (potential)
problem in detail.  

If someone says "Perl is full of security holes," just demand
that they describe one of these alleged holes, and how their 
alternative software fixes the problem.  If they can't answer
your question suffiently, then you are free to tell them
that they are full of hot air.  (And if they *do* answer 
the question sufficiently, then maybe you will learn something.)

Don't ever let anyone maneuver you into trying to demonstrate
the absence of security holes, because it's impossible.  

--
##--------------------------------
##  John Nolan
##  jpnolan op net 
##--------------------------------         


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

Date: Sat, 29 May 1999 06:38:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl scripts won't run on Linux
Message-Id: <13goi7.sbr.ln@magna.metronet.com>

jmoram@my-deja.com wrote:
: I've just set up at a Linux box as an intranet server. Perl seems to be
: installed ok, but I can't seem to run scripts. 


   Since you say "seems to be", we are to assume that it is
   in some kind of "out of the box" setup and that you did not
   do a normal install yourself?

   (some distributions don't keep up with recent versions of perl)


: The GNU C compiler is
: installed and 


   If perl has already been built then you don't need a C compiler
   anyway (may be needed for installing some non-bundled modules).


: I've made sure the scripts are executable, but when I give
: the command to run them, I get this message:
: $ bash: command not found <scriptname>

: Is there a config file I need to modify? 


   No.


: Any suggestions would be
: appreciated. Thanks in advance.


   1) See if perl is installed somewhere in your path:

      which perl

         1.1) if that doesn't find anything, then you need to
              go root around and find out where it got installed.
              (look in /usr/bin/ and /usr/local/bin/ et al)


   ( assume perl is installed at:      /usr/bin/perl  for the below)


   2) Find out what version you have, and see if perl will
      execute at all:

      /usr/bin/perl -V

      or

      /usr/bin/perl -v


      Decide if it is a "recent enough" perl version. 

      If not, then go to CPAN and get a newer perl.



   3) Try giving the script directly to perl:

     /usr/bin/perl -w scriptname



   If all of that works, then it seems that the essentials are in place.

   Then just adjust your path, shebang line etc to suit your tastes.

    
--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 29 May 1999 09:25:13 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Recursion with filehandle
Message-Id: <Pine.GSO.4.02A.9905290922560.4499-100000@user2.teleport.com>

On Sat, 29 May 1999, Hugh Denman wrote:

> I'm trying to write a script to remove brackets from all filenames in
> a directory tree.

Don't reinvent the wheel. Use File::Find, or a similar module, or you'll
have to solve problems like handling symbolic links all over again. Good
luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 29 May 1999 09:27:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Upload file problem
Message-Id: <MPG.11b9b54b9d60cf02989b31@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <927938023.470@www.remarq.com> on Fri, 28 May 1999 16:33:41 -
0800, lunaboy <kinmich1@lycoming.edu> says...
> I'm writing a cgi script that takes a file from the user's
> local machine and uploads it to the server the script is
> running on. I'm not having any luck at all. I'm using
> perl/mySQL/CGI.pm and trying to save 2 types of files: image
> and text.
> 
> What it needs to do is use an HTML form to get the file from
> the user, and upload it to /cgi-bin/text or /cgi-bin/img. I
> have the directories chmod'ed to 777, but when it creates
> the file:
> 
> open(LOCAL, ">$local_filename") or die "$!";
> 
> it creates a file that's chmod'ed 744.
> 
> Can anyone suggest an easy way, a module, anything that can
> help me with my problem?

It might help if you stated what your problem is.

The permissions on the directories have nothing to do with the 
permissions on the files created in them.  I would have no problem 
understanding that a file might be created 644, based on the default 
umask setting of 022.  The 744 seems strange.

If you want different permissions, just have the program chmod the file 
after it has been created.  The 777 permissions on the directory should 
allow that.  Or set the umask before creating the file.

perldoc -f chmod
perldoc -f umask

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 29 May 1999 16:21:48 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Using $_ on nested foreach degrades speed.
Message-Id: <375013C9.AC8A862E@home.com>

[posted & mailed]

Charles R. Thompson wrote:
> 
> Is this because $_ was set in the outer loop and Perl has to do some 
> kind of initialization when it is set again on the inner loop?

Sort of.  $_ is localized to each foreach loop, meaning the previous
values of $_ must be saved somewhere (a stack) temporarily and restored
when the nested loop is finished.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 29 May 1999 13:34:18 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Using $_ on nested foreach degrades speed.
Message-Id: <1dskitp.lu1o431jr5erhN@p59.tc2.metro.ma.tiac.com>

Charles R. Thompson <design@raincloud-studios.com> wrote:

> In this loop I have noticed that using $_ with foreach loops really gets
> me some speed on the inner loop. However.. outer loops are a different
> matter. The outer loop seems to degrade by about 7-8/10's of a second
> when I do this...
> 
>   my $r = 0;
>   my @cache = '';
>   my $temphold = $TABLES{$CUR_TABLE};
> 
>   foreach (@temp){
>     @cache = split(/\|/, $_);
>     foreach (sort keys %{$temphold->{fields}}){
>       $temphold->{rows}[$r]{$_} = $cache[$temphold->{fields}{$_}{col}];
>     }
>     $r++;
>   }
> 
> Is this because $_ was set in the outer loop and Perl has to do some kind
> of initialization when it is set again on the inner loop?

Actually, it's probably because $_ is an alias into @temp from the outer
loop, so the inner loop is modifying the contents of @temp.  That's
extra work it didn't have to do in the other code sample.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 May 1999 15:27:54 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Win32: using CPAN with Perl 5.005-03 and Cygnus tools?
Message-Id: <7ip11q$2po$1@gellyfish.btinternet.com>

On Fri, 28 May 1999 16:27:54 GMT Denis.Haskin@bigfoot.com wrote:
> I'm having difficulty getting CPAN to install Bundle::libnet.  It
> complains about not finding a Bundle file in
> Bundle-libnet-1.00.tar.gz.
> 
> I can find no evidence in newsgroups or FAQs that this is a known
> problem.
> 

I dont understand why you are trying to use CPAN on ActivePerl when you
can use PPM :

C:\>  ppm install libnet

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 29 May 1999 16:42:31 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Y2K infected Perl code
Message-Id: <pudge-2905991242370001@192.168.0.77>

In article <7imt5t$3ep$1@nnrp1.deja.com>, finsol@ts.co.nz wrote:

# Lane's point still holds - a programmer can create Y2K problems in COBOL
# and in Perl. Just because a particular language makes this particularly
# easy to do (as with Perl and as with languages that have non-compliant
# components) doesn't change the fact.

Flexible languages are inherently more broken!  Woop!  And because I can
easily crash my computer with C, C is broken, too.

Perl doesn't just have Y2K problems, though.  It has compiler problems. 
Witness this perfectly good code:

  if ($x == 1)
     print $x;

perl reports that this obviously proper code has syntax errors!  If code
this simple doesn't compile, it must be the language's fault.

I mean, I know the documentation says this is wrong, but we don't trust
documentation, because "we are accustomed to writers of technical manuals
giving obscure explanations instead of simple answers."

This syntax is very standard, and doesn't work in Perl, so Perl must be
non-compliant and broken.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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