Solved

Perl's sessionobject...

Posted on 2000-03-27
7
207 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 80 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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

623 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