Solved

Perl's sessionobject...

Posted on 2000-03-27
7
199 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
Industry Leaders: 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

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!

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

752 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