[23046] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5267 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 24 14:05:49 2003

Date: Thu, 24 Jul 2003 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 24 Jul 2003     Volume: 10 Number: 5267

Today's topics:
    Re: Adding color to print to console? <andrew_harton@agilent.com>
        Can one control swap in Perl? <irving_kimura@lycos.com>
    Re: Can one control swap in Perl? <abigail@abigail.nl>
    Re: Can one control swap in Perl? <jwillmore@cyberia.com>
    Re: Can one control swap in Perl? <goedicke@goedsole.com>
    Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0) <asu1@c-o-r-n-e-l-l.edu>
    Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0) <jwillmore@cyberia.com>
    Re: how to initialize size of DOS Window? <cuzin@adelphia.net>
    Re: JOIN problem ? (2nd attempt to post) <uri@stemsystems.com>
        newbie question <dhoutakethisout@rohan.sdsu.edu>
    Re: newbie question <asu1@c-o-r-n-e-l-l.edu>
    Re: newbie question <peter_wilson@mail.com>
    Re: newbie question <asu1@c-o-r-n-e-l-l.edu>
    Re: recompile Perl, with new function names ? <uri@stemsystems.com>
        reference symbol not found with UDUNITS <rokosz@udel.edu>
    Re: simple web site mapper <usenet@dwall.fastmail.fm>
    Re: simple web site mapper <grazz@pobox.com>
    Re: Style question regarding subroutines and lexical va <asu1@c-o-r-n-e-l-l.edu>
    Re: Style question regarding subroutines and lexical va (Tad McClellan)
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Jul 2003 16:27:23 +0100
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Re: Adding color to print to console?
Message-Id: <1059060364.961249@cswreg.cos.agilent.com>

Buteo Lagopus wrote:
> I have my lotto ticket checker "PERLotto.pl" that prints to the
> console winning hits for games but it has no "glitz." I thought,
> could I hilight the color of the matching numbers in the print
> statement?
>
> Currently a print line looks like this:
>
> 01 02 03 04 05  06  --5b  Hit: 01 02 03 04 05 06
>
> I'd like to know how to hilight/color/invert the numbers so I can get
> rid of the "Hit..." information.
>
> Can this be done and can someone steer me to some examples? Will this
> then be OS specific?
>
> Thanks,
>
> All the best,
>
> Andy
> print "What can possibly go wrong... go wrong... go wrong..."

If you're running it under Windows, use Win32::Console.


Andrew

--
$_="8fe403bc47120d12a0635912";$#=" eratcHhJklnoPsu";
split//;for(0..$#_){print substr($#,hex $_[$_],1);}




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

Date: Thu, 24 Jul 2003 15:21:16 +0000 (UTC)
From: Irving Kimura <irving_kimura@lycos.com>
Subject: Can one control swap in Perl?
Message-Id: <bfothc$ca1$1@reader1.panix.com>





I want to write a Perl script that will run as a daemon, and requires
a password (given to it interactively) for it to run.  This password
serves as a key to decrypt an encrypted data file used by the
daemon.  For security reasons, I want the value of this variable
to remain in memory throughout the daemon's run, and never be
swapped out to disk.  Is there any way that I can designate a
variable in a Perl script so that it will never be swapped out to
disk?

Thanks!

	-Irv



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

Date: 24 Jul 2003 16:31:30 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Can one control swap in Perl?
Message-Id: <slrnbi02f2.19a.abigail@alexandra.abigail.nl>

Irving Kimura (irving_kimura@lycos.com) wrote on MMMDCXIV September
MCMXCIII in <URL:news:bfothc$ca1$1@reader1.panix.com>:
--  
--  I want to write a Perl script that will run as a daemon, and requires
--  a password (given to it interactively) for it to run.  This password
--  serves as a key to decrypt an encrypted data file used by the
--  daemon.  For security reasons, I want the value of this variable
--  to remain in memory throughout the daemon's run, and never be
--  swapped out to disk.  Is there any way that I can designate a
--  variable in a Perl script so that it will never be swapped out to
--  disk?

No. 



Abigail
-- 
perl -Mstrict -we '$_ = "goto _.print chop;\n=rekcaH lreP rehtona tsuJ";_1:eval'


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

Date: Thu, 24 Jul 2003 16:41:11 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Can one control swap in Perl?
Message-Id: <20030724124236.1710282d.jwillmore@cyberia.com>

