Re: graphics in perl

2008-06-24 Thread Foo JH


Rolf Schaufelberger wrote:

Am Sonntag, 22. Juni 2008 11:27:26 schrieb Malka Cymbalista:
  

We are running perl 5.8.5 on a Linux machine that is running apache 2.2.6
with mod_perl 2.0.3.  Our data is in a MySQL database (MySQL 5.0.45)

We have been asked to write a web application that requires plotting
capabilities.  We do most of our web programming in perl so I am looking
for a perl module that has the following features: 1. ability to create
histograms
2. ability to create x,y plots
3. ability to zoom in on a portion of the graph
4. ability to calculate the distance between 2  points on the graph
5. ability to hover on a point and bring up some text

Does anyone have any suggestions for which perl modules we should look
into?

To make your life easier, use a third-party Flash charting tool. It's 
pretty and it's more interactive than a static jpg (for example).


The role of Perl in this case is simply to generate the data for the 
flash application to load. Most of the time it's an XML document, so 
that's something Perl does very well.




RE: graphics in perl

2008-06-24 Thread michael watson (IAH-C)
Did you try GD::Graph?


-Original Message-
From: Foo JH [mailto:[EMAIL PROTECTED]
Sent: Tue 24/06/2008 8:15 AM
To: modperl@perl.apache.org
Subject: Re: graphics in perl
 

Rolf Schaufelberger wrote:
> Am Sonntag, 22. Juni 2008 11:27:26 schrieb Malka Cymbalista:
>   
>> We are running perl 5.8.5 on a Linux machine that is running apache 2.2.6
>> with mod_perl 2.0.3.  Our data is in a MySQL database (MySQL 5.0.45)
>>
>> We have been asked to write a web application that requires plotting
>> capabilities.  We do most of our web programming in perl so I am looking
>> for a perl module that has the following features: 1. ability to create
>> histograms
>> 2. ability to create x,y plots
>> 3. ability to zoom in on a portion of the graph
>> 4. ability to calculate the distance between 2  points on the graph
>> 5. ability to hover on a point and bring up some text
>>
>> Does anyone have any suggestions for which perl modules we should look
>> into?
>> 
To make your life easier, use a third-party Flash charting tool. It's 
pretty and it's more interactive than a static jpg (for example).

The role of Perl in this case is simply to generate the data for the 
flash application to load. Most of the time it's an XML document, so 
that's something Perl does very well.




Re: graphics in perl

2008-06-24 Thread Mike Schienle


On Jun 24, 2008, at 2:32 AM, michael watson (IAH-C) wrote:


Did you try GD::Graph?


-Original Message-
From: Foo JH [mailto:[EMAIL PROTECTED]
Sent: Tue 24/06/2008 8:15 AM
To: modperl@perl.apache.org
Subject: Re: graphics in perl


Rolf Schaufelberger wrote:

Am Sonntag, 22. Juni 2008 11:27:26 schrieb Malka Cymbalista:

We are running perl 5.8.5 on a Linux machine that is running  
apache 2.2.6

with mod_perl 2.0.3.  Our data is in a MySQL database (MySQL 5.0.45)

We have been asked to write a web application that requires plotting
capabilities.  We do most of our web programming in perl so I am  
looking
for a perl module that has the following features: 1. ability to  
create

histograms
2. ability to create x,y plots
3. ability to zoom in on a portion of the graph
4. ability to calculate the distance between 2  points on the graph
5. ability to hover on a point and bring up some text

Does anyone have any suggestions for which perl modules we should  
look

into?


To make your life easier, use a third-party Flash charting tool. It's
pretty and it's more interactive than a static jpg (for example).

The role of Perl in this case is simply to generate the data for the
flash application to load. Most of the time it's an XML document, so
that's something Perl does very well.


I'e used Visual Engineering's KavaChart  to do 1, 2, 3, and 5 above. It may do 4, but I haven't tried  
anything like that with it. I have code for a simple System Load  
application listed at . Look  
for System Load near the top of that page. You can also see something  
pulling data from a URL at  by viewing  
the source of that page. Check the graph on the left side of the page.



Mike Schienle



Re: Apache (httpd) + Persistant Perl (ModPerl/SpeedyCGI) + User Based Processes (SuExec) + Chroot

2008-06-24 Thread Jim Brandt


James Austin wrote:



Advantages:

1) Provides persistant perl WITH suexec for per-virtualhost user
execution
2) SpeedyCGI handles dynamic data, Apache handles static, hence you
don't require a covering proxy as described in
http://perl.apache.org/docs/1.0/guide/strategy.html


You can configure the Apache proxy server to server static content in 
the mod_perl configuration as well, either directly or via caching. You 
can have the back server serve static content on an initial request, 
then have the proxy cache it for some time period. We do this because it 
allows you to run a single back server when doing development as it 
knows how to serve everything.



3) The timeout property in speedycgi means that a script with low or
no load will drop out of memory, this means high use scripts will
run in persistant perl and low use scripts will load into memory
then remove themself when they are no longer being activly used. 


