-1

I am getting

$VAR1 = bless( \*{'Fh::fh00001Screenshot.png'}, 'Fh' );

in a variable. But I need to retrieve fh00001Screenshot.png from it. How can I get it?

choroba
  • 231,213
  • 25
  • 204
  • 289
Hafsal
  • 81
  • 2
  • 7
  • 6
    It looks like you are using a module, in which case it is best to check the documentation for the proper way to do it. – TLP Feb 15 '13 at 13:09
  • We really need to see the code you are running. It looks to me like you are using Data::Dumper to dump an object which is a blessed typeglob ref. This probably isn't what you want to do. – Joel Berger Feb 15 '13 at 13:55
  • 1
    Hafsal, I have read the many recent questions you have asked and I think you misunderstand what role StackOverflow serves. This site is for specific programming issues, in which you show us some code and we try to help you fix it. Without showing us your code, you either (1) don't give us enough to work with or (2) are asking us to do your job for you. Please read the [faq] and in the future please submit questions that are more in line with the goals of this site. – Joel Berger Feb 15 '13 at 14:02

1 Answers1

4

The Fh package is used internally by the CGI module to handle temporary files used for building multipart data. You shouldn't be using it directly.

Check carefully to make sure there is no better way before using this code which comes from the CGI code for Fh::asString

(my $name = $$VAR1) =~ s/^\*(\w+::fh\d{5})+//; 
print $name;

output

Screenshot.png

Update

Rather than picking bits out of the CGI code, it looks like this package - which should really be a private one - is accessible from calling code. Use just $var->asString instead, like this

use strict;
use warnings;

use CGI;

my $var = do {
  no strict 'refs';
  my $var = bless( \*{'Fh::fh00001Screenshot.png'}, 'Fh' );
};

print $var->asString;
Borodin
  • 126,100
  • 9
  • 70
  • 144