> I want to write a Perl script that will run as a daemon, and
> requires a password (given to it interactively) for it to run.  This
> password serves as a key to decrypt an encrypted data file used by
> the daemon.  For security reasons, I want the value of this variable
> to remain in memory throughout the daemon's run, and never be
> swapped out to disk.  Is there any way that I can designate a
> variable in a Perl script so that it will never be swapped out to
> disk?

As far as I know, the swap space/file is controled by the OS.  Plus,
on a Unix system, there are several exploits that will cause a core
dump - which includes memory.  Not to mention the fact that, when a
Unix system decides to go South, a core dump is usually done.  I'm
pretty sure the same type of situation can arise on other OS's. 
Memory is harder to get at, but not impossible.  So, the issue is
really how to protect the file that contains the password(s), not how
to prevent the password from being stored in swap space/file.

I take a 'bike lock' approach to security.  Once, I wanted to get a
top of the line bike lock, but the salesman looked at me and said -
bike locks are really suppose to keep honest people honest.  An
expensive bike lock won't stop a professional from getting the bike,
just the punk kid who wants to just walk off with it.  So, when it
comes to using scripts and Perl, I try to prevent 'snooping' and
script kiddies from gaining access, not the professionals.  If someone
wants to get a password, they will find a way if they're pros.

HTH

Jim


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

Date: Thu, 24 Jul 2003 17:23:40 GMT
From: William Goedicke <goedicke@goedsole.com>
Subject: Re: Can one control swap in Perl?
Message-Id: <m3d6fz96ul.fsf@mail.goedsole.com>

Dear Irving - 

>>>>> "Irving" == Irving Kimura <irving_kimura@lycos.com> writes:

    Irving> For security reasons, I want the value of this variable to
    Irving> remain in memory throughout the daemon's run, and never be
    Irving> swapped out to disk.

This sounds like the old "security through obscurity" fallacy.  Hiding
things isn't good security practice.

You'll be better served by devising a way of using encryption such
that finding your "value" doesn't help a cracker access your private
information.  Look for procedural combinations of one-way hash
algorithms like MD5 and public-key encryption like RSA2.

     Yours -      Billy

============================================================
     William Goedicke     goedicke@goedsole.com            
                          http://www.goedsole.com:8080      
============================================================

          Lest we forget:

Conversation: A series of digressions.

		- Kevin Montuori


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

Date: 24 Jul 2003 16:16:56 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0)
Message-Id: <Xns93C27CF29CDAEasu1cornelledu@132.236.56.8>

"marmot101" <marmot101@yahoo.com> wrote in
news:XyRTa.8$hn1.14408@news.uswest.net: 

> Thanks for your help!
> 
> 1. However, on Redhat Linux 9.0, I don't find file/directory "@INC", I
> even start searching it from
> /,
>     find . -name *@INC* -print
> And no result. Funny thing is, I installed another Perl-5.8.0 at
> /usr/local, there is still no "@INC"

You are a little confused here. @INC is not a physical directory. From 
perldoc perlvar:

@INC    The array @INC contains the list of places that the "do EXPR",
        "require", or "use" constructs look for their library files. 
        It initially consists of the arguments to any -I command-line
        switches, followed by the default Perl library, probably
        /usr/local/lib/perl, followed by ".", to represent the current
        directory. ("." will not be appended if taint checks are
        enabled, either by "-T" or by "-t".) If you need to modify 
        this at runtime, you should use the "use lib" pragma to get 
        the machine-dependent library properly loaded also:

            use lib '/mypath/libdir/';
            use SomeMod;

        You can also insert hooks into the file inclusion system by
        putting Perl code directly into @INC. Those hooks may be
        subroutine references, array references or blessed objects. 
        See "require" in perlfunc for details.


-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Thu, 24 Jul 2003 16:25:08 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0)
Message-Id: <20030724122633.13214c16.jwillmore@cyberia.com>


> 1. However, on Redhat Linux 9.0, I don't find file/directory "@INC",
> I even start searching it from
> /,
>     find . -name *@INC* -print
> And no result. Funny thing is, I installed another Perl-5.8.0 at
> /usr/local, there is still no "@INC"
> 
> 2. So I copy CGI.pm.newcgi as CGI.pm, now it works fine. But I
> really don't think that's the right way -- I can't believe that
> Redhat is so stupid that forcing user to make so weird copy.
> 
> 3. After this copy, perldoc -l CGI shows it at /usr/lib/perl5/5.8.0
> -- it gets satisfied now :-)

