in reply to Re^2: Override the open builtin globally
in thread Override the open builtin globally

Hi,

Could you kindly advise about writing using dumper?

The following open using last version:

open(FILE,"> tmp.pm"); print FILE "blabla"; # works correctly #print FILE Dumper %tmp_hash; #works correctly print FILE Data::Dumper %tmp_hash; #fails: "Can't locate object metho +d "FILE" via package "Data::Dumper" "
Any ideas/advises? since I would like to use specific pre defined Data::Dumper, which doesn't recognize the FILE.

Replies are listed 'Best First'.
Re^4: Override the open builtin globally
by choroba (Cardinal) on Jan 15, 2017 at 10:17 UTC
    Add parentheses to disambiguate.

    Also, are you sure it shouldn't rather be

    print FILE Data::Dumper::Dumper( \%tmp_hash );

    ?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re^4: Override the open builtin globally
by Anonymous Monk on Jan 16, 2017 at 07:57 UTC

    The following open using last version: open(FILE,"> tmp.pm");

    Please remember to use three argument open, see open for details

    Also use lexicals (my $file) instead of globals (FILE)