Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Revelation's scratchpad

by Revelation (Deacon)
on Jun 05, 2004 at 13:03 UTC ( #361591=scratchpad: print w/replies, xml ) Need Help??

For jkeenan1: Another solution would be to user perl 5.8's ability to open in memory files:
@input = qw/here is some input/; my $imfile = join "\n",@input; open(MEMORY,'+<', \$imfile) or die "Can't open memory file: $!"; # Then use IO::Handle or open to just override STDIN. # To be comprehensive you could check the version of perl. If it's no +t high enough, you could require IO::String, to solve the problem, as + well..
Something For me:
sub parameters { return bless [ $_[0], $_[0]->{'params'} ], DummyNameSpace if want('O +BJECT'); # Single Param. return %{$_[0]->{'params'}; # This will create a } package DummyNameSpace; our $AUTOLOAD; sub isa { $_[0]->[1]->{'isa'} = $_[1] if defined $_[1]; return $_[0]->[1]->{'isa'}; } sub VERSION { $_[0]->[1]->{'VERSION'} = $_[1] if defined $_[1]; return $_[0]->[1]->{'VERSION'}; } sub can { $_[0]->[1]->{'can'} = $_[1] if defined $_[1]; return $_[0]->[1]->{'can'}; } sub AUTOLOAD { ref(my $o = shift) or die; # don't mess with garbage collection my $o1 = $o->[1]; ( my $method = $AUTOLOAD ) =~ s{.*::}{}; if ( !$method ) { # AUTOLOAD AS PARAM. $o1->{'AUTOLOAD'} = $_[0] if defined $_[0]; return $o1->{'AUTOLOAD'} } if ( $method =~ /^DESTROY$/ ) { return if !defined wantarray; $o1->{'DESTROY'} = $_[0] if defined $_[0]; return $o1->{'DESTROY'}; } $o1->{$method} = $_[0] if defined $_[0] and return $o1->{$method}; undef $AUTOLOAD; } 1;
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[LanX]: suitable what? ... insult?
[Discipulus]: goodby stress..
LanX you always reminded me of Sean Connery. ..
shmem .oO( someday I'll do something... and then I'll make it big. Now is the time! )
[LanX]: don't forget to flush the water
[shmem]: the day will come when LanX hits the fan
[Discipulus]: did you remember to commit?

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-04-24 11:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?