Okay - I see you're a 'newbie' to Perl.  I suggest you start reading
the documentation.

@INC is not a file or directory on the filesystem.  It's internal to
Perl.  It's an array of directories where Perl can find modules that
have been installed, as well as other files needed to run scripts.

perldoc is the command to use to see the Perl documentation.  You can
use the man command on Linux, but it's better to use the perldoc
command IMHO.  Start with 

perldoc perl

This will give a listing of all the other documents you can view to
get information on using Perl.

HTH

Jim


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

Date: Thu, 24 Jul 2003 15:18:50 GMT
From: "John Cugini" <cuzin@adelphia.net>
Subject: Re: how to initialize size of DOS Window?
Message-Id: <uNSTa.38537$8g6.985429@news1.news.adelphia.net>

Thanks everyone!
-- 
  ---   John Cugini / cuzin@adelphia.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

"John Cugini" <cuzin@adelphia.net> wrote in message
news:W2BTa.36599$8g6.634165@news1.news.adelphia.net...
> Running Active Perl on Windows XP: - when I execute a PERL script,
> a DOS-style command window is created - but it's always a mere 25 lines
> big.... how can I set it to other (larger) sizes.
>
> I set up a simple shortcut to the DOS window and it (the shortcut) has
> properties
> that let you adjust the window (font, color, size) ... but the executable
> itself
> (windows/system32/cmd.exe) does not.
>
> Thanks for any tips.




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

Date: Thu, 24 Jul 2003 15:25:00 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: JOIN problem ? (2nd attempt to post)
Message-Id: <x7he5ceylx.fsf@mail.sysarch.com>

>>>>> "s" == stu7  <stuseven@hotmail.com> writes:

  s> Uri Guttman <uri@stemsystems.com> wrote in message
  s> news:<x7oeznoyig.fsf@mail.sysarch.com>...
  >> >>>>> "s" == stu7 <stuseven@hotmail.com> writes:
  >> 
  s> *** ...sets out a bowl of sugar water, to attract more ***
  s> style-spammers
  >>  nah, you just made sure no one would help you by your attitude. i
  >> don't kill file but your posting style makes it easy for me to
  >> ignore you. try to get help here and you probably will not get it
  >> except from the newbies or clueless who don't know you yet.
  >> 
  >> uri

  s> *** Uri... you missed it.  I got my answer already.  *** There was
  s> no attitude... I asked a simple question, and *** got a quick
  s> answer.  *** *** What I took issue with was the large group of
  s> people *** who waste their time here style-critiquing every
  s> legitiamate *** question that is asked... why should I be friendly
  s> *** toward this unappreciated practice ?  *** You seem divided on
  s> whether to support those who ask *** legitimate questions, or those
  s> who choose to harangue them.  *** *** I dont care, really, one way
  s> or the other.  Im sorry, but *** your name calling insulting post
  s> isnt legitimatized by *** any responsibilty you feel you might have
  s> here.

you are clueless. you will remain so until you realize that what others
think about you matters. look at how a popular newsreader (check the
headers to find which one) reformated your stupid text. and i am not
calling you names. i am describing you with adjectives. and my
responsibility is to the perl community of which this newsgroup is a
part. you are not making yourself into a member of this community by
expressing such an attitude of do it my way or else. you would be better
off learning python and not perl as you are not open minded enough to
handle TIMTOWTDI.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 24 Jul 2003 16:20:40 GMT
From: hou <dhoutakethisout@rohan.sdsu.edu>
Subject: newbie question
Message-Id: <bfp10o$vuv$1@gondor.sdsu.edu>

Hello, everyone
      I am reading the "Beginning Perl" written by Simon Cozen.
In chapter 6, he gave an example as following.

------------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;

open FILE, "gettysburg.txt" or die $!;
my @speech = <FILE>;

print "Last five lines:\n", @speech[-5 ... -1];
------------------------------------------------

I thought the [-5...-1] was a typo. It's supposed to be [-5..-1].
So, I tried to use "three dots".  It turns out that three dots work.
Now, I am confused. Could anyone please tell what "three dots" means
in perl?

