#!/usr/bin/perl use strict; use warnings; use IO::Scalar; my $data = 'some sample data here'; my $fh = IO::Scalar->new(\$data); print {*STDERR} 'ref $fh yields ', ref $fh, "\n"; print_prop('$fh->can("opened")', $fh->can('opened')); print_prop('$fh->can("seek")', $fh->can('opened')); print_prop('$fh->can("seekable")', $fh->can('opened')); print_prop('$fh is IO::Scalar', $fh->isa('IO::Scalar')); print_prop('$fh->can("opened")', $fh->can("opened")); print_prop('$fh->opened()', $fh->opened()); print_prop('$fh->can("seek")', $fh->can("seek")); eval {print_prop('$fh->seek(0, 0)', $fh->seek(0, 0));} or print "$@"; print_prop('$fh is tied', tied $fh); close $fh; sub print_prop { my ($msg, $flag) = @_; print {*STDERR} $msg, '? ', ($flag ? 'yes' : 'no'), "\n"; return; }