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

IO::All and temporary files

by meonkeys (Chaplain)
on Oct 26, 2004 at 00:08 UTC ( [id://402395]=perlquestion: print w/replies, xml ) Need Help??

meonkeys has asked for the wisdom of the Perl Monks concerning the following question:

I can't get what I'd consider proper behavior when creating temporary files with IO::All.
#!/usr/bin/perl -w use strict; use IO::All; my $temp_file = io('?'); "foo" > $temp_file;
During execution I get the following fatal error...
Can't call method "print" on an undefined value at /usr/lib/perl5/site +_perl/5.8.3/IO/All.pm line 618.
I believe I'm following the documentation correctly, so I would expect the file to be writable. However, I don't even think a temporary file is being created.

Also, anyone know if it's possible to give IO::All a tempfile template like "/tmp/foo_XXXXXX" ala File::Temp::tempfile()?

---
"A Jedi uses the Force for knowledge and defense, never for attack."

Replies are listed 'Best First'.
Re: IO::All and temporary files
by castaway (Parson) on Oct 27, 2004 at 06:54 UTC
    I've not used IO::All at all, but, some things to try.. print that $temp_file with Data::Dumper, and see what it contains (Im guessing undef, or some value thats supposed to be the filehandle thats undef). Try setting PERLDB_OPTS='NonStop frame=1 AutoTrace LineInfo=tperl.out' (as an environment variable), and running it using perl -d (then read the resulting tperl.out) ?

    Also, you didn't mention what system/perl/IO::All versions you're using..

    C.

      I've not used IO::All at all, but, some things to try.. print that $temp_file with Data::Dumper, and see what it contains (Im guessing undef, or some value thats supposed to be the filehandle thats undef).
      $VAR1 = bless( \*Symbol::GEN0, 'IO::All::Temp' );
      Try setting PERLDB_OPTS='NonStop frame=1 AutoTrace LineInfo=tperl.out' (as an environment variable), and running it using perl -d (then read the resulting tperl.out) ?
      This was pretty cool to see. Thanks for the idea! I've never played much with Perl's debugging features, but it's cool to see the extensive support provided. However, the output is difficult to comprehend. It would probably be easier to follow if I was familiar with the source of IO::All; especially if I knew why and when each sub was executed.
      Also, you didn't mention what system/perl/IO::All versions you're using..
      $ uname -a Linux mikey.emperorlinux.com 2.4.24-emp_2424sw #1 Fri Feb 20 17:56:50 +EST 2004 i686 i686 i386 GNU/Linux $ perl -v This is perl, v5.8.3 built for i386-linux-thread-multi $ perldoc -m IO::All | grep VERSION our $VERSION = '0.31';
      (snipped for brevity)

      ---
      "A Jedi uses the Force for knowledge and defense, never for attack."
Re: IO::All and temporary files
by ides (Deacon) on Oct 27, 2004 at 20:49 UTC
    I get the same error and according to the docs what you are doing should work. I'd contact the module's author or current maintainer.

    Frank Wiles <frank@wiles.org>
    http://www.wiles.org

      Good idea. I filed a bug at rt.cpan.org.

      ---
      "A Jedi uses the Force for knowledge and defense, never for attack."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://402395]
Approved by atcroft
Front-paged by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-04-24 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found