Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Why won't say act like say when its tied?

by Corion (Patriarch)
on Mar 06, 2011 at 19:45 UTC ( [id://891712]=note: print w/replies, xml ) Need Help??


in reply to Why won't say act like say when its tied?

I would guess it's a bug, because the program behaves more in line with your (and my) expectations on Perl 5.12:

use Symbol; use 5.012; { package Foo; sub TIEHANDLE { my ($sClass, $fh) = @_; return bless([$fh], $sClass); } sub PRINT { my $self = shift; my $fh = $self->[0]; CORE::print $fh "tied to $self:", @_; } } my $x=gensym; tie *$x, 'Foo', \*STDOUT; local $\="\n***\n"; say "Not tied: I'm just saying ..."; say $x "I'm just saying ..."; # outputs (note that say $x is followed by "\n***\n" # not "\n" # # Not tied: I'm just saying ... # tied to Foo=ARRAY(0x8197ed0):I'm just saying ... # ***

This is on Strawberry Perl 5.12:

This is perl 5, version 12, subversion 1 (v5.12.1) built for MSWin32-x +86-multi-thread

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://891712]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found