[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Perl script 4->5 checker



Peter Prymmer writes:
| print if /\w+\'\w+/;
| # or - for the daring
| s/(\w+)\'(\w+)/$1::$2/

Don't! All the contractions and possessives in the comments or text in
the script will suddenly look odd, won::t they? Anyway, being ' still
works, I wouldn::t bother changing them. Just make sure you write new
code using ::.

|>   use of dbmopen, dbmclose (no longer in vogue)

Not in vogue, and the tie interface gives you greater flexibility,
but dbmopen and friends still work the same (assuming you build perl5
with the same DBM library as perl4), so I wouldn't change these either.
Again, just use tie in new code.

|>   use of keywords added in Perl 5 that weren't keywords before (e.g. my)

This one could be a problematic, but as Peter suggests, perl -w -c should
catch most of them. You could probably compile a list of the new keywords
and look for \b$keyword\b.

|>   what else?

The one that caught me was having e-mail addresses in text. perl4 would
look at "blm@halcyon.com", see that I didn't use @halcyon anywhere else
in the text, and treat @ as a literal. perl5 now complains.

|Beyond that you might try tossing a C<use strict;> at the top as well.

Unless you coded perl4 a lot differently than anyone else, this will
probably end up being more trouble than it's worth.

Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch