Re: apache::request and other newbie questions

2001-11-02 Thread Nouguier Olivier



John Michael wrote:

I have a modperl script that uses.
cgi.pm and actually I have been importing my on cgi params from get and
post but do use cgi.pm for cookies. I have read in some other emails
and now in the guide that it is faster to use Apache::Request so I want
to change my script over to this method since it will eventually come under
a heavy load. I added this to my perl.conf filePerlModule Apache::Request
and apache says that it can not find the module in
@INC (@INC contains: /etc/httpd/lib/perl /usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl . /etc/httpd/)
sure enough, I looked in there and it isn't.
I went to the module list and the list claims that apache::request is
included with the standard dist of mod perl.
I'm running Apache 1.3.9 and mod_perl/1.24_01
What should I do? Also, I have a script that is running under apache::registry.I
run the script by using a mod-actions handler that I have in my httpd.conf
file like so.The script runs from a blank index.htm page and creates the
dynamic output depending on the referring url and query-stringDirectory
"/home/usr1/digital/membersurl/html/protected">

Apache::Request is not shipped with mod_perl ...
Take a look at CPAN ...
Or http://httpd.apache.org/apreq/

AddHandler RTS-protected-htm htm
Action RTS-protected-htm /perl/content_manager/handler.pl
/Directory>
I imagine this is not very efficient?
I guess I will eventually have to set it up as a hander?
What is your opinion?

Personnaly, I prefer a very simple handler, using ( owned ) libs,
than a "script.pl", that much easy to maintains

I'm new to packages and modules and have basically little experience
with OOP. The script works fine with no errors, but I expect a heavy
load in the future. I eventually want to have the correct solution but
I'm trying to beat the learning curve before the traffic gets there.
Can I set up the script now as a handler
or does it have to be written in OO format?
I do understand that a few things have
to be changed, like I have to use apache::constants to finalize the handler
phase.
Reading several books and understanding
more and more everyday.
Any suggestions would be greatly appreciated.
Thanks
John Michael

--
My mother always used to tell me, "The early bird gets the worm."
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
 -- Elliott Downing






Re: [Fwd: Help with @ISA]

2001-08-06 Thread Nouguier Olivier

Hi all,

Don't we need to load the module before using it?

With:

PerlModule My::Module::Name
Location /foo
SetHandler perl-script
PerlHandler My::Module::Name
/Location
## OR  
Location /foo
SetHandler perl-script
PerlHandler +My::Module::Name
/Location
#

Stas Bekman wrote:


 I don't understand why have sent your email as an attachement... how do
 you want us to quote it?

 Anyway:

 Location /foo
 SetHandler perl-script
 PerlHandler my::foo-cookie_check()
 /Location

 s/my::foo-cookie_check/my::foo::cookie_check/ - since it's not a method,
 $r is merely passed to the handler.

 And read the eagle book about stacked handlers if that's what you want.

 _
 Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
 http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
 mailto:[EMAIL PROTECTED]  http://apachetoday.com http://eXtropia.com/
 http://singlesheaven.com http://perl.apache.orghttp://perlmonth.com/

--
My mother always used to tell me, The early bird gets the worm.
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
-- Elliott Downing






Re: cached value !!

2001-07-26 Thread Nouguier Olivier

raptor wrote:

 hi,

 I have the following problem... a module/object that use a callback
 func..example :

 use Blah;
 my $obj = new Blah(...);

 ..later on ...

 my $firstcall = 1;
 sub checkSomething {
 if ($firstcall) {$firstcall = 0; return 0}
code ...
 };

 $$obj{checkCode} = \checkSomething;

 $obj-callSomemethod();

 the problem is that during the invocations of the script the $firstcall
 sometimes stays 0, instead to be initialised to 1 on every invocation of
 the script  any ideas how can I cure this 

 Thanx alot in advance...
 =
 iVAN
 [EMAIL PROTECTED]
 =

cf manual:
http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S

--
My mother always used to tell me, The early bird gets the worm.
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
-- Elliott Downing






Re: Child Interprocess Data

2001-07-25 Thread Nouguier Olivier

Kevin Schroeder wrote:

 Hi,I want to create a program for mod_perl that shares information
 in between all the child processes so they all have current
 information.  The data will be stored in a MySQL database, but rather
 than query the DB each time which, due to the kind of server load,
 would work but would be somewhat needless, I would like to have a
 certain amount of data stored within the server and accessable to all
 the Apache processes. Could someone point me in the right
 direction to start? Kevin

