in reply to Calling a custom sub on failure

sure, yes you can.
open(LOK, ">>C:\\Perl\\RTEOlock\\check\\RTEOlock.log") || this_is_sub( +) ;
or
unless ( open(LOK, ">>C:\\Perl\\RTEOlock\\check\\RTEOlock.log") ) { # do what ever we can not open the file ... }
Boris