in reply to Re^4: perl 5.12 BSD portability (CPAN test result)...print
in thread perl 5.12 BSD portability (CPAN test result)...print

But only in the FH->print format? Why does it work in the print FH mode? Aren't they supposed equivalent?

No, they're not equivalent. print FH ... is an instance of a the print operator.

FH->print(...) is a method call. It does whatever FH's class's print method does. If FH is an IO::Handle or IO::File object, its print method calls the print operator.

sub print { @_ or croak 'usage: $io->print(ARGS)'; my $this = shift; print $this @_; }

Replies are listed 'Best First'.
Re^6: perl 5.12 BSD portability (CPAN test result)...print
by perl-diddler (Chaplain) on Mar 15, 2013 at 21:29 UTC
    Ah...I thought it was just an indirect method call...didn't know it was it's own special operator... Does it still have to be it's own special operator? I.e. are there places where the indirect method call wouldn't give the same behavior? (Apparently there were in the past, but what about now?)....

      Assuming you're ok with breaking every program that does print $x, how would you implement IO::Handle::print without the print operator?

      There are other issues, but they're not worth mentioning after the above two.

        Um, I suppose I'm not sure I see the difference between a method called print, called indirectly, that appears to do the same thing as C<print> the operator.

        Could you explain the difference to someone to whom it is not obvious? ;-)