Thank you very much
Dean


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

Date: 24 Jul 2003 16:31:34 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: newbie question
Message-Id: <Xns93C27F6DD2E7Basu1cornelledu@132.236.56.8>

hou <dhoutakethisout@rohan.sdsu.edu> wrote in
news:bfp10o$vuv$1@gondor.sdsu.edu: 

> Hello, everyone

Hello. If you haven't done so already, please consult the posting
guidelines for this newsgroup. I mention this because you subject line
contains no information as to the nature of your question, and it looks
like you have not checked documentation available to you. 

> ------------------------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
> 
> open FILE, "gettysburg.txt" or die $!;
> my @speech = <FILE>;
> 
> print "Last five lines:\n", @speech[-5 ... -1];
> ------------------------------------------------
> 
> I thought the [-5...-1] was a typo. It's supposed to be [-5..-1].
> So, I tried to use "three dots".  It turns out that three dots work.
> Now, I am confused. Could anyone please tell what "three dots" means
> in perl?

Read in the section on range operators in perldoc perlvar. Here is a
snippet: 

<quote>

Each ".." operator maintains its own boolean state. It is false as long
as its left operand is false. Once the left operand is true, the range
operator stays true until the right operand is true, *AFTER* which the
range operator becomes false again. It doesn't become false till the
next time the range operator is evaluated. It can test the right operand
and become false on the same evaluation it became true (as in awk), but
it still returns true once. If you don't want it to test the right
operand till the next evaluation, as in sed, just use three dots ("...")
instead of two. In all other regards, "..." behaves just like ".." does.

</quote>


-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Thu, 24 Jul 2003 16:35:45 +0000 (UTC)
From: "Peter Wilson" <peter_wilson@mail.com>
Subject: Re: newbie question
Message-Id: <bfp1t1$r32$1@hercules.btinternet.com>

"hou" <dhoutakethisout@rohan.sdsu.edu> wrote in message
news:bfp10o$vuv$1@gondor.sdsu.edu...
> Hello, everyone
>       I am reading the "Beginning Perl" written by Simon Cozen.
> In chapter 6, he gave an example as following.
>
> ------------------------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> open FILE, "gettysburg.txt" or die $!;
> my @speech = <FILE>;
>
> print "Last five lines:\n", @speech[-5 ... -1];
> ------------------------------------------------
>
> I thought the [-5...-1] was a typo. It's supposed to be [-5..-1].
> So, I tried to use "three dots".  It turns out that three dots work.
> Now, I am confused. Could anyone please tell what "three dots" means
> in perl?
>
> Thank you very much
> Dean

Hi

look at perlop help (perldoc perlop) page from there the answer is written:

In scalar context, ``..'' returns a boolean value. The operator is bistable,
like a flip-flop, and emulates the line-range (comma) operator of sed, awk,
and various editors. Each ``..'' operator maintains its own boolean state.
It is false as long as its left operand is false. Once the left operand is
true, the range operator stays true until the right operand is true, AFTER
which the range operator becomes false again. It doesn't become false till
the next time the range operator is evaluated. It can test the right operand
and become false on the same evaluation it became true (as in awk), but it
still returns true once. If you don't want it to test the right operand till
the next evaluation, as in sed, just use three dots (``...'') instead of
two. In all other regards, ``...'' behaves just like ``..'' does.

Peter




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

Date: 24 Jul 2003 17:33:05 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: newbie question
Message-Id: <Xns93C289DB8A5ABasu1cornelledu@132.236.56.8>

"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in 
news:Xns93C27F6DD2E7Basu1cornelledu@132.236.56.8:

> Read in the section on range operators in perldoc perlvar. 

Meant perldoc perlop, sorry.


-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Thu, 24 Jul 2003 15:27:52 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: recompile Perl, with new function names ?
Message-Id: <x7el0geyh3.fsf@mail.sysarch.com>

>>>>> "n" == news  <news@roaima.freeserve.co.uk> writes:

  n> news@roaima.freeserve.co.uk wrote in message news:<io9vu-cf4.ln1@moldev.cmagroup.co.uk>...

  n> stu7 <stuseven@hotmail.com> wrote:
  >> *** I agree... this kind of new function is much easier...

  n> It would help so much if you'd quit top-posting, and if you would start
  n> to strip unnecessary quoted material. Do you really /want/ assistance,
  n> or are you just trying to annoy the regulars?

  >> *** thanks for the suggestion.

  n> Mostly no problem. But I'm not sure I'll bother next time, either.

