Re: TIMTOWDTDI, obfu and analyzis of code
by valdez (Monsignor) on Mar 12, 2003 at 12:37 UTC
|
| [reply] |
Re: TIMTOWDTDI, obfu and analyzis of code
by crenz (Priest) on Mar 12, 2003 at 12:27 UTC
|
To do large projects, you will have to learn how to do large projects and intimately know your development environment.
That holds true no matter what language or environment you use. I think the real problem is that for big C/C++ projects, people tend to hire C++ software developers. For big Perl projects, they tend to hire "web designers" that learned Perl along the way. And then they are astonished that their codebase is messy...
The good thing about Perl is that you can do small and simple projects without having a lot of background in software development. The even better thing is that Perl will allow you to do bigger projects and actually have fun at the same time. But it doesn't liberate you from knowing what you do.
So learning about Perl "don'ts" mostly means learning about software development "don'ts" and Perl idioms.
| [reply] |
|
OK - you could use that tool to see who of the hired programmers is not proffesional.
| [reply] |
Re: TIMTOWDTDI, obfu and analyzis of code
by theorbtwo (Prior) on Mar 12, 2003 at 12:03 UTC
|
I don't see <> as being bad, but have more things for the list:
- Using BAREWORD filehandles
- Not checking for return values (IMHO one of the most important things about OO filehandles is that they force you to check for errors, pretty much -- possibly more important then timely closes and clean namespaces)
- Any module longer then a few hundred lines (should be split up when possible)
- Not using DBI when applicable.
- Not using CGI.pm when applicable.
- String eval, string do.
- Assigning to $_ without localizing it.
Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).
| [reply] [d/l] |
|
$ echo >'|echo "Perl is my bitch"'
$ perl -ne 0 *
Perl is my bitch
$
but p5p seems to consider this a feature which stunned me into silence when I ran into it related to a patch I tried to write, Re: binmode for @ARGV (open.pm).
- tye | [reply] [d/l] |
|
Oh, I was thinking <>, the file-reading operator, not the specific code <> (AKA <ARGV>). Tye, I can see their point, that it changes the meaning of existing code... but making it taintable, putting a warning in the docs, and making an optional and fatalable default-on warning are are certianly called for -- just not silently changing the behaivor. OK, possibly changing existing behavor to make the <ARGV> magic use three-arg open, but only with a BIG FAT WARNING and a pragmata to change the behivor back.
Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).
| [reply] [d/l] [select] |
|
|
| [reply] [d/l] [select] |
Re: TIMTOWDTDI, obfu and analyzis of code
by hardburn (Abbot) on Mar 12, 2003 at 15:23 UTC
|
I wrote a similar tool used internally by my employeer. It uses File::Find to look for files with a given extension. A list of wanted extensions is kept in a hash with the value being a referance to a subroutine. The sub can then read in the file data and do some checks on it. The sub returns a hash which contains the results of those checks. The culmitive data is then used to build some HTML, which is saved to a file and can later be downloaded by our staff.
There are some limits to what you can do. Perl is really hard to parse, so a full syntax checker is pretty much out of the question. Something basic like if(/^\s*use strict/) is the best you can hope for. Still, it's better than nothing.
---- Reinvent a rounder wheel.
Note: All code is untested, unless otherwise stated
| [reply] [d/l] |
Re: TIMTOWDTDI, obfu and analyzis of code
by chromatic (Archbishop) on Mar 13, 2003 at 01:14 UTC
|
I have part of a bytecode analyser in progress. It's my intent to do something like the Stanford Checker. The next piece of the puzzle is matching subtrees. I have a good design, so it's just a matter of finding time.
| [reply] |
|
This is the first time I hear about the Stanford Checker. I googled verify.stanford.edu/SVC - but I don't see how it can apply here. Could you explain a bit?
| [reply] |
|
| [reply] |