Re: Authentications fails after upgrade to 1.3.22
> When you up grade from one version to the next > version of apache ,U have to redo the passwd and > user. > > I had the same problem when I tried updating from > 1.3.12 to 1.3.19-rev1,and I re-did it. > > Then all where ok !,what is the version of ur > mod_perl. I wrote - I upgraded it from 1.25 to 1.26 > > Where you using AuthGroupfile for passwd > checking,... Server serves many virtual hosts and other host uses this template AuthType Basic AuthName $realm AuthUserFile /usr/local/apache/conf/users_file AuthGroupFile /usr/local/apache/conf/groups_file require group $realm-$dir But I dont understanrd what i should do to solve my problem --- Sergey "BeerBong" Polyakov chief of WebZavod (http://www.webzavod.ru) > > Lets see what the ring has to say, > > Regards, > Anand R > www.dsmsoft.com > > > > --- BeerBong <[EMAIL PROTECTED]> wrote: > Hello > all! > > > > I use Apache::AuthenRadius for authorization - all > > worked fine until I > > upgrade Apache to 1.3.22 and mod_perl to 1.26 > > from Apache 1.3.19 and mod_perl 1.25 > > > > In config file > > > ### > ># <- I use this for > > determination which daemon processes > > this config. I run front-end and back-end servers. > > > >PerlPostReadRequestHandler My::ProxyRemoteAddr > > > >ServerName www.samara.net > >DocumentRoot /usr/web/www.samara.net/data > > > >ErrorLog /usr/web/www.samara.net/logs/ep.log > > > >Use dbi_macro > >Use asp_script_macro www.samara.net > > > > > /usr/web/www.samara.net/data/abonents/> > > AuthType Basic > > AuthName "Enter your Dialup Login and > > Password" > > > > # authenticate via Radius > > PerlAuthenHandler Apache::AuthenRadius > > > > PerlSetVar Auth_Radius_host ... > > PerlSetVar Auth_Radius_port ... > > PerlSetVar Auth_Radius_secret ... > > PerlSetVar Auth_Radius_timeout ... > > > > Require valid-user > > > > > > > > > > > > > ### > > > > After upgrade, if I enter correct login and > > password, I get > > Internal Server Error and > > > ### > > [Tue Dec 18 16:02:52 2001] [crit] [client > > 195.209.67.7] configuration error: > > couldn't check access. No groups file?: > > /abonents/abo > > nent.asp > > > ### > > in logs > > > > I checked changelog for Apache and find following > > for mod_auth: > > *) Enhancement of mod_auth to handle 'Require > > file-owner' and > > 'Require file-group'. This allows access IFF > > the authenticated > > username (from the appropriate AuthUserFile > > database) matches > > the username of the UID that owns the > > document (and equivalent > > checking for file GID and user's membership > > in AuthGroupFile). > > See the mod_auth documentation for examples. > > (Not supported > > on Windows.) [Ken Coar] > > > > I think this enhancement is responsible for such > > behaviour... > > > > Any comments ? > > > > PS: Another "improvement" is the > > > > allow from 195.128.133.110 # Greg Home - > > generate warning - not supported > > comment... All was fine before 1.3.22 > > > > PPS: I downgrade to 1.3.19 until solve this > > problems. > > > > --- > > Sergey "BeerBong" Polyakov > > chief of WebZavod (http://www.webzavod.ru) > > > > > > > > = > Regards, > > Anand_R, > No:25(old no:13)Nungambakkam High Road, > DSM Soft(P)Ltd, > Chennai.INDIA - 600 034. > Ph No:825 0183/825 3853/825 3835 > >
Re: Tips & tricks needed :)
On Wed, 19 Dec 2001 16:01:22 - Matt Sergeant <[EMAIL PROTECTED]> wrote: > Actually I was wondering about writing an Apache::Singleton class, that > works the same as Class::Singleton, but clears the singleton out on each > request (by using pnotes). Would anyone be interested in that? Like this? (using register_cleanup instead of pnotes) package Apache::Singleton; use strict; use vars qw($VERSION); $VERSION = '0.01'; use Apache; sub instance { my $class = shift; # get a reference to the _instance variable in the $class package no strict 'refs'; my $instance = "$class\::_instance"; unless (defined $$instance) { $$instance = $class->_new_instance(@_); Apache->request->register_cleanup(sub { undef $$instance }); } return $$instance; } sub _new_instance { bless {}, shift; } -- Tatsuhiko Miyagawa <[EMAIL PROTECTED]>
Report on mod_accel and mod_deflate
Igor Sysoev mentioned recently on this list that he has written a module called 'mod_accel' that provides a caching HTTP accelerator, as well as a mod_gzip replacement called 'mod_deflate'. These modules are both used on Kaspersky labs' busy sites, as well as at the popular portal http://www.rambler.ru. mod_deflate is used at around 700 sites. So why haven't we heard more of them? Because the docs are only in Russian, and almost all implementations have occured on Russian sites. Well, the good news is that I've now implemented a mod_accel/mod_deflate front-end on http://www.fastmail.fm, allowing me to announce a substantial speedup to our users: http://www.emailaddresses.com/forum/showthread.php?threadid=1603 You may notice in the linked announcement that I mention "I've been able to remove the restriction that attachments have to be downloaded within an hour". We previously had this restriction because even with mod_proxy as a front-end, uploads larger than the TCP buffer get fed through bit by bit, keeping the mod_perl handler open the whole time... So we had code like: || my $oldalarm=alarm(0); || alarm 3600; || my $Status = $R->parse; || alarm $oldalarm; Without that, the backend app server can hang around for ever serving one client. We had similar code for downloads, as well as uploads. BTW, Joe Schaefer has posted a mod_proxy patch to this list that fixes this for POST uploads. Well, mod_accel gets around this problem by automatically buffering large uploads and downloads onto the filesystem! :-) In fact, mod_accel reads the backend response and sends it to client asynchronously, so the client sees the first part of the response even before the backend has completed the request. But the backend is never blocked by the client, since it is buffered to the file-system as required. mod_deflate works really well with mod_accel so that both dynamic forwarded requests and static requests are compressed. mod_deflate also has lots of intelligence to avoid compressing content to buggy browsers that can't handle it. OK, enough evangelism. On to practical matters. Many of the following snippets and comments were provided to me by Igor in private email, so thank him, not me. Firstly, here's how to compile everything (including mod_ssl on the front-end) and install it into /usr/local/apache_accel: tar -zxvf mod_accel-1.0.7.tar.gz tar -zxvf mod_deflate-1.0.9.tar.gz tar -zxvf mm-1.1.3.tar.gz cd mm-1.1.3 ./configure --disable-shared make cd ../mod_ssl-2.8.5-1.3.22 ./configure --with-apache=../apache_1.3.22_accel/ \ --with-crt=/INSERT_APPROPRIATE_PATH.crt \ --with-key=/INSERT_APPROPRIATE_PATH.key cd ../mod_accel-1.0.7 ./configure --with-apache=../apache_1.3.22_accel/ \ --with-eapi=../mod_ssl-2.8.5-1.3.22/pkg.eapi/ make cd ../mod_deflate-1.0.9 ./configure --with-apache=../apache_1.3.22_accel/ make cd ../apache_1.3.22_accel/ EAPI_MM=../mm-1.1.3 SSLBASE=SYSTEM ./configure --enable-rule=EAPI \ --prefix=/usr/local/apache_accel --disable-rule=EXPAT \ --enable-module=most \ --enable-module=rewrite \ --activate-module=src/modules/accel/libaccel.a \ --activate-module=src/modules/extra/mod_deflate.o make make install mkdir /var/accelcache chown nobody:nobody /var/accelcache/ /usr/local/apache_accel/bin/apachectl startssl Now, in /usr/local/apache_accel/conf/httpd.conf, append the following: AccelCacheRoot /var/accelcache 1 AccelNoCacheon AccelPass/mail/http://127.0.0.1:8080/mail/ AccelWaitBeforeBodyRead 100 AccelUnlinkNoCached off AccelSetXHost on AccelSetXRealIP on AccelSetXURL on This creates an HTTP accelerator without any caching. I don't know much about the caching directives and haven't tried them out, so I can't provide any guidance there. The AccelCacheRoot directive sets the number of levels of subdirectories in the cache. 16 first level subdirectories named 0 .. f and 256 second level subdirectories named 00 .. ff are used by default (i.e. "AccelCacheRoot 1 2"). Since I'm not caching, my config above does not specify any directory hashing (i.e. "AccelCacheRoot 1"). AccelNoCache simply turns off caching. AccelPass specifies that I want everything under /mail/ forwarded to the backend. You can also specify '/' for AccelPass, and then use something like "AccelNoPass /download /images ~*\.jpg$" to create exceptions (uses standard regex syntax). Note that mod_accel can also be called by utilising the mod_rewrite [P] directive, just like with mod_proxy. AccelWaitBeforeBodyRead sets the time in milliseconds to wait between receiving the response header and the first part of the body. It is useful over Ethernet where packets are small. If mod_accel waits a little it can read most of the body or even the whole body with one just one select()/read() pair of syscalls. You can see the first read size and the number of reads in the log with %{accel}x in a CustomLog directive. Igor usually uses 100-200 millise
How to use LWP::Simple inside a safe compartment?
Hi... I want to use LWP::Simple inside a safe compartment created with the Safe Module. But it ends up with errors like "Can't locate object method "new" via package "LWP::UserAgent" at line... or "Require trapped by operation mask..." Here is how the code looks like (shortened ;-) ): $codefromoutside='print wget "http://google.com";;'; use LWP::Simple (); sub wget { LWP::Simple::get $_[0] } use Safe; $safe=new Safe; $safe->share(qw(wget)); $safe->reval($codefromoutside); print $@ if $@; (There is a reason why I use "wget" instead of "get" directly because I have already a subroutine with the name "get" elsewhere) I tried some other things but they all didn't work. Does anybody know how to use LWP::Simple::get inside a save compartment? Thanks in advance, Best regards, Christoph Bergmann PS: Sorry for this is not a 100% mod_perl question but I haven't get any help anywhere else right now and the problem results from running unkown code under mod_perl (thats why I need the safe module), so chances are that this is a common problem under mod_perl...
FW: public and private code branch
Any good idea here? Steve Lihn FIS Database Support, Merck & Co., Inc. Tel: (908) 423 - 4441 -Original Message- From: Lihn, Horng-Twu [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 4:53 PM To: [EMAIL PROTECTED] Subject: public and private code branch Does anyone have an example how to set up httpd.conf so that there is a separation between public and private code: .../epl/ public/ index.html private/ my private .epl code The DocumentRoot will be .../epl/public/ Yet in index.html I can Execute stuff in private/ Thanks, Steve Lihn FIS Database Support, Merck & Co., Inc. Tel: (908) 423 - 4441 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE:require -- Mason vs embperl
At 2:26 PM -0500 12/19/01, Lihn, Horng-Twu wrote: >Kee, >This helps. But if I have to do this in very page, >isn't this post a serious problem to the memory consumption? I can't speak to "require". But if you do a "use" in an Embperl script, the library will load once per-process. In fact this occasionally causes problems for me, since I'm doing virtual hosting and sometimes I have moved one site to a new library, but haven't recoded the other--can't do that if the two servers are reusing common Apache processes. That said, it would be nice (just from an easy-of-use point of few) if Embperl had an option to load a common library for all of your Embperl files on a site--but you could easily do that using EmbperlObject. Just define a template something like this: [! use MyLibrary; !] [- Execute('*') -] Now all of your files have access to MyLibrary. -- Kee Hinckley - Somewhere.Com, LLC http://consulting.somewhere.com/ [EMAIL PROTECTED] (or ...!alice!nazgul for time travelers :-) I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
Re: require -- Mason vs embperl
"Lihn, Horng-Twu" wrote: > Kee, > This helps. But if I have to do this in very page, > isn't this post a serious problem to the memory consumption? > Or not? in what way? - u either need the code, or u don't. if u don't need all of it, split it into smaller pieces. > > > -Steve > > >Maybe I'm missing something, because this seems simple. > >[- require "foo.pl"; -] > >will load it everytime the page is loaded > >[! require "foo.pl"; !] > >will load it once the first time the page is loaded. > > >I use libraries from within Embperl all the time, I don't believe in > >putting full code definitions in front of the designers. -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
RE:require -- Mason vs embperl
Kee, This helps. But if I have to do this in very page, isn't this post a serious problem to the memory consumption? Or not? -Steve >Maybe I'm missing something, because this seems simple. >[- require "foo.pl"; -] >will load it everytime the page is loaded >[! require "foo.pl"; !] >will load it once the first time the page is loaded. >I use libraries from within Embperl all the time, I don't believe in >putting full code definitions in front of the designers.
Re: Tips & tricks needed :)
> > If you want a per-request global, use $r->pnotes() instead of a standard > > perl global. Then mod_perl *WILL* do it for you. > > True. But then you are using the Apache object and you're program > doesn't work as a standard CGI anymore :( I handle this by chekcing for $ENV{MOD_PERL} and just using a global for storage if it isn't defined. > Separating by namespace is not very convenient > though. What I have been doing to get around this is that I wrote a > simple module that can be used as a global scalar and that uses tie to > return appropriate variable (FYI I've attached the module, if that > interests anyone). That's a good idea. I've done similar things with accessor methods instead of tied scalars. - Perrin
Re: Mason vs embperl
At 8:03 PM +0100 12/18/01, C.Hauser - IT assistance GmbH wrote: >I use Dreamweaver for the publishers and the <% and <& commands are >properly displayed as ASP-icons. I use it with Modules Apache::Session, http://www.somewhere.com/software/ for Dreamweaver extensions to display Embperl properly. I have an overview of things you should think about when looking at scripting languages at http://commons.somewhere.com/buzz/2000/scripting.html -- Kee Hinckley - Somewhere.Com, LLC http://consulting.somewhere.com/ [EMAIL PROTECTED] (or ...!alice!nazgul for time travelers :-) I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
Re: Tips & tricks needed :)
On Wed 19-Dec-2001 at 10:43:34AM -0500, Perrin Harkins wrote: > > ALWAYS reinitialize $Your::Singleton::ETERNAL on each query! > > mod_perl will *NOT* do it for you. > > If you want a per-request global, use $r->pnotes() instead of a standard > perl global. Then mod_perl *WILL* do it for you. True. But then you are using the Apache object and you're program doesn't work as a standard CGI anymore :( > > You might think 'ah yeah but it would be nice if > > $Your::Singleton::ETERNAL could be persistent across queries...' which > > is sometimes desirable, but remember that if you have multiple instances > > of your application running on the same apache, > > $Your::Singleton::ETERNAL will be common to ALL of them. > > It will be common to all requests in that particular process, but not shared > between multiple Apache processes. If you take requests for different > applications that need different singletons on the same Apache process, you > should separate them by namespace so they don't collide. Yup, that's what I meant. Separating by namespace is not very convenient though. What I have been doing to get around this is that I wrote a simple module that can be used as a global scalar and that uses tie to return appropriate variable (FYI I've attached the module, if that interests anyone). Cheers, -- IT'S TIME FOR A DIFFERENT KIND OF WEB Jean-Michel Hiver - Software Director [EMAIL PROTECTED] +44 (0)114 221 4968 VISIT HTTP://WWW.MKDOC.COM MPH.pm Description: Perl program
Re: Tips & tricks needed :)
> One thing I don't quite > understand is the need to "clear out" a singleton. Why would a > singleton need to hold transient state? It's good for holding something request-specific, like a user session.
Re: Tips & tricks needed :)
Perrin Harkins writes: > Okay, wishful thinking. I don't use Class::Singleton, but I have written my > own versions of Object::Registrar a few times to accomplish the same goal. Ditto. We use a registry mechanism, too. One thing I don't quite understand is the need to "clear out" a singleton. Why would a singleton need to hold transient state? Rob
RE: Mason vs embperl
At 4:14 PM -0500 12/18/01, Lihn, Horng-Twu wrote: >I have a library of perl routine that I call in cgi-bin environment >where I usually "require". I could not find any way to require it >and use it in Embperl. I can not find any doc describing how this is done. >(I can require it in the Mason handler.pl) > >Can you shed a light? I think it has something to do with the object model >which I can not fully comprehend so far. Maybe I'm missing something, because this seems simple. [- require "foo.pl"; -] will load it everytime the page is loaded [! require "foo.pl"; !] will load it once the first time the page is loaded. I use libraries from within Embperl all the time, I don't believe in putting full code definitions in front of the designers. -- Kee Hinckley - Somewhere.Com, LLC http://consulting.somewhere.com/ [EMAIL PROTECTED] (or ...!alice!nazgul for time travelers :-) I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
Re: Tips & tricks needed :)
> No, it's nothing like Object::Registrar. It's like Class::Singleton. Okay, wishful thinking. I don't use Class::Singleton, but I have written my own versions of Object::Registrar a few times to accomplish the same goal. I don't like to make my core classes dependent on running in a mod_perl environment if I can avoid it, so I prefer to use a separate registry approach that keeps $r->pnotes() out of my classes. It's also nice to be able to quickly adapt other people's classes in this way without changing their code to use Class::Singleton. - Perrin
Re: How to Use Apache as a FTP server
hi, While if i were to take you literally it will not work. HTTP and FTP behave comepletely differently. However you can simulate it .. eg ftp://ftp.myserver.pre As well as browsers tend to do passive ftp .. for downloads .. Hope that helps a little. Regards, [EMAIL PROTECTED] /* Security is a work in progress - dreamwvr */ // "Who's Afraid of Schrodinger's Cat?" /var/(.)?mail/me \? ;-]
RE: Tips & tricks needed :)
> -Original Message- > From: Perrin Harkins [mailto:[EMAIL PROTECTED]] > > > Actually I was wondering about writing an Apache::Singleton > class, that > > works the same as Class::Singleton, but clears the > singleton out on each > > request (by using pnotes). Would anyone be interested in that? > > This sounds a bit like Object::Registrar. No, it's nothing like Object::Registrar. It's like Class::Singleton. Matt. _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
RE: [modperl site design challenge] and the winner is...
> > All that makes it really easy for someone new to feel comfortable. And isn't that what the mod_perl site should do? > > It would be nice to see license info, too, as someone new > might want to be > clear on that right away, too. > > You can also quickly see a list of supported modules. This > shows that it's > easy to extend, but also allows someone to see that it can do > the thing > *they* might be interested in. Sure, perl has CPAN, but I > think it would > be good to show a list of commonly used modules for mod_perl, > and what they > do, in a simple list. If someone is just learning about > mod_perl (or php) > the list doesn't need to be that big, as their needs will be > reasonably basic. The list could give the module authors a chance to write a paragraphs describing what the module does in 50 words or less to new users can get an idea without have to wade into the CPAN pool. > > Maybe as a community (of programmers not designers) we could hire a > professional designer to help develop our "brand". Cool web > site. Some > print ads in the trades. What's a small amount in dues to > the Association > of Mod_perl Programmers compared to increase of mod_perl work overall? > I'm all for this. I use mod_perl on a daily basis, but either due to lack of time or lack of knowledge or other reasons I don't get to give back to the community as much as I would like. This is a way for me and others in a situation similar to mine to give back to mod_perl.
Re: Tips & tricks needed :)
> ALWAYS reinitialize $Your::Singleton::ETERNAL on each query! > mod_perl will *NOT* do it for you. If you want a per-request global, use $r->pnotes() instead of a standard perl global. Then mod_perl *WILL* do it for you. > You might think 'ah yeah but it would be nice if > $Your::Singleton::ETERNAL could be persistent across queries...' which > is sometimes desirable, but remember that if you have multiple instances > of your application running on the same apache, > $Your::Singleton::ETERNAL will be common to ALL of them. It will be common to all requests in that particular process, but not shared between multiple Apache processes. If you take requests for different applications that need different singletons on the same Apache process, you should separate them by namespace so they don't collide. - Perrin
Re: Tips & tricks needed :)
> Actually I was wondering about writing an Apache::Singleton class, that > works the same as Class::Singleton, but clears the singleton out on each > request (by using pnotes). Would anyone be interested in that? This sounds a bit like Object::Registrar. If you do it, I'd suggest giving it a "scope" option for each variable that determines if it's process or request scope. In fact you could add support for some kind of data-sharing and offer a server scope as well. - Perrin
[RFC] Apache::WinBitHack
Hi, As part of the mod_perl developer's cookbook, we'd like to propose a module - Apache::WinBitHack - for possible inclusion in CPAN. This module enables Win32 mod_perl users to emulate Apache's XBitHack using file attributes. Usage is described below in the readme. You can get the sources from http://www.modperlcookbook.org/download/Apache-WinBitHack-0.01.tar.gz and an ActivePerl ppm package is available via (on one line) ppm install http://www.modperlcookbook.org/download/Apache-WinBitHack.ppd You may need to upgrade mod_perl itself to use this, either from the ppm package at http://theoryx5.uwinnipeg.ca/ppmpackages/ or, if you compile it yourself, from the cvs sources. best regards, randy kobes NAME Apache::WinBitHack - An Apache module to emulate XBitHack on Win32 SYNOPSIS In Apache's httpd.conf: PerlModule Apache::WinBitHack SetHandler perl-script PerlFixupHandler Apache::WinBitHack XBitHack Full Options MultiViews Indexes Includes DESCRIPTION Apache contains a very useful directive 'XBitHack', whereby a file that has the user-execute bit set will be treated as a server-parsed html document. As well, the group-execute bit can be used to set the Last-modified time of the returned file to be the last modified time of the file, which is useful in determining if a document is to be cached or not. On Win32 the directive works in principle, but in an inconvenient fashion - the execute bit is set on Win32 by the file extension, which means that documents that are to take advantage of 'XBitHack' must have an extension like 'exe' or 'bat'. This module emulates 'XBitHack' on Win32 by, rather than using the user and group execute bits, using instead the attributes of the file to determine if the file is to be server-parsed by mod_include. Attributes of a file on Win32, which you can see by running C:\> attrib file_name include 'archive', 'hidden', 'read-only', and 'system'. Normal user files have just the 'archive' attribute set, which some back-up programs use to determine if the file should be included in the next incremental backup (most backup programs now instead use the last-modified-time of the file for this purpose). By setting certain attributes of the file and specifying directives as in the SYNOPSIS, particularly the 'Includes' option, 'XBitHack' can be emulated in the following ways. XBitHack Off With this directive, no server-side parsing of the file will be performed. XBitHack On This directive emulates setting the user-execute bit. With this directive, a file will parsed by mod_include if the 'archive' attribute is unset, which you can do by C:\> attrib -a file_name Note that when a user's file is first created or when it is edited the 'archive' attribute will normally be set (and all others unset), so you must intentionally unset the 'archive' attribute to enable server-parsing of the file. XBitHack Full This directive emulates the action of also setting the group-execute bit. With this directive, as with 'XBitHack On', a file will be parsed by mod_include if the 'archive' attribute is unset. As well, a Last-modified header will be sent, equal to the last-modified time of the file, *unless* the 'read-only' attribute of the file is set, which you can do by C:\> attrib +r file_name SEE ALSO the mod_perl manpage The description of the 'XBitHack' directive in the Apache manual (http://httpd.apache.org/docs/mod/directives.html). AUTHORS Randy Kobes <[EMAIL PROTECTED]> Geoffrey Young <[EMAIL PROTECTED]> Paul Lindner <[EMAIL PROTECTED]> COPYRIGHT Copyright (c) 2001, Geoffrey Young, Paul Lindner, Randy Kobes. All rights reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. HISTORY This code is derived from the *Cookbook::WinBitHack* module, available as part of "The mod_perl Developer's Cookbook". For more information, visit http://www.modperlcookbook.org/
RE: Tips & tricks needed :)
> -Original Message- > From: Perrin Harkins [mailto:[EMAIL PROTECTED]] > > > ALWAYS reinitialize $Your::Singleton::ETERNAL on each query! > > mod_perl will *NOT* do it for you. > > If you want a per-request global, use $r->pnotes() instead of > a standard > perl global. Then mod_perl *WILL* do it for you. Actually I was wondering about writing an Apache::Singleton class, that works the same as Class::Singleton, but clears the singleton out on each request (by using pnotes). Would anyone be interested in that? Matt. _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
Re: Tips & tricks needed :)
> 2. We will use Template-Toolkit and Apache/mod_perl. Problem is that 2 > out of 3 people have never used TT or programmed mod_perl and OO Perl. > Only I've made sites this way, they've used Embperl til now. How can I > make this switch for them a little easier? Get them all copies of the Eagle book and Damian's OO book (or the Advanced Perl Programming book, which I also like for OO). Have them read at least the porting and traps documentation that comes with mod_perl, if not the whole Guide. Decide if you will be using a framework like OpenInteract or OpenFrame. If not, decide on a basic structure for request handling, error handling, and parameter parsing, and document it. We made this same transition at eToys, and you can do it. Learning to use TT is pretty quick, but OO and mod_perl require more hand-holding and are much easier if you have someone around with some confidence in how to use them. I'm including a brief outline that I used when I gave a talk about mod_perl. It's slightly out of date, but it shows what I considered to be the highlights for mod_perl newbies. > Which data should I send with cookie? Only some random > key which is also stored in dbase and this key is used to find real data > from dbase? Yes, use a unique key with some kind of MAC so you can be sure it isn't forged when it's sent back to you. See the recent thread and the AuthCookie module. Note that some things still have to passed as query args or hidden fields. This would be anything that could be happening in multiple windows, like search terms (if you tied them to the cookie, searches in multiple windows would interfere with each other). > 4. How is most reasonable to store(and use too) complex formulas and > coefficients? I would use an OO approach with polymorphism, like others have described. - Perrin What is mod_perl? An Apache module. An embedded Perl interpreter. Fast. Flexible. What's wrong with CGI? Forking Perl on every request. Compiling the script every time. Opening a new database connection every time. Apache::DBI. The Apache request lifecycle. See diagram. The Apache API. See code listing. $r $r->headers_in->{'User-Agent'} $r->parsed_uri $r->args The config file. How mod_perl emulates CGI. Apache::Registry Apache::PerlRun What do you need to know as a programmer? Memory management. use strict! use strict! use strict! Pre-loading and copy-on-write. See diagram. startup.pl Imported symbols and use vars. Traps Global settings: $/, $^T, $^W, $| Using them safely with local. -M test implications. use, require, do, and %INC Compiled regular expressions. See the guide or Perl Cookbook. BEGIN and END blocks. Performance tweaks. Apache::Request for query string. See listing. Apache::Cookie for cookies. See listing. Apache::Util for escaping HTML and URIs See benchmark. DBI: prepare_cached and finish Reloading your code changes. Restart the server. Apache::StatINC. Stonehenge::Reload. PerlFreshRestart. Memory considerations for live servers. Profiling Debugging Tricks to use in production. Apache::SizeLimit. Proxy server setup. Resources Read the guide! - http://perl.apache.org/guide/ PerlMonth - http://perlmonth.com/ perldoc everything The Eagle Book and http://www.modperl.com the mailing list Comparison to other systems?
Re: require in Embperl (was: Mason vs embperl)
> "Lihn, Horng-Twu" <[EMAIL PROTECTED]> writes: > > > I have a library of perl routine that I call in cgi-bin environment > > where I usually "require". I could not find any way to require it > > and use it in Embperl. I can not find any doc describing how this is done. > > (I can require it in the Mason handler.pl) > > In embperl, you can require or use within [! !] and [- -] tags. > > If you only want to require the module (and not import symbols, like "use" does), it's the best to load it on server startup, for example via PerlModule foo in your httpd.conf Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: [modperl site design challenge] and the winner is...
I'm throwing in my two cents a bit late, so it's a bit depreciated now (one cent?). But something to think about for the site. I've worked with php a little lately -- not programming, but making minor changes to a site. I've used the php site http://www.php.net/ a few times, and I've found it reasonably functional, but also quite easy for someone new to php. Maybe it seems that way because I know nothing about php and it's geared toward my level. But that's good. How often to the mod_perl pros need to read the mod_perl home page? I'm sure all these elements will be added to the new mod_perl site in some way, but I just wanted to note what I liked about the php site. And I'm not comparing mod_perl to php! What the php site shows in a real obvious way is: 1) what is php (for someone that is brand new) with a link to some basic examples. It demystifies php in a hurry. Makes someone think "Oh, I can do that". 2) currently, it's showing Netcraft's usage stats, so I see that people are using it in growing numbers -- it's not a dead-end for a new person to try out. 3) it shows upcoming events. That shows that there's a real support group of real people to work with. Links to discussion lists archives would be good there. All that makes it really easy for someone new to feel comfortable. It would be nice to see license info, too, as someone new might want to be clear on that right away, too. You can also quickly see a list of supported modules. This shows that it's easy to extend, but also allows someone to see that it can do the thing *they* might be interested in. Sure, perl has CPAN, but I think it would be good to show a list of commonly used modules for mod_perl, and what they do, in a simple list. If someone is just learning about mod_perl (or php) the list doesn't need to be that big, as their needs will be reasonably basic. Existing mod_perl (or php?) programmers might not like all that basic, first-time user stuff right on the home page, and would rather have a more "functional" site. I don't know about anyone else, but I've got the links I need bookmarked, and if not I go to perl.apache.org and ^F right to where I want to go. BTW -- At first I liked David's idea of using the ASF look. That ties mod_perl to apache well. But, if the site is intended to bring in new users, it might be good to be a bit more flashy. Maybe as a community (of programmers not designers) we could hire a professional designer to help develop our "brand". Cool web site. Some print ads in the trades. What's a small amount in dues to the Association of Mod_perl Programmers compared to increase of mod_perl work overall? Bill Moseley mailto:[EMAIL PROTECTED]
Re: Convert bitmap
Hans-Olof Hermansson <[EMAIL PROTECTED]> said something to this effect on 12/19/2001: > I am looking for a perl module that can convert a > bitmap picture to jpeg or gif. I am sending a bitmap > from a Pocket PC device to a Solaris webserver running > Apache. If anyone has any tips it will be greatly > appreciated. Have you looked into PerlMagick? http://www.imagemagick.org/www/perl.html (darren) -- My one regret in life is that I am not someone else. -- Woody Allen
Re: Tips & tricks needed :)
If you're developing a complex application, you'll probably want to split it in a horde of specialized modules. Few things to remember: == You will probably feel the need to use static variables (i.e. variables shared with all instances of a given class) at some point. For example if you have a singleton object you might have something like that: package Your::Singleton; use strict; use 5.6; use our $ETERNAL = undef; sub instance { my $class = shift; return $ETERNAL if (defined $ETERNAL); $ETERNAL = $class->new (@_); return $ETERNAL; } sub new { ... blah blah code ... } 1; ALWAYS reinitialize $Your::Singleton::ETERNAL on each query! mod_perl will *NOT* do it for you. You might think 'ah yeah but it would be nice if $Your::Singleton::ETERNAL could be persistent across queries...' which is sometimes desirable, but remember that if you have multiple instances of your application running on the same apache, $Your::Singleton::ETERNAL will be common to ALL of them. == Cyclic memory references are dangerous, try to avoid them as much as possible! Perl garbage collector does miserably fails in the case of cyclic refs. If you have a cycling references that keep going out of scope, they will never be garbage collected and your server might have some trouble :-) == Beware of regular expressions /o modifier! The application I'm working on has a cool feature heavily using regular expressions: automagic hyperlinking of text / html data when appropriate. I used to use the /o modifier and got a few nasty surprises (until I discovered the mod_perl guide traps page) == Other than that, more generally speaking: Always hide classes implementation with method calls! Not so long ago I did tend to write using less method calls and directly accessing object's attributes and now this is my #1 source of maintenance problem and headaches. It you think it's too slow then consider it's better to buy a bigger CPU than 3 tons of aspirin. Also avoid using packages names inside functions as much as possible, as it tends to screw inheritance. Finally my biggest piece of advice: ENFORCE a coding style. ENFORCE using english for variable, function names and comments (for example although I'm French I really can't stand code written with french variable names and comments! The Perl language is using English keywords after all. Be consistent FFS) . ENFORCE commenting what every single method does. Having said that I do naturally tend to write awful code that only I can understand, but at least everything is properly commented :) Cheers, -- IT'S TIME FOR A DIFFERENT KIND OF WEB Jean-Michel Hiver - Software Director [EMAIL PROTECTED] +44 (0)114 221 4968 VISIT HTTP://WWW.MKDOC.COM
Re: embperl [* *] does not work
> I am trying [* *] tag and the code as simple as this does not work. Note that [* *] is experimetal and will not work always in 1.3.x (it does in 2.0) > I am using embperl 1.3.2 build from theoryx5.uwinnipeg.ca for Windows. > Please upgrade to the newest version (1.3.4), because there where a number of bug fixes for win32 > > Test > > [* $c = 5; *] > count: [+ $c +] > [* $c++; *] > count: [+ $c +] > - > This normaly should work without problems. If it doesn't work after an upgrade try to replace [* *] with [- -] Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: Tips & tricks needed :)
[EMAIL PROTECTED] wrote: > > 1. Regarding the switch to postgresql, I think that's a good choice. Just pay > attention to postgresql's data types, and try to get your fields types and > lengths correct the first time if possible. It doesn't completely support the > ALTER TABLE command, so changing column types can be a pain, although it's still > possible. The other thing is that SQL syntax might be slightly different in a > few cases, though it's been too long since I used MySQL to remember any > examples. Postgresql's web site has some tips for switching, I think at > http://techdocs.postgresql.org. something i'll add to that - if your new postgresql db will have foreign keys, and you previously didn't have any code written to guarantee your data's integrity in mysql, then you probably won't be able to import all your data without some massaging (unless you're sure your data's integrity is ok). i wholeheartedly second wes' statement that switching to postgresql is a good choice.
Re: Tips & tricks needed :)
1. Regarding the switch to postgresql, I think that's a good choice. Just pay attention to postgresql's data types, and try to get your fields types and lengths correct the first time if possible. It doesn't completely support the ALTER TABLE command, so changing column types can be a pain, although it's still possible. The other thing is that SQL syntax might be slightly different in a few cases, though it's been too long since I used MySQL to remember any examples. Postgresql's web site has some tips for switching, I think at http://techdocs.postgresql.org. 2. Have them read some articles on the whole MVC approach, since it sounds like you'll be using that. And of course read Damian's book several times for OO perl. 4. You might put the formulas in a perl superclass, with one method per formula. Then create a subclass for each different company that has that company's algorithm. All the calling code has to worry about is which company it's dealing with when it instantiates the object; after that all the right formulas will get used automatically. This should make it easy to add more companies, too. I guess the general principle is that when you're faced with tons of complexity, try breaking it down into smaller pieces and add an abstraction layer or two, so you and the program can deal with it. Hope this helps. I'll be watching for the success story! -- Wes Sheldahl Viljo Marrandi <[EMAIL PROTECTED]> on 12/19/2001 03:50:49 AM To: modperl list <[EMAIL PROTECTED]>, templates list <[EMAIL PROTECTED]> cc:(bcc: Wesley Sheldahl/Lex/Lexmark) Subject: Tips & tricks needed :) Hello, We're going to make a web-site for insurance company (err, more like portal for several companies) and the problem is that ( I think ) it's going to be our biggest and most complex site we've ever done AND we're going to use some new stuff we've never used. So I'd be very happy if you can give me some points what to look at, what are real no-no's and what are go-go's. 1. We're going to switch from mysql to postgresql, because we need transactions, triggers and all other stuff that mysql doesn't support. What could be possible problems going from mysql to postgres, if any? 2. We will use Template-Toolkit and Apache/mod_perl. Problem is that 2 out of 3 people have never used TT or programmed mod_perl and OO Perl. Only I've made sites this way, they've used Embperl til now. How can I make this switch for them a little easier? I know I must spend a lot of time teaching them, but may-be there are some kinda switchover tutorials or something? 3. Authorization. Is cookie based auth most reasonable or are there some other ways too? .htaccess will not do, I think, because all data is in the same directory and authorized access/login is needed only on some parts of site. Which data should I send with cookie? Only some random key which is also stored in dbase and this key is used to find real data from dbase? (I guess I must read again this thread about cookies). 4. How is most reasonable to store(and use too) complex formulas and coefficients? Problem is that there are 4 companies and each of them has different way to calculate same thing eg. insurance for travelling, car insurance etc. Unfortunately they are all quite different, because every company uses even different things to calculate final result. So if we use different formula for every company and insurance type we end up with ~50 formulas and none understands afterwards which is which. Are there any guidelines to generalize formulas? Ok, let's say we even somehow make these formulas general enough to use, but where shall the calculation take place? Postgres stored procs or in perl code/module (i think this) or even in TT? Constans will be in db. 5. Any other things to look out when creating large site and/or running it over SSL and/or using above described configuration? P.S. I hope that in about few months I can write about this project to success stories ;-) Thanks for your attention, Viljo
Re: [VERY OT] How to Use Apache as a FTP server
That's not mod-perl. That's not even Apache. Many popular web browsers have browsing features for anonymous FTP. You need an FTP server for that. Apache 2 will include an FTP server (I think), but for now, try wuftpd. Issac anandr wrote: >Hi All, > >I want to use my Apache as a ftp service also. >Can the ring help me. > >I am running Apache 1.3.22 at port 80. > >when I give http:///, I get the list of >files in my htdocs. > >Like wise when I give ftp:///, I need a >list from my server folders. > >Have look at this address,for what I am intending to >do,..ftp://tiger.com. > > >With Regards, > >Anand Ratnasabapathy, >DSM Soft(P)Ltd, >No:25,Nungambakkam High Road, >Chennai - 600 034. >http://www.dsmsoft.com > -- Internet is a wonderful mechanism for making a fool of yourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint: 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
Re: [modperl site design challenge] and the winner is...
>>Ideally if Thomas, Carlos and Allan could take >>the best of each other's work and produce the "perfect" design, that >> > That would be OK for me, Carlos, Allan?? Wow, all three winners have agreed to work together to make the killer design! that's great guys!!! I guess the next step is to apply fixes suggested in the comments I posted yesterday and do some more polishing. Please post the URLs of things that you change to the docs-dev mailing list. Use [EMAIL PROTECTED] to get yourself on this list. And we will discuss it there. Remember David Harris' suggestion to use the colormap (and layout?) used by other ASF sites. Sounds like a good idea. Thanks again! _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Convert bitmap
Hi, I am looking for a perl module that can convert a bitmap picture to jpeg or gif. I am sending a bitmap from a Pocket PC device to a Solaris webserver running Apache. If anyone has any tips it will be greatly appreciated. Reagrds Hans-Olof __ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com
Re: [DIGEST] mod_perl digest 2001/12/15
James G Smith wrote: > > -- > > mod_perl digest > > December 1, 2001 - December 15, 2001 > > -- > > Recent happenings in the mod_perl world... > > With many thanks to Geoffrey Young for his work on this digest in the > past, I will try and continue the job for a while. > the thing I like about this group is that everyone has the same goals in mind. Thanks, James, for picking up the torch - everyone will benefit from having the digests continue. looks great! --Geoff
Re: Mason vs embperl
"Lihn, Horng-Twu" <[EMAIL PROTECTED]> writes: > I have a library of perl routine that I call in cgi-bin environment > where I usually "require". I could not find any way to require it > and use it in Embperl. I can not find any doc describing how this is done. > (I can require it in the Mason handler.pl) In embperl, you can require or use within [! !] and [- -] tags.
How to Use Apache as a FTP server
Hi All, I want to use my Apache as a ftp service also. Can the ring help me. I am running Apache 1.3.22 at port 80. when I give http:///, I get the list of files in my htdocs. Like wise when I give ftp:///, I need a list from my server folders. Have look at this address,for what I am intending to do,..ftp://tiger.com. With Regards, Anand Ratnasabapathy, DSM Soft(P)Ltd, No:25,Nungambakkam High Road, Chennai - 600 034. http://www.dsmsoft.com
Re: mod_perl vs. C for high performance Apache modules
... > work on Mars. The investor claims to have evaluated Perl vs. C years ago, > to have witnessed that every single hit on the webserver under mod_perl > causes a CPU usage spike that isn't seen with C, and that under heavy load ]- this seems to me like non-compiled script, module or eventually running under Apache::PerlRun :"))
Re: Tips & tricks needed :)
Viljo Marrandi <[EMAIL PROTECTED]> writes: I'm answering what I can... :-) > 3. Authorization. Is cookie based auth most reasonable or are there some > other ways too? .htaccess will not do, I think, because all data is in > the same directory and authorized access/login is needed only on some > parts of site. Which data should I send with cookie? Only some random > key which is also stored in dbase and this key is used to find real data > from dbase? (I guess I must read again this thread about cookies). First of all, why putting everything at the same place? It would be easier to maintain things if only the generic things are at the same place and specific things are in their own directories. Depending on how much data you're going to store, I'd use a cookie that is a hash (e.g. MD5) to some index at the database. Don't send confidential information on them (people might use some public internet to view their information) and try not sending plain text (people might be tempted to change values). > 4. How is most reasonable to store(and use too) complex formulas and > coefficients? Problem is that there are 4 companies and each of them has > different way to calculate same thing eg. insurance for travelling, car > insurance etc. Unfortunately they are all quite different, because every > company uses even different things to calculate final result. So if we > use different formula for every company and insurance type we end up > with ~50 formulas and none understands afterwards which is which. Are > there any guidelines to generalize formulas? Ok, let's say we even > somehow make these formulas general enough to use, but where shall the > calculation take place? Postgres stored procs or in perl code/module (i > think this) or even in TT? Constans will be in db. Create modules for each company. This way you'll have each company's functions on her own module. They will be differentiated by namespace. (And you can use references to select the appropriated module, the information on which company that client belongs to might be in a record at the database ;-)) By using references, your only thing to worry will be naming the same things with the same names. You should also pass values by reference. Using modules will also make it possible to change formulae without worring about which of them are common to other companies or which are not common. And, since you're already going to use OO Perl... ;-) > P.S. I hope that in about few months I can write about this project to > success stories ;-) Me too! :-) Be seeing you, -- Godoy. <[EMAIL PROTECTED]> Solutions Developer - Conectiva Inc. - http://en.conectiva.com Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br msg23683/pgp0.pgp Description: PGP signature
Tips & tricks needed :)
Hello, We're going to make a web-site for insurance company (err, more like portal for several companies) and the problem is that ( I think ) it's going to be our biggest and most complex site we've ever done AND we're going to use some new stuff we've never used. So I'd be very happy if you can give me some points what to look at, what are real no-no's and what are go-go's. 1. We're going to switch from mysql to postgresql, because we need transactions, triggers and all other stuff that mysql doesn't support. What could be possible problems going from mysql to postgres, if any? 2. We will use Template-Toolkit and Apache/mod_perl. Problem is that 2 out of 3 people have never used TT or programmed mod_perl and OO Perl. Only I've made sites this way, they've used Embperl til now. How can I make this switch for them a little easier? I know I must spend a lot of time teaching them, but may-be there are some kinda switchover tutorials or something? 3. Authorization. Is cookie based auth most reasonable or are there some other ways too? .htaccess will not do, I think, because all data is in the same directory and authorized access/login is needed only on some parts of site. Which data should I send with cookie? Only some random key which is also stored in dbase and this key is used to find real data from dbase? (I guess I must read again this thread about cookies). 4. How is most reasonable to store(and use too) complex formulas and coefficients? Problem is that there are 4 companies and each of them has different way to calculate same thing eg. insurance for travelling, car insurance etc. Unfortunately they are all quite different, because every company uses even different things to calculate final result. So if we use different formula for every company and insurance type we end up with ~50 formulas and none understands afterwards which is which. Are there any guidelines to generalize formulas? Ok, let's say we even somehow make these formulas general enough to use, but where shall the calculation take place? Postgres stored procs or in perl code/module (i think this) or even in TT? Constans will be in db. 5. Any other things to look out when creating large site and/or running it over SSL and/or using above described configuration? P.S. I hope that in about few months I can write about this project to success stories ;-) Thanks for your attention, Viljo
Re: mixing script in virtual hosts
Hi there, On Wed, 19 Dec 2001, Yuri A. Kabaenkov wrote: > In script.cgi i share this variables like wroten in perl_mod Guide. [snip] > sometimes script.cgi from one virtual host uses module.pm from another. > How can i fix it ? Keep reading the Guide. it's in there. Get the source and "grep -ir sometimes". 73, Ged.