Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Perl's sessionobject...

Posted on 2000-03-27
7
Medium Priority
?
209 Views
Last Modified: 2010-03-05
It is possible to store variables permanent between different
perliis-scripts?

Something like this
$GLOBAL::var = 123;

and then in another script write
print $GLOBAL::var;
0
Comment
Question by:perlman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2661578
yes you can do that. how ever the scope of these variables would be across one transaction only (a transaction is from the time a script is executed till the time the results are returned).

On the other hand if you want to access a variable across 2 transactiosn you might want ot use cookies or store the info on the server end and then pass a reference to the info across transactions.

0
 
LVL 8

Expert Comment

by:jhurst
ID: 2662764
Files, especially dbm files:

dbmopen(%HASHNAME,"yourFile",0644);
$HASHNAME{variable}="whetever";

etc.

This same HASNAME will be availabel to all scripts that open the same file.



0
 

Author Comment

by:perlman
ID: 2663127
Thanks for the answer, didn't express
too clearly, I wonder if there was any
other way than the regular ways,
cookies, files, for example store
arrays or hashes in a "permanent memory". Impossible...?

Cookies works fine for small data,
and save to files works when its
not too many files, or too many or big
records in dbm.

I want to store a large size of data,
say 0.5 - 3 mb and could reach one of
the records with a key (like hashes and
no limits like dbm)

I read some about POE, maybe that was
a completly different thing?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Expert Comment

by:maneshr
ID: 2664316
since you mentioned about the large size of the data, what you could do is to store the data in your server (in some temp dir.) and pass the file where that data is stored across transactions (as a cookie or hidden form variable).

if you have a DB then you could store that same info as a CLOB data type which would have a sequence number associated with it.
Then you just pass that sequence number across transactions.

the final approach would depend on the no of transactions that you expect and the duration for which this large data should be available.

0
 

Author Comment

by:perlman
ID: 2664694
It's then impossible to store things in memory..?

I'm looking for a faster way than using
files and database storage. Like a
perlmodule that can store variables
in a "separate memory" that is not destroyed at the script's end.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2664874
Do you mean like Persistent::File or Data::Dumper or AnyDBM_File or Tie::Persistent?
0
 
LVL 16

Accepted Solution

by:
maneshr earned 160 total points
ID: 2665106
"....It's then impossible to store things in memory..? " ....."that is not destroyed at the script's end. ............"

not across transactions, unless you are using a specialized software (web app server) that would do it for you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question