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

[MacPerl] System Crashes when I run this Small Program... why?



I wonder if anyone can help... I've been trying to test a little routine
under MacPerl. When I run it straight through it works fine. However, when
I debug it, it hangs my Mac after executing the 'print "Boo!";' line.

Each execution of the File_Year routine works fine. If I put "exit" after
the fourth File_Year, the debugger will crash the Mac after executing the
"exit".

There's got to be some silly thing I've overlooked... can anybody show me
what I've done wrong?

-Alex

----- BEGIN PERL CODE -----
#!/usr/bin/perl -w
use strict;

# Don't run this script in the debugger  unless:
#  - You have no other applications open
#  - There is a memory hole below the region
#    allocated to MacPERL
#  - You've got the time to wait for your Mac to restart
#
# Otherwise you'll be restarting your Mac... again and
# again and again.

print "19960701.01A -> ", File_Year("19960701.01A"), "\n";
print "19970630.01A -> ", File_Year("19970630.01A"), "\n";
print "19970701.01A -> ", File_Year("19970701.01A"), "\n";
print "19980630.01A -> ", File_Year("19980630.01A"), "\n";

sub File_Year
{
  my $year; my $month; my $day; my $folder;
  my $blah;
  $blah = $_[0];
  $blah =~ m[(\d\d\d\d)(\d\d)(\d\d)\.\d\d.]i;
  $year = $1;
  $month = $2;
  $day = $3;
  if ($month < 7)
  { $folder = $year }
  else
  { $folder = $year + 1 }
  return $folder;
}

print "Boo!";

----- END PERL CODE -----

Windows 95: n. 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company.



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