http://qs321.pair.com?node_id=410593


in reply to Re^2: check *.tmp wether it's a zip or not
in thread check *.tmp wether it's a zip or not

perl -e "{ local $SIG{__WARN__} = sub { die @_;};eval {warn 'xxx'}; pr +int 'a:'. $@}" __OUTPUT__ a:xxx at -e line 1.

That is check $@ for success.

If you only check the signature, which is what my quick check into File::Type confirmed that it is doing, there is a risk even if it is remote that another binary file could start with these magic bytes.