eval 'require GD'; if ($@) { # problems with GD, fall back to non-GD } else { # we have GD, go for it! }