Fascinating stream of comments from many who appear to be Microsoft employees:
Mini-Microsoft: Vista 2007. Fire the leadership now!
Thursday, March 30, 2006
Sunday, March 26, 2006
Net Neutrality - where are we now?
Does this sound familiar:
(See also: The Communications section of The WELL gopher.)
The battle is about who will build, own, use and pay for the high-speed data highways of the future and whether their content will be censored.Roger Karraker wrote that in his 1991 article, "Highways of the Mind" and the article is still relevant today. Have a look.
(See also: The Communications section of The WELL gopher.)
Tags: net neutrality, internet, policy
Saturday, March 18, 2006
Perl BEGIN Blocks Considered Harmful
Adam Kennedy pointed this out to me:
This will print hello world, even though "all" you did was compile the file.
What's going on here?
Well, BEGIN blocks get executed when Perl compiles the file.
So what?
If you run
Consider this:
You're screwed.
So, keep in mind that "just compiling" Perl code may actually execute the code, so, be careful!
Here's a bug report on this subject that I filed for the Eclipse/EPIC Perl IDE.
- Create a new Perl file containing the following:
BEGIN {
print "hello world\n";
} - Check the syntax with
perl -c filename
This will print hello world, even though "all" you did was compile the file.
What's going on here?
Well, BEGIN blocks get executed when Perl compiles the file.
So what?
If you run
perl -c
on a file that contains nasty code in a BEGIN block, you're screwed.Consider this:
- You associate the filename extension .pm with a fancy Perl editor, like Komodo, or Affrus.
- You click on a link in your web browser.
- The web server redirects you to a URL for nasty_file.pm
- Your browser opens the associated editor and performs a"syntax check" by compiling the file
- The file's BEGIN block has naughty code in it...
You're screwed.
So, keep in mind that "just compiling" Perl code may actually execute the code, so, be careful!
Here's a bug report on this subject that I filed for the Eclipse/EPIC Perl IDE.
Thursday, March 16, 2006
Testing if a Perl script compiles - compile_ok
A co-worker and I were pair programming a test suite the other day, and needed to test if a Perl script compiles - not a library or module but an executeable script, so the typical:
The short story is that we ended up doing something like this:
require_ok()functions provided by Test::More don't do exactly what we wanted.
use_ok()
The short story is that we ended up doing something like this:
eval {We later looked for a more general, better solution, and a colleague posted on the perl-qa mailing list, but the bottom line is that a more elegant solution still involves executing a new perl interpreter, but in a platform-independent way (perhaps using
$output = `perl -c $script 2>&1`;
chomp $output;
};
is($output, "$script syntax OK", "$script compiles");
IPC::Open3
or something.) It's also likely that a better test is to ignore the output altogether and just check the return code from the compile process (the call to perl -c
.)Tags: perl, testing
March 18, 2006 update: Jeff Thalhammer found that a colleague Pierre Denis provides a syntax_ok method in Test::Strict that does what we want.
More update - I was prodded by Randall Schwartz to post why you should be careful when "only" compiling Perl code - see BEGIN Blocks Considered Harmful.
Subscribe to:
Posts (Atom)