Hi,
IPC::ShareLite is your friend

--
My mother always used to tell me, The early bird gets the worm.
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
-- Elliott Downing






Re: Perl::Flash PerlFlash

2001-07-20 Thread Nouguier Olivier

Jónas Tryggvi Jóhannsson wrote:

 P.S. If anyone knows about any other PERL Flash modules, please don't
 hesitate to mention them ;)


hi,
Look at http://www.opaque.net/ming/ there is perl a binding that works well

--
My mother always used to tell me, The early bird gets the worm.
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
-- Elliott Downing






An idea, for comments

2000-10-27 Thread Nouguier

Hi all

Fist of all, sorry for my bad english...

We "think/found" a technic to manage user action through a web
interface. And I like to know your opinion about it.

The goal is to trigger actions through the server without using cgi ( or
mod_perl ) fake pages.

The actions are managed by a Content Handler on a location:
Location /action

An example is better than long ( bad writen text ) so:


  /action/Client/Add

Is parsed to obtains an object type ( "Client" ) and an action to
perform ( "Add" )

$object = "Client"
$method = "Add"

and posted data are read in $fdat ( hash table ref )

Then a perl package is found regarding the object type.

$package = MyNameSpace::Client;

An the action is called on that package.

The problem we have was that we wanted the handler to be able to call
any function available on any authorised package, whithout using a
dispatcher
with a long
if() {
}elsif(){
}elsif(){
}else{
}

To sumup, here want we are doing:

1: parsing URI, to obtain a package and a method

2: look if action is allowed on that package, by this user ( with a
session management ).

3: build a string  $str = 'MyNameSpace::Client-Add( $session, $fdat
)',  $fdat are the data posted throught the handler

4: calling $return = eval $str.

5: find a redirection page for that ( package, action, result )

That all, it's work fine and it's allowing to call package/object methods whithout 
having fake pages to maintains.

Comments are very, very welcomes

--
Don't be irreplaceable, if you can't be replaced, you can't be promoted.






Re: Apache 1.3.14 and Mod_Perl

2000-10-17 Thread Nouguier

Annette wrote:

 I am new to Apache and Mod_Perl and I have a question. I am running
 Red Hat 6.0 on an Intel machine.I loaded the Server setup.Apache 1.3.6
 is loaded and runs fine. I was able to load and run Mod_Perl RMS
 package from Red Hat as DSO. I want to upgrade to Apache 1.3.14 and
 latest version of Mod_Perl.Here are the steps I took to load Apache
 1.3.14. /etc/rc.d/init.d/httpd stopI downloaded Apache_1.3.14.tar.gz
 to the /usr/src directorytar zvxf apache_1.3.14.tar.gz./configure
 --prefix=/usr/local/apachemakemake
 install/usr/local/apache/bin/apachectl start I verified that Apache
 1.3.14 is now running. How do I install the latest version of
 Mod_Perl? Every time I try to install it I receive a message stating I
 need Apache 1.3.0 and then it aborts.I tried Mod_Perl version 1.19,
 1.21, and 1.24 and I receive the same error. Any input would be
 appreciated and I hope this is the right address to send my question.
 Ann.

Hi
When the use configure, try "configure --help" to see options for
apache building, and you will see that you should add
"--enable-module=so" to build apache with a share core and
"--enable-module=perl"  for perl.

Hope it's help

--
Don't be irreplaceable, if you can't be replaced, you can't be promoted.






Re: Help...

2000-10-04 Thread Nouguier

Christophe wrote:

 I am pretty new with mod_perl and I have the following runtime error :

 Database handle destroyed without explicit disconnect at
 /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm line 144.
 [Tue Oct  3 22:33:58 2000] [error] Can't call method "errstr" on
 unblessed reference at ./libdb.pl line 35.

 What is "unblessed reference" ???

 Before it was working. I do not know why it is not working anymore...
 Here is the code around my line 35...

 ConnexionDB("db_test", "localhost", "user", "password", \$dbh, 1);
 if ($action eq "question"){
 enregistre(\$dbh, $question, $nomdemandeur, $courriel, $location,
 $langue);
 }

 thanks for any help...

hi chistophe
About DBI:
1:When you use DBI, you have to call $dbh-disconnect before the $dbh
goes out of scope to avoid this warning.

2:If you have a running statement ( eg: you've made a "select * from
youtTable" and you've not fetch all rows ) you'll also have to call
$sth-finish before calling $dbh-disconnect()  ) to avoid another
warning







Re: beginner mod_perl error

