System error

error:  Can't call method "mode" on an undefined value at /var/www/cs/perl/Wikiacademia/Utilities.pm line 442.
context: 
... 
438:  for my $filename (glob '*'){
439:  my $filestat = stat($filename);
440:  my $ext = '';
441:  $ext = $1 if $filename =~ m{\.([^.]*)$};
442:  my $is_dir = S_ISDIR($filestat->mode);
443:  my $dsh = ' -';
444:  my $type = $is_dir ? 'directory' : $ext ? $ext2type{$ext} : 'generic';
445:  push @$files, {filename => $filename . ( $is_dir ? '/' : '') || '',
446:  icon => $type2icon{$type} || $type2icon{unknown} || '',
... 
code stack:  /var/www/cs/perl/Wikiacademia/Utilities.pm:442
/var/www/cs/htdocs/courses/source/scripts/ls.mhtml:132
/var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135
/var/www/cs/htdocs/courses/source/scripts/directory.mhtml:30
/var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135
/var/www/cs/htdocs/courses/source/main.mhtml:132
/var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135
/var/www/cs/htdocs/courses/.autohandler:1
/var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135
raw error






























Can't call method "mode" on an undefined value at /var/www/cs/perl/Wikiacademia/Utilities.pm line 442.


Trace begun at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Exceptions.pm line 129
HTML::Mason::Exceptions::rethrow_exception('Can\'t call method "mode" on an undefined value at /var/www/cs/perl/Wikiacademia/Utilities.pm line 442.^J') called at /var/www/cs/perl/Wikiacademia/Utilities.pm line 442
Wikiacademia::Utilities::list_files('/var/www/cs/htdocs/courses/source/actions/form_stuff') called at /var/www/cs/htdocs/courses/source/scripts/ls.mhtml line 132
Wikiacademia::__ANON__('directory', '/var/www/cs/htdocs/courses/source/actions/form_stuff', 'uri', '/courses/source/actions/form_stuff/', 'parent', 1, 'upload', '') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x9956f54)', 'directory', '/var/www/cs/htdocs/courses/source/actions/form_stuff', 'uri', '/courses/source/actions/form_stuff/', 'parent', 1, 'upload', '') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1256
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1250
HTML::Mason::Request::comp(undef, undef, 'directory', '/var/www/cs/htdocs/courses/source/actions/form_stuff', 'uri', '/courses/source/actions/form_stuff/', 'parent', 1, 'upload', '') called at /var/www/cs/htdocs/courses/source/scripts/directory.mhtml line 30
Wikiacademia::__ANON__ at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0xa06dd4c)') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1256
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1250
HTML::Mason::Request::comp(undef, undef, undef) called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1299
HTML::Mason::Request::scomp('HTML::Mason::Request::ApacheHandler=HASH(0xa1a08fc)', 'scripts/directory.mhtml') called at /var/www/cs/htdocs/courses/source/main.mhtml line 132
Wikiacademia::__ANON__ at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x9f71af0)') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1256
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1250
HTML::Mason::Request::comp(undef, undef) called at /var/www/cs/htdocs/courses/.autohandler line 1
Wikiacademia::__ANON__ at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm line 135
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x9f61d18)') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1251
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 1250
HTML::Mason::Request::comp(undef, undef, undef) called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 460
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 460
eval {...} at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 412
HTML::Mason::Request::exec('HTML::Mason::Request::ApacheHandler=HASH(0xa1a08fc)') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 168
HTML::Mason::Request::ApacheHandler::exec('HTML::Mason::Request::ApacheHandler=HASH(0xa1a08fc)') called at /var/www/cs/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 826
HTML::Mason::ApacheHandler::handle_request('MasonX::WebApp::ApacheHandler=HASH(0x9f338ac)', 'Apache=SCALAR(0x999b2c8)') called at /var/www/cs/perl/Wikiacademia/WebApp.pm line 157
eval {...} at /var/www/cs/perl/Wikiacademia/WebApp.pm line 157
Wikiacademia::WebApp::handler('Wikiacademia::WebApp', 'Apache=SCALAR(0x999b2c8)') called at /dev/null line 0
eval {...} at /dev/null line 0