Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > To know if a variable is a file handler

Reply
Thread Tools

To know if a variable is a file handler

 
 
Luis Angel Fdez. Fdez.
Guest
Posts: n/a
 
      07-19-2007
Hi!

I was looking in Google and I don't find anything that solves my
doubt. Is there any way I can check if a variable is an file handler
of an opened file?.

Thanks in advance.

Bye!

 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      07-19-2007

"Luis Angel Fdez. Fdez." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi!
>
> I was looking in Google and I don't find anything that solves my
> doubt. Is there any way I can check if a variable is an file handler
> of an opened file?.
>
> Thanks in advance.
>


# Untested
use warnings;
use strict;
use FileHandle::Fmode qw(:all);
my $fh;
# (optionally) other code that does stuff
if is_arg_ok($fh) {print "\$fh is a file handle to an open file"}
else {print "\$fh is NOT a file handle to an open file"}
__END__

Cheers,
Rob

 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      07-19-2007
Luis Angel Fdez. Fdez. wrote:
>
> I was looking in Google and I don't find anything that solves my
> doubt. Is there any way I can check if a variable is an file handler
> of an opened file?.


perldoc -f fileno


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnServerValidate handler - how to know which CustomValidator is using it ? northof40 ASP .Net Web Controls 3 11-02-2007 03:46 AM
How does a handler render the request to another handler in the MVC of SPRING 2.0.1 framework? rayzyang@gmail.com Java 0 05-30-2007 11:28 AM
Event Handler that creates adds another event handler kaczmar2@gmail.com ASP .Net 1 02-22-2007 07:37 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
I know, I know, I don't know Andries Perl Misc 3 04-23-2004 02:17 AM



Advertisments