multiple webpages sharing a dataset reference

S

sam

Hi,

I m wondering how to fetch a dataset and hold it in the memory for used
by other webpages. Having everything written in one single page is much
easier, but it will look groove and not user friendly.
I will use MySQL as database.

For example, if I fetch records from the database with the following
perl codes:
$dataset->prepare(
q{SELECT name, ipaddr FROM hosts
WHERE (name = ? AND bldg = ? AND dept = ?)});
$dataset->execute($name,$bldg,$dept);

I would like the value of $dataset can be read from another webpage (a
result webpage). Assumed the perl code above is being executed by
pressing the Query button in a Query webpage.
Therefore the procedure may be:

Query webpage -> $dataset -> Result webpage


Thanks
Sam
 
G

Gregory Toomey

sam said:
Hi,

I m wondering how to fetch a dataset and hold it in the memory for used
by other webpages. Having everything written in one single page is much
easier, but it will look groove and not user friendly.
I will use MySQL as database.

For example, if I fetch records from the database with the following
perl codes:
$dataset->prepare(
q{SELECT name, ipaddr FROM hosts
WHERE (name = ? AND bldg = ? AND dept = ?)});
$dataset->execute($name,$bldg,$dept);

I would like the value of $dataset can be read from another webpage (a
result webpage). Assumed the perl code above is being executed by
pressing the Query button in a Query webpage.
Therefore the procedure may be:

Query webpage -> $dataset -> Result webpage


Thanks
Sam

You could try http://en.wikipedia.org/wiki/Memcached

gtoomey
 
X

xhoster

sam said:
Hi,

I m wondering how to fetch a dataset and hold it in the memory for used
by other webpages.

Webpages traditionally do not use datasets. They use html. Are you
confusing the web page with the CGI program that generates that page?
Having everything written in one single page is much
easier, but it will look groove

What does it mean to "look groove"?
and not user friendly.

You mean it is more user friendly to make someone click through hoops
to get the information they want then to just give it to them directly?
Please explain further.
I will use MySQL as database.

For example, if I fetch records from the database with the following
perl codes:
$dataset->prepare(
q{SELECT name, ipaddr FROM hosts
WHERE (name = ? AND bldg = ? AND dept = ?)});
$dataset->execute($name,$bldg,$dept);

No fetch!
I would like the value of $dataset can be read from another webpage

Webpages do not read values. Besides, the value of $dataset is something
like DBI::st=HASH(0x82349cc).
(a
result webpage). Assumed the perl code above is being executed by
pressing the Query button in a Query webpage.
Therefore the procedure may be:

Query webpage -> $dataset -> Result webpage

The Query webpage has a form that submits to some_script.cgi.
some_script.cgi parses the form data submitted by the Query webpage,
gets a dataset from the database, and uses the dataset to
generate a Result webpage.

This is the way it generally works, no? So what is the problem?

Do you want the results to also be available is some page other than
the primary result page generated by the CGI? Well, how the is person
supposed to get to that other page? How you transport information to this
new page will depend on how you transport the user to this new page.

Xho
 
P

Peter Wyzl

: Hi,

<snip>

: Therefore the procedure may be:
:
: Query webpage -> $dataset -> Result webpage

That looks like an ordinary CGI process to me...
 
B

Brian McCauley

sam said:
I just installed the C/perl versions of the Memcached in the system.
Here I have a general question about perl. How can I write two perl
files that access a variable that reference the Memcached?

I don't know the answer to that but I think you are barking up the wrong
tree. Trying to hold the result of queries in memory between HTTP
transactions is generally the wrong approach in web programming.

Usually you simply hold enough information in your session data (hidden
fields, cookie, URL whatever) to repeat the query. (You can
roll-your own session implementation or take a look on CPAN).

Be aware: there may be more than one user of your website at a time. Be
aware: it is impossible to know when someone has "left" your website.
Be aware: most of the issues to do with web programmming are not
language specific.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top