2000-09-07 Thread Nouguier

Roee Rubin wrote:

 I have been able to correct the @INC path issue and
 now have ran into the following error that is
 displayed in the error_log

 null: Undefined subroutine Apache::Hello::handler
 called

 Any help will be appreciated.

 [EMAIL PROTECTED]

 Hello,

 I have written a sample package (from a book). The
 package uses an Apache package - Constants.pm that its
 path is not included in the @INC variable. I would
 like to add the path to the variable by default and
 not in runtime as people have suggessted.

 Where are the default values of @INC stored ??

 Thanks in advance.
 [EMAIL PROTECTED]

 =
 The error I recieved ...

 Can't locate Apache/Constants.pm in @INC (@INC
 contains: (...)

 hello.pm
 ==

 package Apache::Hello;
 use strict;
 use Apache::Constants qw(:common);

 sub handler {

 my $r = shift;
 $r-content_type('text/html');
 $r-send_http_header;
 my $host = $r-get_remote_host;
 $r-print(END);
 HTML
 HEAD
 TITLEHello There/TITLE
 /HEAD
 BODY
 H1Hello $host/H1
 Testing 123
 /BODY
 /HTML
 END
 return OK;
 }

 1;

 __
 Do You Yahoo!?
 Yahoo! Mail - Free email you can access from anywhere!
 http://mail.yahoo.com/

In a PerlRequire startup.pl file just set:


#!/usr/bin/perl

sub BEGIN {
use lib qw( path/to/your/libs );
use MyLib; # To load it a startup
}




Re: ErrorDocument problem

2000-09-06 Thread Nouguier

BeerBong wrote:

 Hello all!

 I have a two apache server model (front-end - simple, back-end - power)

 I want return custom page on 404 status.
 .asp, .pl files are passed to back-end via mod_rewrite on simple Apache (I'm
 using Apache::ASP).

 When I trying to access
 1. /not_existing_file - works cgi script on simple, works fine
 2. /not_existing_file.asp - I get standart not found message, generated by
 browser!
 although
 3. /cgi-bin/error.pl - returns normal output generated by power apache.

 It seems that ErrorDocument for power Apache doesnt work...
 How I can fix this problem ? :(

 Part of httpd.conf
 ---
 IfDefine simple
   ScriptAlias /cgi-bin/ /usr/web/cgi-bin/
   Location /cgi-bin
 SetHandler cgi-script
   /Location
ErrorDocument 404 /cgi-bin/error.cgi
 /IfDefine
 IfDefine power
   Alias /cgi-bin /usr/web/cgi-bin
   Location /cgi-bin
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options ExecCGI
 PerlSendHeader On
   /Location
   ErrorDocument 404 /cgi-bin/error.pl (error.pl is symbolic link to
 error.cgi)
 /IfDefine
 ---

 --
 Sergey Polyakov - chief of WebZavod
 http://www.webzavod.ru

Hi sergey,
Perhaps you should add FollowSymLinks to your Options...





Re: IPC::Shareable problems

2000-09-06 Thread Nouguier

Steven Cotton wrote:

 Hi,

 I've been having some problems delete()'ing elements from a tied
 IPC::Shareable hash. The example from the pod works fine (but that's not
 running under mod_perl) so I'm wondering if there are any lifetime/scope
 issues with using IPC::Shareable 0.51 under mod_perl 1.24. Has anyone had
 any "Munged shared memory segment (size exceeded?)" errors when trying to
 access (I'm using `exists()') a previously deleted hash element? I see no
 examples in the Eagle of deleting tied and shared hash elements (only
 under Apache::Registry), and Deja and various newsgroups and web searches
 haven't turned up anything. I'm running Apache 1.3.12 and Perl 5.6.0.

 Thanks,

 --
 Steven Cotton
 [EMAIL PROTECTED]

hi,
 you should try with IPC::ShareLite which provide the same things but seems
better maintained...





Help...

2000-08-02 Thread Nouguier

Hi all,
A strange behaviour I don't undestand...

When using OR requiring MIME::Parser in a mod_perl ( 1.24 ) enabled
apache ( 1.3.12 ),  I've got many error 'cause perl is looking for

Mail::Field::date
Mail::Field::attrlist

There is errors on compilation, so the first call to the page
failafter it works

The same script works well in cgi.

If I include MIME::Parser on startup of apache errors are, but it
works

Why perl is looking for date.pm and attrlist.pm instead of Date.pm
and Attrlist.pm

Can I use MIME::Parser, even if my error_log is dirty

Thanks.