Moving files

pll at lanminds.com pll at lanminds.com
Mon Jan 6 13:40:44 EST 2003


In a message dated: Mon, 06 Jan 2003 13:13:18 EST
Derek Martin said:

>> How is it cryptic?
>
>In each case, it is the BLOCK which is unintelligible.  
[...snip...]
>For example, take the grep.  It never would have occurred to me to do a
>file test as part of the expression...

It's not an expression, it's a BLOCK of code, the two are different.

>grep looks for patterns.

That is a mistaken assumption on you part.  You read the docs which 
clearly state that the perl grep function operates on BOTH blocks and 
expressions.

>Now that I know what map does, I begin to see how you're using it,

So, you concede if someone doesn't understand the code, they 
read the docs, and then it makes more sense, they have expanded their 
knowledge, and that it might no longer be cryptic?  What a novel idea :)

>but I still get a headache from looking at it.

Why, it's nothing more complicated than anything in your own program. 
It's just different.  The regexp certainly wasn't difficult to grasp 
to someone like your self, so that can't be it, and a file test 
operator is pretty basic shell code syntax, all I did was join them 
with a && operator.  Are you saying that compound statements are too 
difficult to understand?

>And I would definitely not expect a Perl newbie to understand it at first glance,

And you would expect a shell newbie to understand 
this:

  for i in "`ls -a | grep '^[^.]'`"; do [ -f "$i" ] && f=`echo "$i" |\
  sed 's/ /_/g'` && mv "$i" $f; done

Which does basically the same thing as my perl code.
Or, how about your "basic" autoconf configure shell script?  It's all 
straight forward shell code in there.  Do you expect a newbie to 
understand that stuff?

>It's easy for you and Kevin to say how readable the code is,
>as you've both been writing Perl code forever.

And we both started out as perl newbies at one time too!
I can't speak for Kevin, but I learned perl primarily from reading
comp.lang.perl, then hitting the docs when I didn't understand 
something.  I am by no means a perl wizard, but I also don't feel 
that what I write is unreadable.

>But I'm telling you, for someone who ain't a perl hacker,
>what you guys wrote is gobbledygook.

At first glance, maybe, but it's less than 5 minutes reading the docs 
to figure it out for some one who cares.

And again, it was a one-liner, which by definition, is never going to 
be as readable as a properly indented/formatted program file.

>- -- 
>Derek D. Martin
>http://www.pizzashack.org/
>GPG Key ID: 0xDFBEAD02
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.0.7 (GNU/Linux)
>
>iD8DBQE+Gcc+HEnASN++rQIRAlaHAJ9hbfzr7VFisZwNRNAwgCaVYR/U+gCfc236
>QnNLYfBeSrHQkluDzbttEDc=
>=GICm
>-----END PGP SIGNATURE-----
>_______________________________________________
>gnhlug-discuss mailing list
>gnhlug-discuss at mail.gnhlug.org
>http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
>

-- 

Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853  E808 BB07 9239 53F1 28EE

	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!





More information about the gnhlug-discuss mailing list