From:                   Christian Millour <[EMAIL PROTECTED]>

> the Shout.pm and demonstration code in pperl3 pp 385-389 elicit a
> rather obfuscated error message "Can't use an undefined value as
> filehandle reference at ..." under 5.6.1 (activeperl / cygwin). 
> 
> Following is a minimal illustration : 
> 
> #!perl -w
> 
> package Myfile;
> use Carp;
> 
> require Tie::Handle;
> @ISA = (Tie::Handle);
> 
> sub TIEHANDLE {
>     use Symbol;
>     my $class = shift;
>     my $form = shift;
>     open my $self, $form, @_          or croak "can't open $form@_: $!";
>     return bless $self, $class;

Try
        open my $handle, $form, @_              
                or croak "can't open $form@_: $!";

and either

        return bless \$handle, $class;

or

        return bless {handle => $handle}, $class;

since I believe you can't bless something that's either not a 
reference or is already blessed. Well in the second case you can, 
but don't want to.

> }
> 
> sub CLOSE {
>     my $self = shift;

        my $handle = $$self;
or
        my $handle = $self->{handle};

        return close $handle;

>     return close $self;
> }

And so on.

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
                                        --- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to