You can configure Apache to do this with your mod_perl servers too. You 
can configure the number of servers (as Perrin mentioned) and Apache 
will expand to based on load. Apache will clean up as load goes away. 
You can also set the children to exit after a number of requests. Check 
out these Apache directives: MaxClients, MaxRequestsPerChild, 
MaxSpareServers, MinSpareServers, StartServers.




a) Is there a better way to achive this goal?
b) Is there a way to make modperl scale and attain the desired results 
without creating a new server for each instance (Implementation 1)?


You mention security, but you didn't say if you had a requirement for 
the different processes to not share memory. If this isn't required, you 
can put your app-specific code in separate modules and handlers. This 
would avoid multiple servers and allow you to share memory with shared 
modules (CGI, DBI, etc.).



c) Have I missed anything (security etc. (Implementation 2))?
d) Is there a better solution (fastcgi/pperl etc.)?
e) What are there any downsides (other than those listed above) to 
either of these implementations?


The main problem with the one server per app implementation is likely to 
be scaling. While you have as many ports as you need, at some point the 
server will run out of memory if you get above some number of 
applications. If you don't think you'll have than many, it should work fine.


Jim


--
Jim Brandt
Administrative Computing Services
University at Buffalo



mod_perl caching problem

2008-06-24 Thread william
Hello,

Before asking here, I had read a few articles in perl.apache.org about
caching issue in mod_perl, but I still don't get it right with my
program when I had already changed the input, it still giving me the
result of old input. I aware that the child process will only compile
the code for once, but I had also read somewhere that it will
recompile when it found that the file has been changed. What I want to
achieve is the program should give me the result according to the
input at that time.

#this is the main entrance of my program
use CGI qw(:standard);
print header;

use Qwerq::Core;
our $qwerq = new Qwerq::Core();
$qwerq->query("what is the population of China");

How can I solve this problem ?

Thanks.


Re: mod_perl caching problem

2008-06-24 Thread william
I like to add on something, I had put the pragma
use strict;
use warnings;

on all modules that I had, but I didn't get the warnings of "Variable
"$foo" will not stay shared at..." .

What other possibility that might cause my program to cache the result
even when the input has already changed ?

Thanks.


Re: mod_perl caching problem

2008-06-24 Thread Geoffrey Young



william wrote:

I like to add on something, I had put the pragma
use strict;
use warnings;

on all modules that I had, but I didn't get the warnings of "Variable
"$foo" will not stay shared at..." .

What other possibility that might cause my program to cache the result
even when the input has already changed ?



http://perl.apache.org/docs/general/perl_reference/perl_reference.html#myScoped_Variable_in_Nested_Subroutines

--Geoff


Re: mod_perl caching problem

2008-06-24 Thread william
Thank you for the reply,

That's one of the articles that I had read, but still I have not found
where my code having the "my scoped variable in nested subroutines" ,
I also aware of the nature of ModPerl::Registry would handle the code
in its subrountine called "handle". I have used global variable "our"
for the variables that might caused problem.

On 6/24/08, Geoffrey Young <[EMAIL PROTECTED]> wrote:
>
>
>  william wrote:
>
> > I like to add on something, I had put the pragma
> > use strict;
> > use warnings;
> >
> > on all modules that I had, but I didn't get the warnings of "Variable
> > "$foo" will not stay shared at..." .
> >
> > What other possibility that might cause my program to cache the result
> > even when the input has already changed ?
> >
> >
>
> http://perl.apache.org/docs/general/perl_reference/perl_reference.html#myScoped_Variable_in_Nested_Subroutines
>
>  --Geoff
>


[MP2]mod_perl and index.html

2008-06-24 Thread titetluc titetluc
Hello all

I am writing a Perl module to authenticate users (using mod_perl2 and httpd
2.2.6.
I would like to display the user name (r->user) when accessing a directory
(/test_index/index.html)

I have the following httpd configuration


DirectoryIndex index.html
Options +indexes


PerlModule Test

Require valid-user
AuthType basic
AuthName test_index
SetHandler perl-script

PerlAuthenHandler Apache2::AuthSSO::Test->set_user

PerlResponseHandler Apache2::AuthSSO::Test->display_user


In addition, I added an empty index.html file in the htdocs/test_index
directory

The Perl Test module is

package Test;
use warnings;
use strict;
use Carp;

use Apache2::Const qw(:common);

sub set_user {
my ($self, $r) = @_;
$r->user('myself');
return OK;
}
sub display_user {
my ($self, $r) = @_;
my $user = defined $r->user ? $r->user : 'user is not defined';
print $user;
return OK;
}

1;

When I access with my browser to http://localhost/test_index/index.html,
user is set to 'myself'
BUT when I access with my browser to http://localhost/test_index/ ... user
is not defined !!!

I don't know if the problem comes from mod_perl or from the httpd
configuration.
Any help would be appreciated.

Thanks