i wish you had decided not to help him. note his followup to me in
another thread where he refers to your help and thinks he got it in a
proper way. now he thinks he can post in his inane style and someone
will respond. let's all ignore him this next time and watch his bile
spew forth. it always happens and can be fun to watch. 

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Thu, 24 Jul 2003 13:53:38 -0400
From: Randy Rokosz <rokosz@udel.edu>
Subject: reference symbol not found with UDUNITS
Message-Id: <3F201D22.5040302@udel.edu>

On a Solaris 7 machine, I had Perl 5.005_03 running with UDUNITS 
successfully.
I'm not sure what the relationship is between the two.  This perl is
/opt/gnu/bin/perl

I then upgraded perl to 5.8.0 and placed this in /usr/local/bin/perl,
keeping the old version where it was.  I eventually ran a perl script
that did a 'use UDUNITS' and it said that it couldn't locate UDUNITS.pm
in @INC.  I copied some of these files from the /opt/gnu/lib structure
to the /usr/local/lib structure (perhaps incorrectly?), and now I get:

ld.so.1: /usr/local/bin/perl: fatal: relocation error:
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/UDUNITS/UDUNITS.so:
symbol perl_get_sv: referenced symbol not found

How can I get the new Perl to call UDUNITS correctly?

Thanks!!!



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

Date: Thu, 24 Jul 2003 15:11:50 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: simple web site mapper
Message-Id: <Xns93C271E7596BAdkwwashere@216.168.3.30>

Dan Jacobson <jidanni@jidanni.org> wrote:

> Say, does this working simple web site mapper (vs. Eric Raymond's
> extra large version) have any stuffing hanging out that perl
> novice me ought to fix?  

My comments below are about style, because that's what really got my 
attention.

> Say, how does one do '/bin/sh -e' in
> perl?  Would rewriting it in python be as easy?  

I don't know much about Python, I've only played with it a bit.  But 
it would *force* you to use whitespace, which might not be a bad 
thing. :-)  If you're interested, grab a copy and try it:  
http://www.python.org

> Does perl have an
> internal "ls" that could be called as easy?  File::Find couldn't
> give me the ls -R order I prefer I suppose.  Goal: to use even
> less lines of code. 

Forget using less lines of code unless it makes the program more 
reliable and/or readable.  If I had to revise the code below the very 
first thing I would do would be to format it in a way that aids 
comprehension instead of hindering it.

Ok, so it's not a long, complicated program.  But even short programs 
can benefit from a readable style.  See 'perldoc perlstyle' for 
suggestions.
 
> use strict;
> require HTML::HeadParser;
> my $dir=<~/mywebsite>; #where files are on my computer
> my $name="Bob Blobkowski";
> my $url='http://blobkowski.org/';
> chdir $dir||die;

There's a low-precedence 'or' that you can use, too.

    chdir $dir or die "Cannot chdir to $dir: $!";


> print <<EOF;
><!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd"><HTML><TITLE>$name\'s site
                                                            ^^
It's not necessary to escape that single-quote after $name.

> map</TITLE> 
></HEAD><BODY><H1>$name\'s site map</H1>\n<P><A href="$url">$url</A>
>as of 
> EOF
> system "date"; print '</P><HR><PRE>';
> my $p = HTML::HeadParser->new; my $d;

$d?  What's $d?  I can figure it out from the code, but a more 
descriptive name would be useful.  If someone else needs to edit the 
code they'll appreciate a longer name -- and you might, too, when you 
come back to this program after a while and don't remember all the 
details.

Newlines and spaces are not a scarce resource.

> open LS, "ls -R|"||die;
> while(<LS>){ #order nicer than find(1)
>     chomp;
>     if(s@:$@@){$d=$_;next}

Why use a non-standard delimiter for the substitution operator when 
you don't need to?  s/:$// is pretty clear; s@:$@@ is slightly 
obfuscated, IMHO.

>     if(/\.(txt|html)$/){s@^@$d/@;s/..//;print "<A
>     href=\"$_\">$_</A>\n"; 

qq() would make that easier to read; you wouldn't need to escape the 
double-quote each time.  See 'perldoc perlop' for quote and quote-
like operators.

>        if(/\.html$/){$p->parse_file($_);print
>        "\t",$p->header('Title'),"\n";}}} 
> print "</PRE></BODY></HTML>";
> 

