in reply to Re: Help using self-made but very simple Module
in thread Help using self-made but very simple Module

Got me farther, had 2 more error messages pop up, fixed them and now stuck on this one.

Can't call method "mtime" without a package or object reference at Modules/ScriptUpdate.pm line 2

This works if i use it as a sub_routine. I added the File::stat lib but still get the error.

Here the code that line references.

my $mtime = stat($filename)->mtime;

This is in the package. Do I need to bless something? Reading up on bless now but that's all new to me.

Replies are listed 'Best First'.
Re^3: Help using self-made but very simple Module
by almut (Canon) on Oct 12, 2009 at 15:27 UTC

    You'd need to use File::stat in the package, as by-name stat fields are not core Perl syntax.

    Alternatively, simply write (stat $filename)[9].

      That did it! WOOT! THanks much (Switching it to just stat and 9