Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: CGI and Storable : explain me this, please.

by aufflick (Deacon)
on Apr 27, 2006 at 01:58 UTC ( [id://545929]=note: print w/replies, xml ) Need Help??


in reply to CGI and Storable : explain me this, please.

GLOB is a type of Perl variable (also known as a typeglob) that is a reference to a value in Perl's symbol table. If you want to know more about them you might want to read The Perl You Need To Know - Part 3.

GLOB variables can't be serialised by Storable because it is a pointer to a table that is part of the current Perl runtime. If it was saved and restored, the symbol table in memory would not be the same one and it would not be able to point to the same entry. (Did that even make sense?! I hope so, it's a little tricky to explain).

The question here, though, is why CGI's param method is returning a typeglob. Possibly the method performs differently in a string context?

I notice that the form variable you are referencing is called pic1 - is the form a multipart file upload form? If so it makes more sense since CGI is probably giving you a filehandle to an open file that you will then have to do something with (like reading it into memory, copying it to a file etc.).

Replies are listed 'Best First'.
Re^2: CGI and Storable : explain me this, please.
by davidrw (Prior) on Apr 27, 2006 at 02:17 UTC
    The question here, though, is why CGI's param method is returning a typeglob. Possibly the method performs differently in a string context?
    ...
    CGI is probably giving you a filehandle...
    That is it -- See (directed at OP) the 'CREATING A FILE UPLOAD FIELD' section in the CGI docs .. When the form is processed, you can retrieve the entered filename by calling param():
    $filename = param('uploaded_file');
    The filename returned is also a file handle.

    So the split //, $var works because it's scalar context so is the filename.. Otherwise it must be treating it as a handle, and hence the observed error..

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://545929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-18 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found