It would be nice to say this is for Win32. I had to comment out the &print sub and change it to sub print {return} to get this to run. Maybe you could do an OS check?
Like:
##############################
if ($^O =~ /Win/i) {
sub print {your sub.....}
}
else {
sub print {return}
}
##############################