package Foo; use strict; use UNIVERSAL 'isa'; sub Foo { my $File = isa( $_[0], 'IO::File' ) ? shift : return undef; # Do something to the file } 1;