Next You can't get there from here 26

Close but no cigar

     use Timeout;
     sub halts {
       my ($source_code, $input) = @_;
       my $function = eval $source_code;
       # Run the function for at most an hour
       my $finished = with_timeout 3600, sub { $function->($input) };
       if ($finished) { return 1 }  # It finished within an hour
       else           { return 0 }  # It was still running after an hour
     }
        sub halts {
          my ($source_code, $input) = @_;
          return 1;   # Yuk yuk yuk
        }

Next Copyright © 2005 M. J. Dominus