Just because you *can* eliminate whitespace doesn't mean you 
*should*.

That may be why no-one else has responded. (No-one had when I posted 
this, anyway)  

As for bugs, I haven't looked -- I was distracted too much by the 
style.

-- 
David Wall


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

Date: Thu, 24 Jul 2003 16:25:51 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: simple web site mapper
Message-Id: <jMTTa.12142$634.3756@nwrdny03.gnilink.net>

David K. Wall <usenet@dwall.fastmail.fm> wrote:
> Dan Jacobson <jidanni@jidanni.org> wrote:
> 
> > Does perl have an internal "ls" that could be called as easy?  
> > File::Find couldn't give me the ls -R order I prefer I suppose.

Have a look at File::Find's "preprocess" option.

    % perldoc File::Find

> > use strict;
> > require HTML::HeadParser;
> > my $dir=<~/mywebsite>; #where files are on my computer
> > my $name="Bob Blobkowski";
> > my $url='http://blobkowski.org/';
> > chdir $dir||die;
> 
> There's a low-precedence 'or' that you can use, too.
> 
>     chdir $dir or die "Cannot chdir to $dir: $!";

He'll *need* to use the low-precedence version or add some 
parentheses.

> > open LS, "ls -R|"||die;

Same thing here:

    % perl -MO=Deparse -e 'open LS, "ls -R|" || die'
    open LS, 'ls -R|';

-- 
Steve


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

Date: 24 Jul 2003 15:57:50 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Style question regarding subroutines and lexical variables
Message-Id: <Xns93C279B5317A3asu1cornelledu@132.236.56.8>

Malte Ubl <ubl@schaffhausen.de> wrote in news:bfot05$s5i$1@news.dtag.de:

> A. Sinan Unur wrote:
>> Regardless of language, if I see a method/function/subroutine being 
>> called with 30 arguments, I am inclined to think there is a design
>> issue. 
> 
> Just to make it clear. The design issue is not solved by using global 
> variables, which are only needed is a few corner cases of programming.

Of course ... I wasn't trying to say that having 30 global variables 
successively manipulated by a number subroutines is the better alternative, 
and I apologize if my post came across that way. 

Sinan.

-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Thu, 24 Jul 2003 11:00:42 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Style question regarding subroutines and lexical variables
Message-Id: <slrnbi00la.83r.tadmc@magna.augustmail.com>

Joseph Ellis <jandellis@hotmail.com> wrote:
> On Thu, 24 Jul 2003 08:51:28 -0500, tadmc@augustmail.com (Tad
> McClellan) wrote:


>>Using the ampersand is what allows cheating, so if you want to
>>eliminate the possibility of cheating, then eliminate the use
>>of ampersand on function calls.
> 
> Ahh...I see.  I was right though; I really don't know what I'm doing.


If you are just starting with Perl, then your plate is already
pretty full with things to look into.

You should apply the Pareto Principle in your effort to learn Perl.

   Knowing 20% of Perl can get 80% of commmon programming tasks done.

Concentrate on the most-important 20% first, move on to the others
much later when you have time (and you'll have more time because
the 20% you've learned is getting lots of your everyday work done).


> I don't understand what prototypes and prototype checking are all
> about.  


You probably don't need to (yet). Perl's prototypes are in the 80%.

The 20%-part of prototypes is simply:

   Do not circumvent them if they are present.

And you already know how to avoid circumventing them.  :-)

Prototypes have to to with argument checking, if they are present
then you must call the functions with correct argument types.


> I'll have to look that up.


Save the time for something with a larger payback, like reading any 
of these end-to-end:

   perldoc perlrun
   perldoc perldata
   perldoc perlsyn
   perldoc perlop
   perldoc perlsub

and maybe:

   perldoc perlintro
   perldoc perlrequick
   perldoc perlretut
   perldoc perlreftut
   perldoc perlvar

and know to look things up as needed in:

   perldoc perldiag
   perldoc -f             (perlfunc)
   perldoc -q             (perlfaq1 - perlfaq9)


:-)

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5267
***************************************


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