Re: An URL is not Invoking the Anticipated Perl Module [mp2]
Steve, please don't throw more than one question into the same email. It makes it really hard to followup. Please post each question separately. Steve D wrote: For the purpose of clarifying the issue, are you saying there is contention between the two handlers which are declared within the httpd.conf, as it has been setup in this case? That is, since a handler has been declared within by the directory section [/var/www/perl] and another for the location [/CurrDate], the two handlers are contenting against the one other? Therefore, in this case, although has been defined, the default handler is overriding the CurrDate name space[!?] Would someone please clarify. Eh? Did you: s/per-script/perl-script/ and tried again? From studying this further, I noticed I forgot to prefix the /CurrDate> section with a PerlModule directive. Consequently, the following line has been added to the perl.conf file. PerModule: MyApache::CurrDate However, now, with this addition, when starting the Apache the following exception is genereated: httpd failed. The error was: Starting httpd: [Fri Jan 10 12:11:15 2003] [error] Can't locate MyApache/CurrDate.pm in @INC (@INC contains: /var/www/perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at (eval 4) line 3. You'll notice from this message, the path does include '/var/www/perl' and the perl module which is being called is within the '/var/www/perl/MyApache/' directory. (For good measure it was also placed within '/var/www/perl' without a resolution to the run time exception.) There was a bug in older mod_perl versions, and you'd get the "Can't locate module" error when in fact, the module has failed to compile. Please try again with the cvs version. Incidentally, the format of the configuration file which is being used in this case has been adapted from the article "Introducting mod_perl Handlers". I've also been using "Getting Your Feet Wet with mod_perl". These resources can be respectfully found at http://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_ and http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules I found these to be very helpful for a newcomer. Great. This later article was especially beneficial for it connected several fregmented thoughts together [at least in my own learning curve] into good concise working document. In my case, I found it helpful to get a perl script working [as a first measure] and then proceed to the use of a response handler. However, I did run across a problem with how the perl script name space was defined. The first example [in the article "Getting Your Feet Wet"] would not work when I used the syntax "PerlResponseHandler Modperl::Registry" nor "PerlResponseHandler Modperl::Registry::handler". Consequently, I changed the format to "PerlHandler ModPerl::Registry::handler" and then my test script was able to run. It should work with 'PerlResponseHandler Modperl::Registry'. What was the error message (please start a new thread on this one, don't continue here) Consequently, at this stage, a few questions remain. 1) Since, at least in this situation, I had to adapt the handler from being PerlResponseHandler to PerlHandler in order to get the perl scripting to work, does that also mean the same adaptation will be necessary in order to yield a result from a reponse handler for the CurrDate.pm module? 2) Once again, how do I instruct Apache to properly locate the CurrDate.pm file? [Stas, you may have already given me the answer to this latter question but more clarity is still needed.] 3) When I include the provision of the line "PerModule: MyApache::CurrDate" within the perl.conf file, Apache throws an exception and failed to start. s/PerModule:/PerlModule/ I don't know where did you take PerModule: from. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: An URL is not Invoking the Anticipated Perl Module [mp2]
To: Stas Bekman [or anyone else]; For the purpose of clarifying the issue, are you saying there is contention between the two handlers which are declared within the httpd.conf, as it has been setup in this case? That is, since a handler has been declared within by the directory section [/var/www/perl] and another for the location [/CurrDate], the two handlers are contenting against the one other? Therefore, in this case, although has been defined, the default handler is overriding the CurrDate name space[!?] Would someone please clarify. >From studying this further, I noticed I forgot to prefix the section with a PerlModule directive. Consequently, the following line has been added to the perl.conf file. PerModule: MyApache::CurrDate However, now, with this addition, when starting the Apache the following exception is genereated: httpd failed. The error was: Starting httpd: [Fri Jan 10 12:11:15 2003] [error] Can't locate MyApache/CurrDate.pm in @INC (@INC contains: /var/www/perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at (eval 4) line 3. You'll notice from this message, the path does include '/var/www/perl' and the perl module which is being called is within the '/var/www/perl/MyApache/' directory. (For good measure it was also placed within '/var/www/perl' without a resolution to the run time exception.) Incidentally, the format of the configuration file which is being used in this case has been adapted from the article "Introducting mod_perl Handlers". I've also been using "Getting Your Feet Wet with mod_perl". These resources can be respectfully found at http://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_ and http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules I found these to be very helpful for a newcomer. This later article was especially beneficial for it connected several fregmented thoughts together [at least in my own learning curve] into good concise working document. In my case, I found it helpful to get a perl script working [as a first measure] and then proceed to the use of a response handler. However, I did run across a problem with how the perl script name space was defined. The first example [in the article "Getting Your Feet Wet"] would not work when I used the syntax "PerlResponseHandler Modperl::Registry" nor "PerlResponseHandler Modperl::Registry::handler". Consequently, I changed the format to "PerlHandler ModPerl::Registry::handler" and then my test script was able to run. Consequently, at this stage, a few questions remain. 1) Since, at least in this situation, I had to adapt the handler from being PerlResponseHandler to PerlHandler in order to get the perl scripting to work, does that also mean the same adaptation will be necessary in order to yield a result from a reponse handler for the CurrDate.pm module? 2) Once again, how do I instruct Apache to properly locate the CurrDate.pm file? [Stas, you may have already given me the answer to this latter question but more clarity is still needed.] 3) When I include the provision of the line "PerModule: MyApache::CurrDate" within the perl.conf file, Apache throws an exception and failed to start. Does this line need to be included, or something similiar to it, in order to Apache to locate the perl module? [Remember again, in this situation, a startup.pl script has been delcared in order to provide a library to search for perl modules.] The reason I'm asking this question is because the "Introducing mod_perl Handlers" article uses this convention while the "Getting Your Feet Wet with mod_perl" omitts this line. The environment is RH 8.0, Apache 2.0.40, mod_perl 1.99_05-dev, and Perl 5.8.0. [For those who are interested, the original post includes a complete copy of perf.conf and CurrDate.pm.] I have been piecing together various web resources but remain uncertain how to procede. Further help is appreciated. Stas, you have already replied to this once, and to another setup problem for which I was having. I am grateful. Thank you. Steve D wrote: > The problem: Apache is generating "File does not exist" within its > error.log and the message "Object not found" (The requested URL was not > found. Error number 404.) while attempting to call a perl module from a > brower. [...] > > SetHandler per-script > PerlResponseHandler MyApache::CurrDate > s/per-script/perl-script/ SetHandler can't verify at parsing time whether a handler really exists, it
Re: An URL is not Invoking the Anticipated Perl Module
Steve D wrote: The problem: Apache is generating File does not exist within its error.log and the message Object not found (The requested URL was not found. Error number 404.) while attempting to call a perl module from a brower. [...] SetHandler per-script PerlResponseHandler MyApache::CurrDate s/per-script/perl-script/ SetHandler can't verify at parsing time whether a handler really exists, it's really a string. So in your case the default handler was handling that Location. See: http://httpd.apache.org/docs-2.0/mod/core.html#sethandler If you still have questions regarding this (my guess is that it should work just fine) please ask. re: PerlResponseHandler vs PerlHandler, I've updated the docs to always use PerlResponseHandler. PerlHandler is just a backcompat thing to easy httpd.conf porting, so it works. p.s. please remember to mention in the subject [mp2] or at least in the body of the message, when talking about mod_perl 2.0. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
An URL is not Invoking the Anticipated Perl Module
The problem: Apache is generating File does not exist within its error.log and the message Object not found (The requested URL was not found. Error number 404.) while attempting to call a perl module from a brower. Since I am new with mod_perl, and somewhat with familiar perl, I must confess the following problem has baffled me while someone else may quickly see what is being done wrong. Appreciation is expressed in advance to anyone who can tell me what the problem might be or recommends a remedy. Below youll see the path settings found in the various configurations files. I have followed the string of recommendations found in the on-line documentation (from perl.apache.org, etc.) and but have also made minor adjustments relevant to this particular servers configuration. I understand that I am providing some information (not much) which is not relevant to the immediate problem but can assist to give an overview the operating environment as a whole. Here are the details: Given: 1) The file httpd.conf contains the lines: ServerRoot "/etc/httpd" Include conf.d/*.conf (The presence of this include statement is before the invocation of the various LoadModules found in most httpd.conf files. Hence, the perl environment is set early in the Apache initialization process.) 2) and the file /etc/httpd/conf.d/perl.conf contains the lines: LoadModule perl_module modules/mod_perl.so PerlRequire "/var/www/perl/startup.pl" Alias /perl/ /var/www/perl/ SetHandler perl-script PerlHandler ModPerl::Registry::handler PerlOptions +ParseHeaders Options +ExecCGI SetHandler per-script PerlResponseHandler MyApache::CurrDate 3) and the file /etc/httpd/perl/startup.pl contains the line: use lib qw(/var/www/perl); 4) and the file /etc/httpd/perl/MyApache/CurrDate.pm contains the line: package MyApache::CurrDate; then why does /var/httpd/error.log report: [error] [client 192.168.0.100] File does not exist: /var/www/html/CurrDate So, in otherwords, why is does the URL //192.168.0.100/CurrDate 'not' invoke CurrDate.pm from the anticipated directory of /var/httpd/perl/MyApache? Notice the Apache error log indicates that it is trying to access a file under the directory /var/www/html/ rather than /var/www/perl/. This is done even though the perl.conf file includes the directive which should redirect program control to the respective perl module. And, the startup script specs the parent directory where perl modules can be found. Incidentally, the intent of MyApache/CurrDate.pm is to test the existing mod_perl environment for its ability to run handlers. (Better said, it is to test my ability and the present set up. The system is being initialized for the first time on this system. Another version of CurrDate.pm, in the form of a script, was executable from a browser. So, Apache and Perl are likely set up correctly.) Security of the files shouldn't be a problem. The permissions of all respective files have been set to assure they ought to be both readable and executable from a browser. Now when the browser is pointed to a different address, i.e. //192.168.0.100/perl/CurrDate, then partial progress 'maybe' occurring for an Apache exception indicates: [error] 13440: ModPerl::Registry: /var/www/perl/CurrDate.pm not found or unable to stat So it appears, with this later URL address, access to modperl is being accomplished (!?). Granted, yet another problem may exists; namely, the one generated by the ModPerl Registry method. Hence, I may have two problems to resolve rather than just the one. An article (it is entitled Getting Your Feet Wet with mod_perl) declares a handler with the syntax PerlResponseHandler ModPerl::Registry where I have used a different syntax. It was PerlHandler ModPerl::Registry::handler for the former would not work on this system. The later was able to successfully run a script. This change was made to the directory /var/www/perl and not to the location called by /CurrDate name space. This may not have relevance to the problem at hand. I understand Apache directives have a precedence. However, I have sequenced the order of the directories in various ways without a resolution or apparent different effect. Any suggestions? Thank you for your assistance. #!/usr/bin/perl # # FileID: /perl/MyApache/currDate.pm # Edition: 1600.08012003 # Editor: Steve Davis # Install.: Powder Springs, GA # Purpose: To display the current date # package MyApache::CurrDate; use strict; use warnings; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Const -compile => qw(OK); sub handler { my ($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST) = localtime(time); my $CURR_MONTH = ("Jan","Feb","Mar&
Re: url to png/jpeg
Hello Alastair Stuart, Sunday, September 29, 2002, 6:46:49 PM, you wrote: AS> Hi, AS> Somewhere read about converting urls to jpegs on the fly using modperl ?? AS> Preferrably, to png AS> TIA AS> AS> Alastair Stuart AS> Perl Person Look at Apache::ImageMagic. It uses Image::Magic library to manipulate images on the fly. It support over 87 major file formats. It support jpeg and png but you need to obtain corresponding libraries. Anyway visit ImageMagic project at www.imagemagic.org. -- WBR, Mike P. Mikhailov mailto:[EMAIL PROTECTED] Windows may be pretty. And easy. But it has no depth or soul. It's like the one-night stand of operating systems. You feel cheap after using it
url to png/jpeg
Hi, Somewhere read about converting urls to jpegs on the fly using modperl ?? Preferrably, to png TIA Alastair Stuart Perl Person
default-handler ignored if url points to a directory
Hi on win32 perl 561 with last modperl when a location is reset to default-handler and no real file is called but just a directory, modperl does not pass on to default (and to mod_dir for indexing of the directory). url /stylesheets/style.css triggers the default handler properly, but not /stylesheets/ alone for instance. url/telechargements/some.html also , but /telechargements/ does not trigger default and no mod_dir as well can anyone explain why ? thanks pascal here is my conf, there is no virtual host %Location = ( '/' => { 'PerlHandler' => 'MY::Stat', 'Options' => '+ExecCGI', 'SetHandler' => 'perl-script' }, '/telechargements/' => { 'SetHandler' => 'default-handler' }, '/stylesheets/' => { 'SetHandler' => 'default-handler' }, '/icons/' => { 'SetHandler' => 'default-handler' }, ); %Directory = ( 'c:/home/_stat3/htdocs' => { 'AllowOverride' => 'None', 'Order' => 'allow,deny', 'Options' => 'Indexes', 'Allow' => 'from all' }, 'c:/home/_stat3/telechargements' => { 'AllowOverride' => 'None', 'Order' => 'allow,deny', 'Options' => 'Indexes Multiviews', 'Allow' => 'from all' }, 'c:/home/_stat3/icons' => { 'AllowOverride' => 'None', 'Order' => 'allow,deny', 'Options' => 'Indexes Multiviews', 'Allow' => 'from all' } ); #arrays: @Alias = ( [ '/stylesheets/', 'c:/home/_stat3/stylesheets/' ], [ '/icons/', 'c:/home/_stat3/icons/' ], [ '/telechargements/', 'c:/home/_stat3/telechargements/' ] ); #scalars: $DocumentRoot = 'c:/home/_stat3/htdocs'; $Port = 8080; $PerlInitHandler = 'Apache::Reload'; $CustomLog = 'c:/home/_stat3/access.log common'; $ErrorLog = 'c:/home/_stat3/error.log'; Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 /mn) ; tél : 08 92 68 13 50 (0,34/mn)"
Re: Is it possible to change the browser's address/location URL without Redirect?
Simple redirection does not do the same job, because the /step/1/error page is not a simple error page - I would like it to reload the same form in step 1 with the values filled and some message indicating what's to be correct. Looks like the network trip (redirect/refresh) can not be avoid. Then the session mechanism maybe better for the speed since it sends less data. Harry - Original Message - From: "Peter Bi" <[EMAIL PROTECTED]> To: "Harry Zhu" <[EMAIL PROTECTED]>; <> Sent: Friday, August 09, 2002 5:18 PM Subject: Re: Is it possible to change the browser's address/location URL without Redirect? > It is the browser that controls the URL in the "Address" bar. So one has to > make another call to get the URL refreshed. If you are worry about the > speed, you may > > 1) return an error code in case of error > 2) in Apache's httpd.conf, config that specific error to display > /step/1/error > > A simply redirection does the same job. > > Peter > > - Original Message - > From: "Harry Zhu" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, August 09, 2002 11:26 AM > Subject: Is it possible to change the browser's address/location URL without > Redirect? > > > > Looks like my explanation is too long or too bad. > > The simple idea is in page step 1, after the > > > > ... > > > > submitted, I want the browser show something > > http://www.example.com/step/1/error, instead of > > http://www.example.com/step/2, > > if there is a need for user to correct the data submitted. > > > > It might be accomplished by using one of the approaches outlined below, > but > > I was wondering if there's other way that can save the overhead of the > > write/read or resend the data, and the re-process. Probably not much we > can > > do if the URL displayed in the browser's address/location bar depends only > > on the action value of the form submitted, not based on the server > response? > > > > Harry > > > > > > > > - Original Message - > > From: "Harry Zhu" <[EMAIL PROTECTED]> > > To: "mod_perl list" <[EMAIL PROTECTED]> > > Sent: Thursday, August 08, 2002 4:22 PM > > Subject: Can I change the browser's address/location? > > > > > > > Suppose I have a generic content handler to handle requst > > > /step/1, /step/2, ..., /step/n > > > > > > > > > SetHandler perl-script > > > PerlHandler MyHandler > > > > > > > > > > > > #MyHandler.pm > > > package MyHandler; > > > sub handler { > > > my $r=shift; > > > my $step = substr($r->path_info(),1); > > > > > > #do something before fetch the content > > > > > > #fetch content: usually include a form that will assign action > > > /step/($step+1) > > > > > > } > > > > > > So if everything goes well, the user will follow through from step 1, > step > > > 2, until fnish. > > > Now if in the "#do something ..." part, something is wrong, it will > > usually > > > require user go back to the same step, for example, to fill the form > > again. > > > The way my old cgi script does is just generate the form with prefilled > > > value plus some error message indicate what's wrong. It works ok but the > > > browser location will show /step/($step+1) while it actually is > > /step/$step. > > > Now that I am working it on mod-perl I thought I should be able to do > > > something about it. I briefly browsed the 2 mod-perl books (eagle, > > > cookbook), and could not found a simple solution yet (or I missed it?). > I > > > was think using one of the folowing might work:z > > > 1) save the request data in a temp file and redirect or http-refresh to > > > /step/$step?$session_id or /step/$step/error?$session_id > > > Remember the content is dynamic and depend on the input form data, so > > simple > > > redirect may not work. > > > Looks like Apache will not post the form data when redirect with > Location? > > > > > > 2) print a short form with hidden data and assign > action=/step/$step/error > > > then submit right away (onload=form.submit()?) > > > > > > Does anybody have a simple solution, e.g. without redirect? Is it > possible > > > to change the URI showing in the browser's address/location bar? > > > > > > I would appreciated if somebody can pointer me to the right direction. > > > > > > Harry > > > > > > > > > > >
Re: Is it possible to change the browser's address/location URL without Redirect?
It is the browser that controls the URL in the "Address" bar. So one has to make another call to get the URL refreshed. If you are worry about the speed, you may 1) return an error code in case of error 2) in Apache's httpd.conf, config that specific error to display /step/1/error A simply redirection does the same job. Peter - Original Message - From: "Harry Zhu" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 11:26 AM Subject: Is it possible to change the browser's address/location URL without Redirect? > Looks like my explanation is too long or too bad. > The simple idea is in page step 1, after the > > ... > > submitted, I want the browser show something > http://www.example.com/step/1/error, instead of > http://www.example.com/step/2, > if there is a need for user to correct the data submitted. > > It might be accomplished by using one of the approaches outlined below, but > I was wondering if there's other way that can save the overhead of the > write/read or resend the data, and the re-process. Probably not much we can > do if the URL displayed in the browser's address/location bar depends only > on the action value of the form submitted, not based on the server response? > > Harry > > > > - Original Message - > From: "Harry Zhu" <[EMAIL PROTECTED]> > To: "mod_perl list" <[EMAIL PROTECTED]> > Sent: Thursday, August 08, 2002 4:22 PM > Subject: Can I change the browser's address/location? > > > > Suppose I have a generic content handler to handle requst > > /step/1, /step/2, ..., /step/n > > > > > > SetHandler perl-script > > PerlHandler MyHandler > > > > > > > > #MyHandler.pm > > package MyHandler; > > sub handler { > > my $r=shift; > > my $step = substr($r->path_info(),1); > > > > #do something before fetch the content > > > > #fetch content: usually include a form that will assign action > > /step/($step+1) > > > > } > > > > So if everything goes well, the user will follow through from step 1, step > > 2, until fnish. > > Now if in the "#do something ..." part, something is wrong, it will > usually > > require user go back to the same step, for example, to fill the form > again. > > The way my old cgi script does is just generate the form with prefilled > > value plus some error message indicate what's wrong. It works ok but the > > browser location will show /step/($step+1) while it actually is > /step/$step. > > Now that I am working it on mod-perl I thought I should be able to do > > something about it. I briefly browsed the 2 mod-perl books (eagle, > > cookbook), and could not found a simple solution yet (or I missed it?). I > > was think using one of the folowing might work:z > > 1) save the request data in a temp file and redirect or http-refresh to > > /step/$step?$session_id or /step/$step/error?$session_id > > Remember the content is dynamic and depend on the input form data, so > simple > > redirect may not work. > > Looks like Apache will not post the form data when redirect with Location? > > > > 2) print a short form with hidden data and assign action=/step/$step/error > > then submit right away (onload=form.submit()?) > > > > Does anybody have a simple solution, e.g. without redirect? Is it possible > > to change the URI showing in the browser's address/location bar? > > > > I would appreciated if somebody can pointer me to the right direction. > > > > Harry > > > > > >
Re: Is it possible to change the browser's address/location URL without Redirect?
The question is not about how to make links relative to root. The purpose is to show correctly the user what the step he is at in the process. If no mistake, he would be taken to step 2, but since the data has error and he needs correct it, so I would like the browser indicating he is still in the step 1. Although it's not that important an issue. Did you mean javascript can change the URL text displayed in the (some version of) browser's address/location bar? I know it is used to display text in status. Noemally the use of Javascript to validate the data can almost eliminate the needing of such network trip, but not always. Thanks, Harry - Original Message - From: "Andrew Ho" <[EMAIL PROTECTED]> To: "Harry Zhu" <[EMAIL PROTECTED]> Cc: "mod_perl List" <> Sent: Friday, August 09, 2002 4:40 PM Subject: Re: Is it possible to change the browser's address/location URL without Redirect? > Hello, > > HZ>I was wondering if that network trip can be avoided. > > The answer is no. > > You might be able to use JavaScript to do it on certain browsers, but I'm > reasonably sure you can't do it on recent IE and Netscape browsers. > > Why do you want to do this? You could use or similar if your > goal is just to make links are relative to a certain root. > > Humbly, > > Andrew > > -- > Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] > Engineer [EMAIL PROTECTED] Voice 650-930-9062 > Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 > -- >
Re: Is it possible to change the browser's address/location URL without Redirect?
Hello, HZ>I was wondering if that network trip can be avoided. The answer is no. You might be able to use JavaScript to do it on certain browsers, but I'm reasonably sure you can't do it on recent IE and Netscape browsers. Why do you want to do this? You could use or similar if your goal is just to make links are relative to a certain root. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Is it possible to change the browser's address/location URL without Redirect?
That what's the approach outlined in 1). I was wondering if that network trip can be avoided. Thanks, Harry - Original Message - From: "French, Shawn" <[EMAIL PROTECTED]> To: "'Harry Zhu'" <[EMAIL PROTECTED]>; <> Sent: Friday, August 09, 2002 11:49 AM Subject: RE: Is it possible to change the browser's address/location URL without Redirect? > One option: > > If there's an erro in form 2, > Save the user's form data in some session variables > Then use a mailto:[EMAIL PROTECTED]] > > Sent: August 9, 2002 2:26 PM > > To: [EMAIL PROTECTED] > > Subject: Is it possible to change the browser's address/location URL > > without Redirect? > > > > > > Looks like my explanation is too long or too bad. > > The simple idea is in page step 1, after the > > > > ... > > > > submitted, I want the browser show something > > http://www.example.com/step/1/error, instead of > > http://www.example.com/step/2, > > if there is a need for user to correct the data submitted. > > > > It might be accomplished by using one of the approaches > > outlined below, but > > I was wondering if there's other way that can save the overhead of the > > write/read or resend the data, and the re-process. Probably > > not much we can > > do if the URL displayed in the browser's address/location bar > > depends only > > on the action value of the form submitted, not based on the > > server response? > > > > Harry > > > > > > > > - Original Message - > > From: "Harry Zhu" <[EMAIL PROTECTED]> > > To: "mod_perl list" <[EMAIL PROTECTED]> > > Sent: Thursday, August 08, 2002 4:22 PM > > Subject: Can I change the browser's address/location? > > > > > > > Suppose I have a generic content handler to handle requst > > > /step/1, /step/2, ..., /step/n > > > > > > > > > SetHandler perl-script > > > PerlHandler MyHandler > > > > > > > > > > > > #MyHandler.pm > > > package MyHandler; > > > sub handler { > > > my $r=shift; > > > my $step = substr($r->path_info(),1); > > > > > > #do something before fetch the content > > > > > > #fetch content: usually include a form that will assign action > > > /step/($step+1) > > > > > > } > > > > > > So if everything goes well, the user will follow through > > from step 1, step > > > 2, until fnish. > > > Now if in the "#do something ..." part, something is wrong, it will > > usually > > > require user go back to the same step, for example, to fill the form > > again. > > > The way my old cgi script does is just generate the form > > with prefilled > > > value plus some error message indicate what's wrong. It > > works ok but the > > > browser location will show /step/($step+1) while it actually is > > /step/$step. > > > Now that I am working it on mod-perl I thought I should be > > able to do > > > something about it. I briefly browsed the 2 mod-perl books (eagle, > > > cookbook), and could not found a simple solution yet (or I > > missed it?). I > > > was think using one of the folowing might work:z > > > 1) save the request data in a temp file and redirect or > > http-refresh to > > > /step/$step?$session_id or /step/$step/error?$session_id > > > Remember the content is dynamic and depend on the input > > form data, so > > simple > > > redirect may not work. > > > Looks like Apache will not post the form data when redirect > > with Location? > > > > > > 2) print a short form with hidden data and assign > > action=/step/$step/error > > > then submit right away (onload=form.submit()?) > > > > > > Does anybody have a simple solution, e.g. without redirect? > > Is it possible > > > to change the URI showing in the browser's address/location bar? > > > > > > I would appreciated if somebody can pointer me to the right > > direction. > > > > > > Harry > > > > > > > > > > >
RE: Is it possible to change the browser's address/location URL without Redirect?
One option: If there's an erro in form 2, Save the user's form data in some session variables Then use a mailto:[EMAIL PROTECTED]] > Sent: August 9, 2002 2:26 PM > To: [EMAIL PROTECTED] > Subject: Is it possible to change the browser's address/location URL > without Redirect? > > > Looks like my explanation is too long or too bad. > The simple idea is in page step 1, after the > > ... > > submitted, I want the browser show something > http://www.example.com/step/1/error, instead of > http://www.example.com/step/2, > if there is a need for user to correct the data submitted. > > It might be accomplished by using one of the approaches > outlined below, but > I was wondering if there's other way that can save the overhead of the > write/read or resend the data, and the re-process. Probably > not much we can > do if the URL displayed in the browser's address/location bar > depends only > on the action value of the form submitted, not based on the > server response? > > Harry > > > > - Original Message - > From: "Harry Zhu" <[EMAIL PROTECTED]> > To: "mod_perl list" <[EMAIL PROTECTED]> > Sent: Thursday, August 08, 2002 4:22 PM > Subject: Can I change the browser's address/location? > > > > Suppose I have a generic content handler to handle requst > > /step/1, /step/2, ..., /step/n > > > > > > SetHandler perl-script > > PerlHandler MyHandler > > > > > > > > #MyHandler.pm > > package MyHandler; > > sub handler { > > my $r=shift; > > my $step = substr($r->path_info(),1); > > > > #do something before fetch the content > > > > #fetch content: usually include a form that will assign action > > /step/($step+1) > > > > } > > > > So if everything goes well, the user will follow through > from step 1, step > > 2, until fnish. > > Now if in the "#do something ..." part, something is wrong, it will > usually > > require user go back to the same step, for example, to fill the form > again. > > The way my old cgi script does is just generate the form > with prefilled > > value plus some error message indicate what's wrong. It > works ok but the > > browser location will show /step/($step+1) while it actually is > /step/$step. > > Now that I am working it on mod-perl I thought I should be > able to do > > something about it. I briefly browsed the 2 mod-perl books (eagle, > > cookbook), and could not found a simple solution yet (or I > missed it?). I > > was think using one of the folowing might work:z > > 1) save the request data in a temp file and redirect or > http-refresh to > > /step/$step?$session_id or /step/$step/error?$session_id > > Remember the content is dynamic and depend on the input > form data, so > simple > > redirect may not work. > > Looks like Apache will not post the form data when redirect > with Location? > > > > 2) print a short form with hidden data and assign > action=/step/$step/error > > then submit right away (onload=form.submit()?) > > > > Does anybody have a simple solution, e.g. without redirect? > Is it possible > > to change the URI showing in the browser's address/location bar? > > > > I would appreciated if somebody can pointer me to the right > direction. > > > > Harry > > > > > >
Is it possible to change the browser's address/location URL without Redirect?
Looks like my explanation is too long or too bad. The simple idea is in page step 1, after the ... submitted, I want the browser show something http://www.example.com/step/1/error, instead of http://www.example.com/step/2, if there is a need for user to correct the data submitted. It might be accomplished by using one of the approaches outlined below, but I was wondering if there's other way that can save the overhead of the write/read or resend the data, and the re-process. Probably not much we can do if the URL displayed in the browser's address/location bar depends only on the action value of the form submitted, not based on the server response? Harry - Original Message - From: "Harry Zhu" <[EMAIL PROTECTED]> To: "mod_perl list" <[EMAIL PROTECTED]> Sent: Thursday, August 08, 2002 4:22 PM Subject: Can I change the browser's address/location? > Suppose I have a generic content handler to handle requst > /step/1, /step/2, ..., /step/n > > > SetHandler perl-script > PerlHandler MyHandler > > > > #MyHandler.pm > package MyHandler; > sub handler { > my $r=shift; > my $step = substr($r->path_info(),1); > > #do something before fetch the content > > #fetch content: usually include a form that will assign action > /step/($step+1) > > } > > So if everything goes well, the user will follow through from step 1, step > 2, until fnish. > Now if in the "#do something ..." part, something is wrong, it will usually > require user go back to the same step, for example, to fill the form again. > The way my old cgi script does is just generate the form with prefilled > value plus some error message indicate what's wrong. It works ok but the > browser location will show /step/($step+1) while it actually is /step/$step. > Now that I am working it on mod-perl I thought I should be able to do > something about it. I briefly browsed the 2 mod-perl books (eagle, > cookbook), and could not found a simple solution yet (or I missed it?). I > was think using one of the folowing might work:z > 1) save the request data in a temp file and redirect or http-refresh to > /step/$step?$session_id or /step/$step/error?$session_id > Remember the content is dynamic and depend on the input form data, so simple > redirect may not work. > Looks like Apache will not post the form data when redirect with Location? > > 2) print a short form with hidden data and assign action=/step/$step/error > then submit right away (onload=form.submit()?) > > Does anybody have a simple solution, e.g. without redirect? Is it possible > to change the URI showing in the browser's address/location bar? > > I would appreciated if somebody can pointer me to the right direction. > > Harry > >
Re: URL
On Thu, 13 Jun 2002, Rasoul Hajikhani wrote: > Is there a way to read the actual URL typed in the location box of the > browser? What's actually typed into the location bar on a browser isn't sent in the HTTP headers, and thus mod_perl cannot access it. For example, you may be able to type in your browser "cnn" but your browser will munge that to be a request for "http://www.cnn.com/"; and that's what it will send in the HTTP headers not the orignal "cnn" If you're happy getting that level of detail then there are many ways to do it which are covered in the guide. For a certain platform (browser) you *may* be able to access the urlbar though a plugin, though javascript or though using a keyword system. Methods for doing this however are offtopic for this list and I wish you luck in finding solutions. Mark. -- s'' Mark Fowler London.pm Bath.pm http://www.twoshortplanks.com/ [EMAIL PROTECTED] ';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/ +/ ){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}
Re: URL
Hi ( 02.06.13 13:34 -0700 ) Rasoul Hajikhani: > Is there a way to read the actual URL typed in the location box of the > browser? javascript [ducks]. I think there's an Apache::URI object where you can get this stuff in a handler. -- \js A study of the science of technology defines what is possible; a study of the economics of technology establishes which of the possibilities is practical and useful. -- Montgomery Phister
URL
Is there a way to read the actual URL typed in the location box of the browser? Thanks in advance. -r
Re: Installing mod_perl 1.26 - URI::URL error
On Tue, 23 Apr 2002, Silvio Wanka wrote: > Stas Bekman wrote: > > > > Einar Roheim wrote: > > > At 17:00 4/23/2002 +0800, you wrote: > > > > > >> Einar Roheim wrote: > > >> > > >>> Hi everyone, > > >>> > > >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I > > >>> do the "make test" I'm getting this in the end before it aborts: > > >> > > >> > > >> You have a mismatching version of LWP and URI packages, update both > > >> and the problem should disappear. > > > > > > > > > I did a "force install" on both of them (since I had the last version), > > > but I still have the same problem. > > > > > > How can this mismatch happen? > > > > Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to > > libwww-perl 5.64 and URI 1.1 the problem has disappeared. > > Maybe with URI 1.1 but not with the current 1.11 Perhaps you have two different URI modules on your system? Is your mod_perl installation using the same library directories (@INC) as you used when you did the "force install"? This can happen if you update your system perl after installing mod_perl. Andrew McNaughton
Re: Installing mod_perl 1.26 - URI::URL error
Silvio Wanka wrote: BTW, have you tried the latest mod_perl CVS? I think your problem has been solved long time ago. Sometimes I forget that others don't use the cvs version all the time :) From Changes: =item 1.26_01-dev ... require URI::URL to work with newer libwww-perl ... > Stas Bekman wrote: > >>Einar Roheim wrote: >> >>>At 17:00 4/23/2002 +0800, you wrote: >>> >>> >>>>Einar Roheim wrote: >>>> >>>> >>>>>Hi everyone, >>>>> >>>>>I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I >>>>>do the "make test" I'm getting this in the end before it aborts: >>>> >>>> >>>>You have a mismatching version of LWP and URI packages, update both >>>>and the problem should disappear. >>> >>> >>>I did a "force install" on both of them (since I had the last version), >>>but I still have the same problem. >>> >>> >>>As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: >>> >>>mod_perl-x.xx/t/internal/hooks.t >>>mod_perl-x.xx/lib/Apache/test.pm >>>mod_perl-x.xx/blib/Apache/test.pm >>> >>>But I still have the mismatch that you talked about. Don't I? >>> >>>How can this mismatch happen? >> >>Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to >>libwww-perl 5.64 and URI 1.1 the problem has disappeared. > > > Maybe with URI 1.1 but not with the current 1.11 > > >>[...] >>-- >>Stas BekmanJAm_pH --> Just Another mod_perl Hacker >>http://stason.org/ mod_perl Guide ---> http://perl.apache.org >>mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com >>http://modperlbook.org http://apache.org http://ticketmaster.com > > > The patch at the end solves the problems, the tests are running > but you get error messages in one of the URI modules, that a undefined > value is used. > > Regards, Silvio > > --- lib/Apache/test.pm~ Wed Feb 14 23:57:08 2001 > +++ lib/Apache/test.pmFri Feb 22 18:57:13 2002 > @@ -5,6 +5,12 @@ > use Exporter (); > use Config; > use FileHandle (); > + > +use URI::URL (); > +sub URI::WithBase::can { > +return UNIVERSAL::can(@_) || UNIVERSAL::can($_[0]->[0], $_[1]); > +} > + > *import = \&Exporter::import; > > @EXPORT = qw(test fetch simple_fetch have_module skip_test > --- t/internal/hooks.t~ Thu Jan 21 00:16:38 1999 > +++ t/internal/hooks.tFri Feb 22 18:46:53 2002 > @@ -7,6 +7,7 @@ > use ExtUtils::testlib; > BEGIN { require "net/config.pl"; } > require LWP::UserAgent; > +require URI::URL; > > #first one queries httpd for enabled hooks, > #generating a hook::handler() for each and writing t/docs/.htaccess > @@ -29,7 +30,7 @@ > foreach $loc (@urls) { > $url = new URI::URL("http://$net::httpserver$loc";); > > -$request = new HTTP::Request('GET', $url); > +$request = new HTTP::Request('GET', "$url"); > > print "GET $url\n\n"; -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Installing mod_perl 1.26 - URI::URL error
Stas Bekman wrote: > > Einar Roheim wrote: > > At 17:00 4/23/2002 +0800, you wrote: > > > >> Einar Roheim wrote: > >> > >>> Hi everyone, > >>> > >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I > >>> do the "make test" I'm getting this in the end before it aborts: > >> > >> > >> You have a mismatching version of LWP and URI packages, update both > >> and the problem should disappear. > > > > > > I did a "force install" on both of them (since I had the last version), > > but I still have the same problem. > > > > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > > > mod_perl-x.xx/t/internal/hooks.t > > mod_perl-x.xx/lib/Apache/test.pm > > mod_perl-x.xx/blib/Apache/test.pm > > > > But I still have the mismatch that you talked about. Don't I? > > > > How can this mismatch happen? > > Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to > libwww-perl 5.64 and URI 1.1 the problem has disappeared. Maybe with URI 1.1 but not with the current 1.11 > [...] > -- > Stas BekmanJAm_pH --> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com The patch at the end solves the problems, the tests are running but you get error messages in one of the URI modules, that a undefined value is used. Regards, Silvio --- lib/Apache/test.pm~ Wed Feb 14 23:57:08 2001 +++ lib/Apache/test.pm Fri Feb 22 18:57:13 2002 @@ -5,6 +5,12 @@ use Exporter (); use Config; use FileHandle (); + +use URI::URL (); +sub URI::WithBase::can { +return UNIVERSAL::can(@_) || UNIVERSAL::can($_[0]->[0], $_[1]); +} + *import = \&Exporter::import; @EXPORT = qw(test fetch simple_fetch have_module skip_test --- t/internal/hooks.t~ Thu Jan 21 00:16:38 1999 +++ t/internal/hooks.t Fri Feb 22 18:46:53 2002 @@ -7,6 +7,7 @@ use ExtUtils::testlib; BEGIN { require "net/config.pl"; } require LWP::UserAgent; +require URI::URL; #first one queries httpd for enabled hooks, #generating a hook::handler() for each and writing t/docs/.htaccess @@ -29,7 +30,7 @@ foreach $loc (@urls) { $url = new URI::URL("http://$net::httpserver$loc";); -$request = new HTTP::Request('GET', $url); +$request = new HTTP::Request('GET', "$url"); print "GET $url\n\n";
Re: Installing mod_perl 1.26 - URI::URL error
I had the similar problem on Solaris about a week ago. I just added manually two 'use URI::URL' to the appropriate test sources (sorry, do not remember exactly the module names). I'm fine since then. Best regards, Slava - Original Message - From: "Einar Roheim" <[EMAIL PROTECTED]> To: "Stas Bekman" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 5:30 AM Subject: Re: Installing mod_perl 1.26 - URI::URL error > At 17:00 4/23/2002 +0800, you wrote: > >Einar Roheim wrote: > >>Hi everyone, > >> > >>I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do > >>the "make test" I'm getting this in the end before it aborts: > > > >You have a mismatching version of LWP and URI packages, update both and > >the problem should disappear. > > I did a "force install" on both of them (since I had the last version), but > I still have the same problem. > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > mod_perl-x.xx/t/internal/hooks.t > mod_perl-x.xx/lib/Apache/test.pm > mod_perl-x.xx/blib/Apache/test.pm > > But I still have the mismatch that you talked about. Don't I? > > How can this mismatch happen? > > > > >>make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' > >>cp t/conf/mod_perl_srm.conf t/conf/srm.conf > >>../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & > >>httpd listening on port 8529 > >>will write error_log to: t/logs/error_log > >>letting apache warm up...\c > >>done > >>/usr/local/bin/perl t/TEST 0 > >>Can't locate object method "new" via package "URI::URL" (perhaps you > >>forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. > >>make: *** [run_tests] Error 255 > >> > >>The strange thing is that I installed it on my test-server that has the > >>same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it > >>worked like a dream. The only difference is the hardware. The test-server > >>is a PIII with EIDE-disks and the big server (with the problem) has dual > >>PIII with SCSI-disks and more memory. > > > >probably not exactly the same sw. > > > >>The server is registered in the DNS. > >> > >>Thanks in advance ... > >>Einar > > > > > > > >-- > > > > > >__ > >Stas BekmanJAm_pH --> Just Another mod_perl Hacker > >http://stason.org/ mod_perl Guide ---> http://perl.apache.org > >mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > >http://modperlbook.org http://apache.org http://ticketmaster.com > > > >
Re: Installing mod_perl 1.26 - URI::URL error
Einar Roheim wrote: > At 17:00 4/23/2002 +0800, you wrote: > >> Einar Roheim wrote: >> >>> Hi everyone, >>> >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I >>> do the "make test" I'm getting this in the end before it aborts: >> >> >> You have a mismatching version of LWP and URI packages, update both >> and the problem should disappear. > > > I did a "force install" on both of them (since I had the last version), > but I still have the same problem. > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > mod_perl-x.xx/t/internal/hooks.t > mod_perl-x.xx/lib/Apache/test.pm > mod_perl-x.xx/blib/Apache/test.pm > > But I still have the mismatch that you talked about. Don't I? > > How can this mismatch happen? Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to libwww-perl 5.64 and URI 1.1 the problem has disappeared. >>> make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' >>> cp t/conf/mod_perl_srm.conf t/conf/srm.conf >>> ../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & >>> httpd listening on port 8529 >>> will write error_log to: t/logs/error_log >>> letting apache warm up...\c >>> done >>> /usr/local/bin/perl t/TEST 0 >>> Can't locate object method "new" via package "URI::URL" (perhaps you >>> forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. >>> make: *** [run_tests] Error 255 >>> >>> The strange thing is that I installed it on my test-server that has >>> the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl >>> 1.24) and it worked like a dream. The only difference is the >>> hardware. The test-server is a PIII with EIDE-disks and the big >>> server (with the problem) has dual PIII with SCSI-disks and more memory. >> >> >> probably not exactly the same sw. -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Installing mod_perl 1.26 - URI::URL error
At 17:00 4/23/2002 +0800, you wrote: >Einar Roheim wrote: >>Hi everyone, >> >>I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do >>the "make test" I'm getting this in the end before it aborts: > >You have a mismatching version of LWP and URI packages, update both and >the problem should disappear. I did a "force install" on both of them (since I had the last version), but I still have the same problem. As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: mod_perl-x.xx/t/internal/hooks.t mod_perl-x.xx/lib/Apache/test.pm mod_perl-x.xx/blib/Apache/test.pm But I still have the mismatch that you talked about. Don't I? How can this mismatch happen? >>make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' >>cp t/conf/mod_perl_srm.conf t/conf/srm.conf >>../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & >>httpd listening on port 8529 >>will write error_log to: t/logs/error_log >>letting apache warm up...\c >>done >>/usr/local/bin/perl t/TEST 0 >>Can't locate object method "new" via package "URI::URL" (perhaps you >>forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. >>make: *** [run_tests] Error 255 >> >>The strange thing is that I installed it on my test-server that has the >>same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it >>worked like a dream. The only difference is the hardware. The test-server >>is a PIII with EIDE-disks and the big server (with the problem) has dual >>PIII with SCSI-disks and more memory. > >probably not exactly the same sw. > >>The server is registered in the DNS. >> >>Thanks in advance ... >>Einar > > > >-- > > >__ >Stas BekmanJAm_pH --> Just Another mod_perl Hacker >http://stason.org/ mod_perl Guide ---> http://perl.apache.org >mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com >http://modperlbook.org http://apache.org http://ticketmaster.com >
Re: Installing mod_perl 1.26 - URI::URL error
Einar Roheim wrote: > Hi everyone, > > > I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do > the "make test" I'm getting this in the end before it aborts: You have a mismatching version of LWP and URI packages, update both and the problem should disappear. > > make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' > cp t/conf/mod_perl_srm.conf t/conf/srm.conf > ../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & > httpd listening on port 8529 > will write error_log to: t/logs/error_log > letting apache warm up...\c > done > /usr/local/bin/perl t/TEST 0 > Can't locate object method "new" via package "URI::URL" (perhaps you > forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. > make: *** [run_tests] Error 255 > > The strange thing is that I installed it on my test-server that has the > same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and > it worked like a dream. The only difference is the hardware. The > test-server is a PIII with EIDE-disks and the big server (with the > problem) has dual PIII with SCSI-disks and more memory. probably not exactly the same sw. > The server is registered in the DNS. > > > Thanks in advance ... > > Einar -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: Installing mod_perl 1.26 - URI::URL error
Hi Einar, I just did some digging in my mailbox and found the following: (btw - mod_perl 1.26 has been around for some time, and it looks like you're using it - but not in your spec. list) // Nicolai --- OLD MESSAGE --- Hi, For what it's worth it, I always have to add "use URI::URL;" to the files: mod_perl-x.xx/t/internal/hooks.t mod_perl-x.xx/lib/Apache/test.pm mod_perl-x.xx/blib/Apache/test.pm then all tests work - apart from the ones skipped on my OS - as usual ;) Hope this helps // Nicolai - Original Message - From: "terry mcintyre" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 03, 2002 1:49 AM Subject: install test fails > > Redhat Linux 7.2 > Apache 1.3.24 > Perl 5.6.1 > mod-perl-1.26 > > make test fails with result: > > /usr/bin/perl t/TEST 0 > Can't locate object method "new" via package > "URI::URL" (perhaps you forgot to load "URI::URL"?) > at > ./blib/lib/Apache/test.pm line 252. > make: *** [run_tests] Error 255 > > typescript with complete output follows: > > Any clues greatly appreciated. > > Thanks! > > > __ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ -Original Message----- From: Einar Roheim [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 11:42 AM To: [EMAIL PROTECTED] Subject: Installing mod_perl 1.26 - URI::URL error Hi everyone, I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do the "make test" I'm getting this in the end before it aborts: make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...\c done /usr/local/bin/perl t/TEST 0 Can't locate object method "new" via package "URI::URL" (perhaps you forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. make: *** [run_tests] Error 255 The strange thing is that I installed it on my test-server that has the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it worked like a dream. The only difference is the hardware. The test-server is a PIII with EIDE-disks and the big server (with the problem) has dual PIII with SCSI-disks and more memory. The server is registered in the DNS. Thanks in advance ... Einar
Installing mod_perl 1.26 - URI::URL error
Hi everyone, I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do the "make test" I'm getting this in the end before it aborts: make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.24/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...\c done /usr/local/bin/perl t/TEST 0 Can't locate object method "new" via package "URI::URL" (perhaps you forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. make: *** [run_tests] Error 255 The strange thing is that I installed it on my test-server that has the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it worked like a dream. The only difference is the hardware. The test-server is a PIII with EIDE-disks and the big server (with the problem) has dual PIII with SCSI-disks and more memory. The server is registered in the DNS. Thanks in advance ... Einar
Apache::URI -> URI::URL?
Hey all. I seem to be coming onto the modperl scene a little late, and it seems one of the classes mentioned in the Eagle book no longer exists. I am trying to get the full URI (http(s):///) from the Apache::URI class. Of course the Eagle mentions that URI::URL is schedulted to be replaced by URI.pm, but I'm not sure what the deal is there. Anyone wanna toss me a clue? I'm running FreeBSD and I see no ports to that effect, so I just want to know if a port should be written. TIA Lou -- Louis LeBlanc [EMAIL PROTECTED] Fully Funded Hobbyist, KeySlapper Extrordinaire :) http://www.keyslapper.org ԿԬ Vulcans never bluff. -- Spock, "The Doomsday Machine", stardate 4202.1 msg22330/pgp0.pgp Description: PGP signature
RE: http or https in URL?
> From: Stas Bekman *EXTERN* [mailto:[EMAIL PROTECTED]] > > Reif Peter wrote: > > > In a mod_perl handler I want to construct the original URL > of the request. I > > can construct it with r->get_server_name, > r->get_server_port, r->uri and > > $r->parsed_uri->query. > > > > But how do I get the protocol, http or https. Is there a > way to find out > > whether SSLEngine On is set? > > > > > Note that it's also possible to check the scheme: > >print "SSL" if Apache::URI->parse($r)->scheme =~ m/^https/; > scheme is good! Why is $r->parsed_uri not the same as Apache::URI->parse($r) ? Another question: If my server listens to 2 adresses as with I get always 443 from s->port. The REAL port I get from the Host header. Is there another way? Peter
RE: http or https in URL?
> From: Richard L. Goerwitz III *EXTERN* [mailto:[EMAIL PROTECTED]] > > Reif Peter wrote: > > > Yes, I can set it with "PerlSetVar protocol https", but is > there a simpler > > way? > > If you're in a response handler, you could test for the HTTPS > environment variable. Otherwise you're stuck with a kludge like > what you offer above. Or with a subrequest. > $ENV{HTTPS} eq "on", thats it! Thanx
Re: http or https in URL?
*sigh* Didn't we have this argument out about 2 months ago??? There's an old thread on this and most of what's being said here isn't adding anything, but rather repeating things... The conclusions were basically that the best way would be to check $ENV{HTTPS}, but I seem to recall someone pointing out that this only happens late in the request... The port check is unreliable as that is only standard ports. Possibly, there might be some dvantage into seeing if mod_ssl, or another module, can be configured to set $ENV{HTTPS} a bit earlier in the request if this is really a problem. Issac 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 - Original Message - From: "Reif Peter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 06, 2001 17:37 Subject: http or https in URL? > In a mod_perl handler I want to construct the original URL of the request. I > can construct it with r->get_server_name, r->get_server_port, r->uri and > $r->parsed_uri->query. > > But how do I get the protocol, http or https. Is there a way to find out > whether SSLEngine On is set? > > Yes, I can set it with "PerlSetVar protocol https", but is there a simpler > way? > > Thanks in advance, > Peter > -- > /"\ ASCII Ribbon Campaign > \ / > X Against HTML > / \ in e-mail & news >
RE: Antwort: http or https in URL?
> > sub savelink ($modul: string min 4 max 4, $page: string > default index.html) { > my $r = Apache->request; > my $session_id = $r->pnotes('sessionid'); > > my $uri = Apache::URI->parse($r); > my $hostinfo = $uri->hostinfo; > my $scheme = $uri->scheme; > > my $url = $scheme . '://' . > $hostinfo . '/'. > $session_id . '/' . > $GAD::SessionMgr::DIR_PREFIX . '/' . > $modul . '/' . > $page; > > return $url; > } egads. use the $uri object methods to set all the parts then call $uri->unparse to get the URI back. my $uri = Apache::URI->parse($r); $uri->path(join "/", $session_id, $GAD::SessionMgr::DIR_PREFIX, $module, $page); return $uri->unparse; --Geoff
RE: http or https in URL?
Not the best way. There is nothing to stop me from running straight http on port 443: http://yoursite.com:443 or https on port 80: https://yoursite.com:80 If you're using mod_ssl to do the https stuff, it will set the HTTPS environment variable to 'on' when using https. -Original Message- From: Rob Nagler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 06, 2001 10:46 AM To: [EMAIL PROTECTED] Subject: Re: http or https in URL? > But how do I get the protocol, http or https. You can check the port on $c->local_addr. 443 is https. Rob
Re: http or https in URL?
This will not work all the time for all configurations. 80 is the default port for http and 443 is the default port for https. However, just as you may choose to run your http server on any port you wish, you may also choose to run your https server on any port you wish. > From: Rob Nagler <[EMAIL PROTECTED]> > Organization: bivio Software Artisans, Inc. <http://www.bivio.net> > Date: Tue, 6 Nov 2001 08:45:45 -0700 > To: [EMAIL PROTECTED] > Subject: Re: http or https in URL? > >> But how do I get the protocol, http or https. > > You can check the port on $c->local_addr. 443 is https. > > Rob > > > > >
Antwort: http or https in URL?
Hi, we're using the following code: sub savelink ($modul: string min 4 max 4, $page: string default index.html) { my $r = Apache->request; my $session_id = $r->pnotes('sessionid'); my $uri = Apache::URI->parse($r); my $hostinfo = $uri->hostinfo; my $scheme = $uri->scheme; my $url = $scheme . '://' . $hostinfo . '/'. $session_id . '/' . $GAD::SessionMgr::DIR_PREFIX . '/' . $modul . '/' . $page; return $url; } You may want to use (undef, $rest) = split '/', $r->uri, 2; $rest .= '?' . $r->args if $r->args; instead of $modul and $page. Michael Datum: 06.11.2001 16:43 An:[EMAIL PROTECTED] Betreff: http or https in URL? Nachrichtentext: In a mod_perl handler I want to construct the original URL of the request. I can construct it with r->get_server_name, r->get_server_port, r->uri and $r->parsed_uri->query. But how do I get the protocol, http or https. Is there a way to find out whether SSLEngine On is set? Yes, I can set it with "PerlSetVar protocol https", but is there a simpler way? Thanks in advance, Peter -- /"\ ASCII Ribbon Campaign \ / X Against HTML / \ in e-mail & news
Re: http or https in URL?
> But how do I get the protocol, http or https. You can check the port on $c->local_addr. 443 is https. Rob
Re: http or https in URL?
Reif Peter wrote: > In a mod_perl handler I want to construct the original URL of the request. I > can construct it with r->get_server_name, r->get_server_port, r->uri and > $r->parsed_uri->query. > > But how do I get the protocol, http or https. Is there a way to find out > whether SSLEngine On is set? > > Yes, I can set it with "PerlSetVar protocol https", but is there a simpler > way? There was a long related discussion a few weeks ago. Here is what I've added to the guide (not online yet): =head1 Verifying Whether A Request Was Received Over An SSL Connection Just like C<$ENV{MODPERL}> is checked to see whether the code is run under mod_perl, C<$ENV{HTTPS}> is set by ssl modules and therefore can be used to check whether a request is running over SSL connection. For example: print "SSL" if $ENV{HTTPS}; If C setting is in effect, C<$ENV{HTTPS}> won't be available, and then: print "SSL" if $r->subprocess_env('https'); should be used instead. Note that it's also possible to check the scheme: print "SSL" if Apache::URI->parse($r)->scheme =~ m/^https/; but it's not one hundred percent certain unless you control the server and you know that you run a secure server on the port 443. -- _ 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/
http or https in URL?
In a mod_perl handler I want to construct the original URL of the request. I can construct it with r->get_server_name, r->get_server_port, r->uri and $r->parsed_uri->query. But how do I get the protocol, http or https. Is there a way to find out whether SSLEngine On is set? Yes, I can set it with "PerlSetVar protocol https", but is there a simpler way? Thanks in advance, Peter -- /"\ ASCII Ribbon Campaign \ / X Against HTML / \ in e-mail & news
Re: URI::URL - problem in LWP 5.53_95 with mod_perl
___cliff rayman___ wrote: > i did not use CPAN.pm to install software on this particular > machine. my mod_perl builds are always by hand. > > i did understand exactly why this happened. i should have made > that more clear in my first e-mail. i made the patch that i did, so > i would not have the same problem with any other software. You are correct. I interviewed the sysadmin that called me for help with this building mod_perl, and he fessed up to FTP'ing into CPAN and just grabbing the "latest version" - i.e. the 5.53_95 tarball. He didn't use CPAN.pm after all. I couldn't get CPAN.pm to fetch the dev tarball either. I just figured he was too new to Perl and Solaris (a former MCSE) to grab a tarball and install. Turns out, he was too new. He just didn't know about CPAN.pm! Anyway, I missed your (Cliff's) one-line patch to LWP::UserAgent.pm and thought it was the more extensive earlier patch. My vote is for Cliff's patch to just 'use URI::URL;' in LWP::UserAgent.pm. If you don't feel like patching, remember to export PERL_HTTP_URI_CLASS=URI::URL instead. Mike808/ > Stas Bekman wrote: > > What version of CPAN.pm are you using? CPAN.pm never picks distros with > > '_' in the version part. I've just performed checking I've got > > 5.53.tar.gz. Then you shouldn't be having the missing URI::URL problem in mod_perl. Or has the "real" 5.53 been fubar'd since April or so, and nobody noticed until now? Mike808/ -- perl -le "$_='7284254074:0930970:H4012816';tr[0->][ BOPEN!SMUT];print"
Re: URI::URL - problem in LWP 5.53_95 with mod_perl
i did not use CPAN.pm to install software on this particular machine. my mod_perl builds are always by hand. i did understand exactly why this happened. i should have made that more clear in my first e-mail. i made the patch that i did, so i would not have the same problem with any other software. Stas Bekman wrote: > On Sat, 25 Aug 101 [EMAIL PROTECTED] wrote: > > [snip] > > > He's right, and this is exactly what's happened in mod_perl. > > It's a bug *caused* by recent changes in LWP, and not a bug in LWP, per se. > > >From Gisle Aas' directory in CPAN, you can see: > > > > 04/10/01 06:15PM157,267 libwww-perl-5.53.tar.gz > > 05/05/01 08:57AM172,925 libwww-perl-5.53_94.tar.gz > > 08/06/01 07:46PM174,613 libwww-perl-5.53_95.tar.gz > > > > >From the "official" website, http://www.linpro.no/lwp, he says the > > lastest version is 5.53 from 4/10/01. However, if you use the CPAN module, > > you will pickup the 5.53_95 version instead. This is the version (and > > maybe 5.53_94 as well, but I haven't checked) that makes mod_perl break. > > Or maybe some interim versions of the CPAN module are downloading > > this development version of the module, I'm not sure. > > What version of CPAN.pm are you using? CPAN.pm never picks distros with > '_' in the version part. I've just performed checking I've got > 5.53.tar.gz. > > -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: URI::URL - problem in LWP 5.53_95 with mod_perl
On Sat, 25 Aug 101 [EMAIL PROTECTED] wrote: [snip] > He's right, and this is exactly what's happened in mod_perl. > It's a bug *caused* by recent changes in LWP, and not a bug in LWP, per se. > >From Gisle Aas' directory in CPAN, you can see: > > 04/10/01 06:15PM157,267 libwww-perl-5.53.tar.gz > 05/05/01 08:57AM172,925 libwww-perl-5.53_94.tar.gz > 08/06/01 07:46PM174,613 libwww-perl-5.53_95.tar.gz > > >From the "official" website, http://www.linpro.no/lwp, he says the > lastest version is 5.53 from 4/10/01. However, if you use the CPAN module, > you will pickup the 5.53_95 version instead. This is the version (and > maybe 5.53_94 as well, but I haven't checked) that makes mod_perl break. > Or maybe some interim versions of the CPAN module are downloading > this development version of the module, I'm not sure. What version of CPAN.pm are you using? CPAN.pm never picks distros with '_' in the version part. I've just performed checking I've got 5.53.tar.gz. _ 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.org http://perlmonth.com/
Re: URI::URL - problem in LWP 5.53_95 with mod_perl
I ran into the same problem. Found a simpler, cleaner solution. Just perform a export PERL_HTTP_URI_CLASS=URI::URL before building mod_perl, and you're home free. Long term, all mod_perl testing modules that "assume" URI::URL is loaded by LWP will now need to explicitly load URI::URL if they use it. I suggest doing so following the loading of LWP. Here's why it happened: Cliff noted: >I noticed everywhere that URI::URL was being used in mod_perl and embperl, >LWP::UserAgent was being used. > >also, i found this is the LWP (libwww-perl-5.5395) release notes: > > HTTP::Request, HTTP::Response will by default now use "URI" class, > instead of "URI::URL", when constructing its URI objects. This > has a potential for breaking existing code as URI::URL objects had > some extra methods that external code might depend upon. He's right, and this is exactly what's happened in mod_perl. It's a bug *caused* by recent changes in LWP, and not a bug in LWP, per se. >From Gisle Aas' directory in CPAN, you can see: 04/10/01 06:15PM157,267 libwww-perl-5.53.tar.gz 05/05/01 08:57AM172,925 libwww-perl-5.53_94.tar.gz 08/06/01 07:46PM174,613 libwww-perl-5.53_95.tar.gz >From the "official" website, http://www.linpro.no/lwp, he says the lastest version is 5.53 from 4/10/01. However, if you use the CPAN module, you will pickup the 5.53_95 version instead. This is the version (and maybe 5.53_94 as well, but I haven't checked) that makes mod_perl break. Or maybe some interim versions of the CPAN module are downloading this development version of the module, I'm not sure. I'm willing to bet that both of you have the later 5.53_95 rev and not the 5.53 version. Here's the cause of the problem. Gisle has always used URI::URL for representing his URLs within LWP. These latest revs changed that. He now uses a base URI class. The effect of this is that LWP no longer uses URI::URL. Meaning URI::URL is no longer 'use'd by LWP, and so LWP will no longer automatically 'use' URI::URL and pull it in too. This is what's making mod_perl (and any other modules that do this) break. Using LWP *does not* load URI::URL. mod_perl's tests *assume* that just because LWP was loaded, that URI::URL was too. And that's the hidden dependency that's being violated here. So, where's the root of the cause of the code breakage in LWP, you ask? Way down in HTTP::Message (which is inherited by HTTP::Request and HTTP::Response), Gisle has changed it to use the bare URI class and not the older URI::URL class. Here's the line of code that does the damage (Line 37 in HTTP::Message.pm): $HTTP::URI_CLASS ||= $ENV{PERL_HTTP_URI_CLASS} || "URI"; As should be obvious now, my simple solution is to perform a export PERL_HTTP_URI_CLASS=URI::URL before building mod_perl, and you're home free. Michael King [EMAIL PROTECTED] - Valuenet Web Mail. http://www.valuenet.net/
Re: URI::URL - problem
i got this to work. my method is ugly. i noticed everywhere that URI::URL was being used in mod_perl and embperl, LWP::UserAgent was being used. also, i found this is the LWP (libwww-perl-5.5395) release notes: HTTP::Request, HTTP::Response will by default now use "URI" class, instead of "URI::URL", when constructing its URI objects. This has a potential for breaking existing code as URI::URL objects had some extra methods that external code might depend upon. so - i performed this patch in (perlsitelib)/(perlversion)/LWP: snip- --- UserAgent.pm.orig Thu Aug 2 14:12:56 2001 +++ UserAgent.pmTue Aug 21 12:09:24 2001 @@ -2,7 +2,7 @@ package LWP::UserAgent; use strict; - +use URI::URL; # make mod_perl and others happy =head1 NAME LWP::UserAgent - A WWW UserAgent class snip- looks like the next version of mod_perl and embperl will need to be patched: 'use URI::URL' in all places where its objects are created and it's methods are being called. hope this helps, ___cliff rayman___ wrote: > this is not a good fix. i went to build embperl, and got > the same URI::URL warnings when it attempted to test > with mod_perl. embperl also expects to be able to call > 'new URI::URL' without a previous use/require in the code. > > i did test to make sure my URI::URL was installed properly > perl -MURI::URL -e 'print "$URI::URL::VERSION\n"' > which returns 5.02. > > This is perl, v5.6.1 built for i686-linux > Server: Apache/1.3.20 (Unix) mod_perl/1.26 mod_ssl/2.8.4 OpenSSL/0.9.6b > > i'll have to do some more looking tomorrow. > > ___cliff rayman___ wrote: > > > i had the same problem - i was able to fix it by performing > > the following patches. not sure how it is supposed to work > > without the patches. so, either something is wrong with our > > two configurations or something is wrong with 1.26. usually > > i'd believe the former, but 1.26 has only been out for 2 weeks > > or so. > > ---snip-- > > --- ./t/internal/hooks.t.orig Wed Jan 20 15:16:38 1999 > > +++ ./t/internal/hooks.tMon Aug 20 20:52:03 2001 > > @@ -7,6 +7,7 @@ > > use ExtUtils::testlib; > > BEGIN { require "net/config.pl"; } > > require LWP::UserAgent; > > +use URI::URL; > > > > #first one queries httpd for enabled hooks, > > #generating a hook::handler() for each and writing t/docs/.htaccess > > > > --- ./t/TEST.orig Sun Mar 5 15:36:08 2000 > > +++ ./t/TESTMon Aug 20 20:56:20 2001 > > @@ -2,7 +2,7 @@ > > > > $|++; > > use Config; > > - > > +use URI::URL; > > # First we check if we already are within the "t" directory > > if (-d "t") { > > # try to move into test directory > > > > [root@u5 mod_perl-1.26]# diff -u ./blib/lib/Apache/test.pm.orig >./blib/lib/Apache/test.pm > > --- ./blib/lib/Apache/test.pm.orig Wed Feb 14 14:57:08 2001 > > +++ ./blib/lib/Apache/test.pm Mon Aug 20 20:49:06 2001 > > @@ -5,6 +5,8 @@ > > use Exporter (); > > use Config; > > use FileHandle (); > > +use URI::URL; > > + > > *import = \&Exporter::import; > > > > @EXPORT = qw(test fetch simple_fetch have_module skip_test > > --snip-- > > > > allan wrote: > > > > > running make test i cannot come aroubf this annoying message: > > > > > > will write error_log to: t/logs/error_log > > > letting apache warm up...\c > > > done > > > /usr/bin/perl t/TEST 0 > > > Can't locate object method "new" via package "URI::URL" at > > > ../blib/lib/Apache/test.pm line 252. > > > make: *** [run_tests] Error 255 > > > > > > > > > > -- > > ___cliff [EMAIL PROTECTED]http://www.genwax.com/ > > -- > ___cliff [EMAIL PROTECTED]http://www.genwax.com/ -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: URI::URL - problem
this is not a good fix. i went to build embperl, and got the same URI::URL warnings when it attempted to test with mod_perl. embperl also expects to be able to call 'new URI::URL' without a previous use/require in the code. i did test to make sure my URI::URL was installed properly perl -MURI::URL -e 'print "$URI::URL::VERSION\n"' which returns 5.02. This is perl, v5.6.1 built for i686-linux Server: Apache/1.3.20 (Unix) mod_perl/1.26 mod_ssl/2.8.4 OpenSSL/0.9.6b i'll have to do some more looking tomorrow. ___cliff rayman___ wrote: > i had the same problem - i was able to fix it by performing > the following patches. not sure how it is supposed to work > without the patches. so, either something is wrong with our > two configurations or something is wrong with 1.26. usually > i'd believe the former, but 1.26 has only been out for 2 weeks > or so. > ---snip-- > --- ./t/internal/hooks.t.orig Wed Jan 20 15:16:38 1999 > +++ ./t/internal/hooks.tMon Aug 20 20:52:03 2001 > @@ -7,6 +7,7 @@ > use ExtUtils::testlib; > BEGIN { require "net/config.pl"; } > require LWP::UserAgent; > +use URI::URL; > > #first one queries httpd for enabled hooks, > #generating a hook::handler() for each and writing t/docs/.htaccess > > --- ./t/TEST.orig Sun Mar 5 15:36:08 2000 > +++ ./t/TESTMon Aug 20 20:56:20 2001 > @@ -2,7 +2,7 @@ > > $|++; > use Config; > - > +use URI::URL; > # First we check if we already are within the "t" directory > if (-d "t") { > # try to move into test directory > > [root@u5 mod_perl-1.26]# diff -u ./blib/lib/Apache/test.pm.orig >./blib/lib/Apache/test.pm > --- ./blib/lib/Apache/test.pm.orig Wed Feb 14 14:57:08 2001 > +++ ./blib/lib/Apache/test.pm Mon Aug 20 20:49:06 2001 > @@ -5,6 +5,8 @@ > use Exporter (); > use Config; > use FileHandle (); > +use URI::URL; > + > *import = \&Exporter::import; > > @EXPORT = qw(test fetch simple_fetch have_module skip_test > --snip-- > > allan wrote: > > > running make test i cannot come aroubf this annoying message: > > > > will write error_log to: t/logs/error_log > > letting apache warm up...\c > > done > > /usr/bin/perl t/TEST 0 > > Can't locate object method "new" via package "URI::URL" at > > ../blib/lib/Apache/test.pm line 252. > > make: *** [run_tests] Error 255 > > > > > > -- > ___cliff [EMAIL PROTECTED]http://www.genwax.com/ -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: URI::URL - problem
i had the same problem - i was able to fix it by performing the following patches. not sure how it is supposed to work without the patches. so, either something is wrong with our two configurations or something is wrong with 1.26. usually i'd believe the former, but 1.26 has only been out for 2 weeks or so. ---snip-- --- ./t/internal/hooks.t.orig Wed Jan 20 15:16:38 1999 +++ ./t/internal/hooks.tMon Aug 20 20:52:03 2001 @@ -7,6 +7,7 @@ use ExtUtils::testlib; BEGIN { require "net/config.pl"; } require LWP::UserAgent; +use URI::URL; #first one queries httpd for enabled hooks, #generating a hook::handler() for each and writing t/docs/.htaccess --- ./t/TEST.orig Sun Mar 5 15:36:08 2000 +++ ./t/TESTMon Aug 20 20:56:20 2001 @@ -2,7 +2,7 @@ $|++; use Config; - +use URI::URL; # First we check if we already are within the "t" directory if (-d "t") { # try to move into test directory [root@u5 mod_perl-1.26]# diff -u ./blib/lib/Apache/test.pm.orig ./blib/lib/Apache/test.pm --- ./blib/lib/Apache/test.pm.orig Wed Feb 14 14:57:08 2001 +++ ./blib/lib/Apache/test.pm Mon Aug 20 20:49:06 2001 @@ -5,6 +5,8 @@ use Exporter (); use Config; use FileHandle (); +use URI::URL; + *import = \&Exporter::import; @EXPORT = qw(test fetch simple_fetch have_module skip_test --snip-- allan wrote: > running make test i cannot come aroubf this annoying message: > > will write error_log to: t/logs/error_log > letting apache warm up...\c > done > /usr/bin/perl t/TEST 0 > Can't locate object method "new" via package "URI::URL" at > ../blib/lib/Apache/test.pm line 252. > make: *** [run_tests] Error 255 > > -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
URI::URL - problem
running make test i cannot come aroubf this annoying message: will write error_log to: t/logs/error_log letting apache warm up...\c done /usr/bin/perl t/TEST 0 Can't locate object method "new" via package "URI::URL" at ../blib/lib/Apache/test.pm line 252. make: *** [run_tests] Error 255 eh, what is going on? no test problems with lwp itself. below is my complete t/logs/error_log. hope someone can help with this. thanks allan Server is not starting !? Subroutine main::pid redefined at /source/mod_perl-1.25/t//docs/startup.pl line 103. Subroutine main::access redefined at /source/mod_perl-1.25/t//docs/startup.pl line 104. Subroutine Outside::code redefined at /source/mod_perl-1.25/t//docs/startup.pl line 108. Subroutine PerlTransHandler::handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 114. Subroutine MyClass::method redefined at /source/mod_perl-1.25/t//docs/startup.pl line 121. Subroutine BaseClass::handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 127. Subroutine My::child_init redefined at /source/mod_perl-1.25/t//docs/startup.pl line 145. Subroutine My::child_exit redefined at /source/mod_perl-1.25/t//docs/startup.pl line 155. Subroutine My::restart redefined at /source/mod_perl-1.25/t//docs/startup.pl line 159. Subroutine Apache::AuthenTest::handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 167. Subroutine My::DirIndex::handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 189. Subroutine My::ProxyTest::handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 207. Subroutine handler redefined at /source/mod_perl-1.25/t//docs/startup.pl line 241. Subroutine new redefined at /source/mod_perl-1.25/t//docs/startup.pl line 263. Subroutine DESTROY redefined at /source/mod_perl-1.25/t//docs/startup.pl line 265. [notice] Destruction->DESTROY called for $global_object Subroutine handler redefined at /source/mod_perl-1.25/t//docs/stacked.pl line 6. Subroutine one redefined at /source/mod_perl-1.25/t//docs/stacked.pl line 14. Subroutine two redefined at /source/mod_perl-1.25/t//docs/stacked.pl line 25. Subroutine three redefined at /source/mod_perl-1.25/t//docs/stacked.pl line 31. Subroutine four redefined at /source/mod_perl-1.25/t//docs/stacked.pl line 37. [Tue Aug 21 00:05:45 2001] [warn] pid file /source/mod_perl-1.25/t/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [notice] Destruction->DESTROY called for $global_object [Tue Aug 21 00:05:47 2001] [warn] [notice] child_init for process 3012, report any problems to [no address given]
[OT] Re: nph- in url on NT gives error
On Monday 20 August 2001 15:15, Purcell, Scott wrote: > Anyway, I am running Apache 1.3.20 and just began coding a few lines. I > noticed errors in the log file: > "couldn't spawn child process: /apache/cgi-bin/nph-rater.cgi" > > The code (couldn't be any simpler) errors when named 'nph-rater.cgi', but > runs with no issues if I rename that same bit of code to 'test.cgi'. > > > > #! D:\\Perl\\bin; > > use CGI; # load CGI routines > $q = new CGI;# create new CGI object > print $q->header,# create the HTTP header > $q->start_html('hello world'), # start the HTML > $q->h1('hello world'), # level 1 header > $q->end_html; # end the HTML nph- scripts need to produce the entire set of their response headers, including the status line. In order to do that, you need to add the -nph pragma to your list of imports: use CGI qw(-nph); perldoc CGI for the whole story. -- ___ Robin Berjon <[EMAIL PROTECTED]> -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- In which level of metalanguage are you now speaking?
nph- in url on NT gives error
Hello, I was trying to do an exercise from TPJ Issue#5 (vol2.,no2) Rating Web Page Tastefulness with a Perl Agent, and it uses nph- in the URL. (Steins column). Anyway, I am running Apache 1.3.20 and just began coding a few lines. I noticed errors in the log file: "couldn't spawn child process: /apache/cgi-bin/nph-rater.cgi" So I began trying to iron out what is wrong, and I noticed that if I take the same code and rename it to test.cgi it is happy. So apparently it is telling me that I cannot do non-parsed headers on Apache running NT? The code (couldn't be any simpler) errors when named 'nph-rater.cgi', but runs with no issues if I rename that same bit of code to 'test.cgi'. #! D:\\Perl\\bin; use CGI; # load CGI routines $q = new CGI;# create new CGI object print $q->header,# create the HTTP header $q->start_html('hello world'), # start the HTML $q->h1('hello world'), # level 1 header $q->end_html; # end the HTML Scott Purcell
Re: url mangling/rewriting
> > I see. You mean your session state is not stored on the database, > > but stored as encrypted text in session id itself. > > Yes, and the problem is whether there is some good > algorithm, which will generate this kind of session > ids. Security is not main part of this solution, but > easy finding of these session ids is not desirable. ;) So, it's not really a session ID then; it's your session data. There are tons of two-way encryption modules on CPAN. Try looking at Crypt::CBC. - Perrin
Re: url mangling/rewriting
On Fri, Aug 10, 2001, Tatsuhiko Miyagawa wrote: > On Fri, 10 Aug 2001 14:40:13 +0200 > David Hajek <[EMAIL PROTECTED]> wrote: > > I see. You mean your session state is not stored on the database, > but stored as encrypted text in session id itself. Yes, and the problem is whether there is some good algorithm, which will generate this kind of session ids. Security is not main part of this solution, but easy finding of these session ids is not desirable. ;) -- David Hajek [EMAIL PROTECTED] GSM: +420 604 352968 - Hackers of the world, unite!
Re: getting URL of refused page, after OnDeny
> Can you set up a custom error document handler and redirect to that, > rather than using your OnDeny? Return something like 409 > ("Conflict"), and Apache will do an internal redirect, from which > you can get the requesting URI in the same way that you can in > other redirects. > > Actually, how is the require handled? What does your auth handler > return if the user is not subscribed? Can/does your handler do an > internal redirect? I do (in my C handler): ap_table_set (r->headers_out, "Location", sec->auth_LNonDeny); return REDIRECT; your suggestion sounds good, off to hit my books to see how to do that - sounds like a good solution (never done an internal redirect - I think -)) thanks for the pointer, Bob Waldstein [EMAIL PROTECTED]
Re: getting URL of refused page, after OnDeny
[EMAIL PROTECTED] <[EMAIL PROTECTED]> said something to this effect on 07/06/2001: > my setup: I have files in a directory, that a user can only get if > subscribed. My apache is hacked with both C and mod_perl > enhancements to authentication/authorization. My .htaccess > looks as follows: > AuthName "library services" > AuthType Basic > > require subscribe idc > OnDeny http://myserver/refusals/idc.html > > > the problem: when a unsubscribed user tries to go to: > http://myserver/protected-dir/document.pdf > and gets bounced to the refusal/subscription page (idc.html) I would > like to know the refused page (/protected-dir/document.pdf) so I can > send them back there when they subscribe. > > I don't see any way to carry this infomation? Am thinking about hacking > more so I can have an OnDeny line like > OnDeny http://myserver/refusals/idc.html?refused=$URI > > but feel like I am probably missing something! THanks for any pointers, Can you set up a custom error document handler and redirect to that, rather than using your OnDeny? Return something like 409 ("Conflict"), and Apache will do an internal redirect, from which you can get the requesting URI in the same way that you can in other redirects. Actually, how is the require handled? What does your auth handler return if the user is not subscribed? Can/does your handler do an internal redirect? (darren) -- Small pleasures exclude great ones.
getting URL of refused page, after OnDeny
my setup: I have files in a directory, that a user can only get if subscribed. My apache is hacked with both C and mod_perl enhancements to authentication/authorization. My .htaccess looks as follows: AuthName "library services" AuthType Basic require subscribe idc OnDeny http://myserver/refusals/idc.html the problem: when a unsubscribed user tries to go to: http://myserver/protected-dir/document.pdf and gets bounced to the refusal/subscription page (idc.html) I would like to know the refused page (/protected-dir/document.pdf) so I can send them back there when they subscribe. I don't see any way to carry this infomation? Am thinking about hacking more so I can have an OnDeny line like OnDeny http://myserver/refusals/idc.html?refused=$URI but feel like I am probably missing something! THanks for any pointers, Bob Waldstein [EMAIL PROTECTED]
Re: Getting the wrong URL
On 1 Jun 2001, [EMAIL PROTECTED] wrote: > OK, I think I have solved this problem, but I would like to run my solution by > you folks, and see if it makes any sense. What we found, on a more thorough > code review, was that a number of the handlers were doing a redirect by calling > send_cgi_header, and then exit()'ing. It seemed to us that the exit would kill > the Perl interp, and the Apache child would then just keep serving whatever it > had in its buffer at the time. Does that make any sense? If so, will die() have > the same results? I started grepping for exit everywhere, and removed it, but > along the way I saw a number of places that we're calling die. i'm missing the original message, but if you can post a small test case, along with results and expected results, we can look into it.
Re: Getting the wrong URL
On 1 Jun 2001, [EMAIL PROTECTED] wrote: > OK, I think I have solved this problem, but I would like to run my solution by > you folks, and see if it makes any sense. What we found, on a more thorough > code review, was that a number of the handlers were doing a redirect by calling > send_cgi_header, and then exit()'ing. It seemed to us that the exit would kill > the Perl interp, and the Apache child would then just keep serving whatever it > had in its buffer at the time. Does that make any sense? If so, will die() have > the same results? I started grepping for exit everywhere, and removed it, but > along the way I saw a number of places that we're calling die. I don't think it makes any sense. Also you could look at the handlers running for each request using Apache::ShowRequest. I think it's mentioned somewhere in the guide too. > I expect that this is just a really stupid newbie problem - I've only been > doing mod_perl stuff for about 6 months or so. And, in fact, once it occurred > to me that this might be the problem, of course I found it in the FAQ. > > -- > Rich Bowen - Author - Apache Server Unleashed > http://www.apacheunleashed.com/ > > _ 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.org http://perlmonth.com/
Re: Getting the wrong URL
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > OK, I think I have solved this problem, but I would like to run my solution by > you folks, and see if it makes any sense. What we found, on a more thorough > code review, was that a number of the handlers were doing a redirect by calling > send_cgi_header, and then exit()'ing. It seemed to us that the exit would kill > the Perl interp, and the Apache child would then just keep serving whatever it > had in its buffer at the time. Does that make any sense? If so, will die() have > the same results? I started grepping for exit everywhere, and removed it, but > along the way I saw a number of places that we're calling die. > > I expect that this is just a really stupid newbie problem - I've only been > doing mod_perl stuff for about 6 months or so. And, in fact, once it occurred > to me that this might be the problem, of course I found it in the FAQ. In case you haven't found the guide yet: http://perl.apache.org/guide/porting.html#Terminating_requests_and_process http://perl.apache.org/guide/porting.html#die_and_mod_perl > > -- > Rich Bowen - Author - Apache Server Unleashed > http://www.apacheunleashed.com/ >
Re: Getting the wrong URL
OK, I think I have solved this problem, but I would like to run my solution by you folks, and see if it makes any sense. What we found, on a more thorough code review, was that a number of the handlers were doing a redirect by calling send_cgi_header, and then exit()'ing. It seemed to us that the exit would kill the Perl interp, and the Apache child would then just keep serving whatever it had in its buffer at the time. Does that make any sense? If so, will die() have the same results? I started grepping for exit everywhere, and removed it, but along the way I saw a number of places that we're calling die. I expect that this is just a really stupid newbie problem - I've only been doing mod_perl stuff for about 6 months or so. And, in fact, once it occurred to me that this might be the problem, of course I found it in the FAQ. -- Rich Bowen - Author - Apache Server Unleashed http://www.apacheunleashed.com/
Re: modify url in web log via PerlLogHandler
I did not get any responses so I consulted the sources of both apache and mod_perl. It turned out that apache uses the_request method to get data for the log entries. The eagle book documented this the_request as a read-only method. Fortunately in the recent versions of mod_perl this is not the case any more and one can set a new value via this method. So modifying url in web log via PerlLogHandler is indeed possible. Just modify the_request value instead of the uri value. HTH for other people. Thanks Richard On Sat, May 26, 2001 at 09:23:17AM -0400, Richard Chen wrote: > Is it possible to modify the logged url in the usual > modperl weblog via PerlLogHandler? I have tried this and > it does not seem to work: > > $ cat Apache/MyLog.pm > package Apache::MyLog; > use Apache::Constants qw(:common); > sub handler { > my $r = shift; > my $uri=$r->uri; > return DECLINED if ($r->filename !~ /foobar/); > print STDERR "in MyLog handler, \$uri=$uri, modify it now\n"; > $r->uri('/foobar_changed'); > return OK; > } > 1; > > When this is installed like this: > > > PerlLogHandler Apache::MyLog > > > I can see the debugging message in error_log but the url logged > in the weblog is still the same as before. > > Thanks for any info. > > Richard
Re: Getting the wrong URL
On Sat, 26 May 2001 22:41:11 +0800 (SGT), Stas Bekman said: > On 25 May 2001, [EMAIL PROTECTED] wrote: > > > Once one handler get a server error, you'll get the last > > succssful content served by that child, repeatedly, forever. Note also that > > this not one handler with lots of different behaviors. It's about 20 handlers, > > based of some shared base modules, but performing rather different tasks. > > Can you send us a small handler that reproduces the problem? No. Unfortunately, it's a pretty complex system, and so far we've been unable to narrow it down to just one thing. We had a suspicion for a while that it was related to handlers that were redirecting to other handlers when they were done, but I've been unable to confirm this yet. > Have you tried writing the data to the disk instead of/in addition to > sending it down to the client? Do you see the data written to the disk > (error_log seems to be the best) changing? What I'm trying to verify now is which URL Apache is even seeing in the request. However, it does not seem to be logging anything at all. Of course, I can't reproduce the problem right now. Bah. -- Have trouble remembering things? - http://www.idforgetmyhead.com/
Re: Getting the wrong URL
On 25 May 2001, [EMAIL PROTECTED] wrote: > > On Fri, 25 May 2001 23:28:44 +0800 (SGT), Stas Bekman said: > > > > We're not doing anything with Apache::Registry. Everything is with Perl > > > handlers. It always seemed to me that the problems described at those locations > > > were specific to Apache::Registry. So you're saying that if a Perl handler > > > module falls over for some reason, that child will continue serving the last > > > content it served, forever? This strikes me as a bad thing. > > > > It's quite possible if you happen to create closures in your "dispatch" > > handler for example. It's a bad thing :) > > I sort of had the impression that closures were a good way to leak memory, and > so avoided them. Good. > > > Anyways, all of the possible reasons listed there are not, as far as we can > > > tell, going on in our code. Everything is 100% OO, nothing is global or > > > exported, and everything uses strict and warnings. Perhaps I'm misunderstanding > > > when things actually pass out of scope in a mod_perl environment. > > > > > > Since almost all of the availble documentation seems to be about using > > > Apache::Registry, rather than about writing handlers, it's not always clear > > > whether things like this necessarily translate to both. > > > > I'd switch to a single server mode first thing first. Do you see the same > > behavior with httpd -X? > > Same behavior, yes. Once one handler get a server error, you'll get the last > succssful content served by that child, repeatedly, forever. Note also that > this not one handler with lots of different behaviors. It's about 20 handlers, > based of some shared base modules, but performing rather different tasks. Can you send us a small handler that reproduces the problem? Have you tried writing the data to the disk instead of/in addition to sending it down to the client? Do you see the data written to the disk (error_log seems to be the best) changing? Of course continue the debugging under -X. _ 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.org http://perlmonth.com/
modify url in web log via PerlLogHandler
Is it possible to modify the logged url in the usual modperl weblog via PerlLogHandler? I have tried this and it does not seem to work: $ cat Apache/MyLog.pm package Apache::MyLog; use Apache::Constants qw(:common); sub handler { my $r = shift; my $uri=$r->uri; return DECLINED if ($r->filename !~ /foobar/); print STDERR "in MyLog handler, \$uri=$uri, modify it now\n"; $r->uri('/foobar_changed'); return OK; } 1; When this is installed like this: PerlLogHandler Apache::MyLog I can see the debugging message in error_log but the url logged in the weblog is still the same as before. Thanks for any info. Richard
Re: Getting the wrong URL
On Fri, 25 May 2001 23:28:44 +0800 (SGT), Stas Bekman said: > > We're not doing anything with Apache::Registry. Everything is with Perl > > handlers. It always seemed to me that the problems described at those locations > > were specific to Apache::Registry. So you're saying that if a Perl handler > > module falls over for some reason, that child will continue serving the last > > content it served, forever? This strikes me as a bad thing. > > It's quite possible if you happen to create closures in your "dispatch" > handler for example. It's a bad thing :) I sort of had the impression that closures were a good way to leak memory, and so avoided them. > > Anyways, all of the possible reasons listed there are not, as far as we can > > tell, going on in our code. Everything is 100% OO, nothing is global or > > exported, and everything uses strict and warnings. Perhaps I'm misunderstanding > > when things actually pass out of scope in a mod_perl environment. > > > > Since almost all of the availble documentation seems to be about using > > Apache::Registry, rather than about writing handlers, it's not always clear > > whether things like this necessarily translate to both. > > I'd switch to a single server mode first thing first. Do you see the same > behavior with httpd -X? Same behavior, yes. Once one handler get a server error, you'll get the last succssful content served by that child, repeatedly, forever. Note also that this not one handler with lots of different behaviors. It's about 20 handlers, based of some shared base modules, but performing rather different tasks. -- Rich Bowen - Author - Apache Server Unleashed http://www.apacheunleashed.com/
Re: Similiar to getting the wrong url!
On Fri, 25 May 2001, Jean Louis Girard wrote: > On our site we have a page that does a search into a postgress database and > then displays the results. When the site was running on redhat 6.2 it would > occasionaly (1 out of 10) display false results. Since we have moved the > site to a redhat 7.0 with the same perl and mod-perl as redhat 6.2 the > search missed 50% of the time. > > any ideas? httpd -X and code isolation/small test reproducing technique first. print()/warn() and debugger next (still running under -X). There is a reason for me sending you to read about Apache::Registry problem. It's just an example of what can go wrong with your code. read the registry explanation, understand why you have to switch to -X, then do that and you will find your problem. _ 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.org http://perlmonth.com/
Re: Getting the wrong URL
On 25 May 2001, [EMAIL PROTECTED] wrote: > > > On 24 May 2001, [EMAIL PROTECTED] wrote: > .. > > > I have a web site where *everything* is mod_perl handlers. The problem that I'm > > > seeing is that I will go to the url http://hostname/foo and I get the content > > > from http://hostname/bar > > > > > > This seems to be happening when there is a server error of some variety, and > > > from then on, until a server restart, users are just getting whatever the last > > > thing was that that Apache child served. I have not been able to completely > > > verify this, but I am consistently getting the same (wrong) content from a > > > particular child, so apparently the particular child just keeps giving me > > > whatever it served the last time. > > > On Fri, 25 May 2001 10:31:09 +0800 (SGT), Stas Bekman said: > > looks like > > http://perl.apache.org/guide/porting.html#Exposing_Apache_Registry_secret > > http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it > > We're not doing anything with Apache::Registry. Everything is with Perl > handlers. It always seemed to me that the problems described at those locations > were specific to Apache::Registry. So you're saying that if a Perl handler > module falls over for some reason, that child will continue serving the last > content it served, forever? This strikes me as a bad thing. It's quite possible if you happen to create closures in your "dispatch" handler for example. It's a bad thing :) > Anyways, all of the possible reasons listed there are not, as far as we can > tell, going on in our code. Everything is 100% OO, nothing is global or > exported, and everything uses strict and warnings. Perhaps I'm misunderstanding > when things actually pass out of scope in a mod_perl environment. > > Since almost all of the availble documentation seems to be about using > Apache::Registry, rather than about writing handlers, it's not always clear > whether things like this necessarily translate to both. I'd switch to a single server mode first thing first. Do you see the same behavior with httpd -X? _ 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.org http://perlmonth.com/
Similiar to getting the wrong url!
On our site we have a page that does a search into a postgress database and then displays the results. When the site was running on redhat 6.2 it would occasionaly (1 out of 10) display false results. Since we have moved the site to a redhat 7.0 with the same perl and mod-perl as redhat 6.2 the search missed 50% of the time. any ideas?
Re: Getting the wrong URL
> On 24 May 2001, [EMAIL PROTECTED] wrote: .. > > I have a web site where *everything* is mod_perl handlers. The problem that I'm > > seeing is that I will go to the url http://hostname/foo and I get the content > > from http://hostname/bar > > > > This seems to be happening when there is a server error of some variety, and > > from then on, until a server restart, users are just getting whatever the last > > thing was that that Apache child served. I have not been able to completely > > verify this, but I am consistently getting the same (wrong) content from a > > particular child, so apparently the particular child just keeps giving me > > whatever it served the last time. > On Fri, 25 May 2001 10:31:09 +0800 (SGT), Stas Bekman said: > looks like > http://perl.apache.org/guide/porting.html#Exposing_Apache_Registry_secret > http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it We're not doing anything with Apache::Registry. Everything is with Perl handlers. It always seemed to me that the problems described at those locations were specific to Apache::Registry. So you're saying that if a Perl handler module falls over for some reason, that child will continue serving the last content it served, forever? This strikes me as a bad thing. Anyways, all of the possible reasons listed there are not, as far as we can tell, going on in our code. Everything is 100% OO, nothing is global or exported, and everything uses strict and warnings. Perhaps I'm misunderstanding when things actually pass out of scope in a mod_perl environment. Since almost all of the availble documentation seems to be about using Apache::Registry, rather than about writing handlers, it's not always clear whether things like this necessarily translate to both. -- Director of Application Development The Creative Group http://products.cre8tivegroup.com/
Re: Getting the wrong URL
On 24 May 2001, [EMAIL PROTECTED] wrote: > I'm having a recurring problem that I can't find comment about in the docs, and > I was wondering if anyone might have some insight on this. > > I have a web site where *everything* is mod_perl handlers. The problem that I'm > seeing is that I will go to the url http://hostname/foo and I get the content > from http://hostname/bar > > This is naturally very distressing me me as the developer, and very confusing > for the user. I suppose it's very likely a problem with my code, rather than > with mod_perl, but if anyone has seen this before and can suggest where I > should be looking. > > This seems to be happening when there is a server error of some variety, and > from then on, until a server restart, users are just getting whatever the last > thing was that that Apache child served. I have not been able to completely > verify this, but I am consistently getting the same (wrong) content from a > particular child, so apparently the particular child just keeps giving me > whatever it served the last time. looks like http://perl.apache.org/guide/porting.html#Exposing_Apache_Registry_secret http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it _ 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.org http://perlmonth.com/
Getting the wrong URL
I'm having a recurring problem that I can't find comment about in the docs, and I was wondering if anyone might have some insight on this. I have a web site where *everything* is mod_perl handlers. The problem that I'm seeing is that I will go to the url http://hostname/foo and I get the content from http://hostname/bar This is naturally very distressing me me as the developer, and very confusing for the user. I suppose it's very likely a problem with my code, rather than with mod_perl, but if anyone has seen this before and can suggest where I should be looking. This seems to be happening when there is a server error of some variety, and from then on, until a server restart, users are just getting whatever the last thing was that that Apache child served. I have not been able to completely verify this, but I am consistently getting the same (wrong) content from a particular child, so apparently the particular child just keeps giving me whatever it served the last time. -- The Creative Group Web Application Group Moving your paper processes to your intranet site
Antwort: Appending Session ID behind URL
Hi, 2 ways: * before sending the output do a =~ s#(http://[^/]+/)([^\s>]*)#$1/$sessionid$2#i * or the cleaner way: don't use absolute URLs for your links. (but use them for all images) cu Michael PS: I hope you put the session id before the path part of the URL? It's much easier to maintain... Datum: 18.05.2001 05:33 An:"mod_perl" <[EMAIL PROTECTED]> Betreff: Appending Session ID behind URL Nachrichtentext: Hi all: I have a textbox in the HTML page which allows users to enter url. After the user click submit, i append the sessionid at the tail of the url. My qn is. how do i append all the links for that page with the sessionid. In my Apache module sub handler{ $r = shift; $query = $r->uri; } i notice the first time i manage to get the sessionid from the $query, after that the value is lost due to the many request that comes in. How do i append the session ID to all the url before the response is sent out to the client. Thanks All help appreciated Firestar Hi all: I have a textbox in the HTML page which allows users to enter url. After the user click submit, i append the sessionid at the tail of the url. My qn is. how do i append all the links for that page with the sessionid. In my Apache module sub handler{ $r = shift; $query = $r->uri; } i notice the first time i manage to get the sessionid from the $query, after that the value is lost due to the many request that comes in. How do i append the session ID to all the url before the response is sent out to the client. Thanks All help appreciated Firestar
Appending Session ID behind URL
Hi all: I have a textbox in the HTML page which allows users to enter url. After the user click submit, i append the sessionid at the tail of the url. My qn is. how do i append all the links for that page with the sessionid. In my Apache module sub handler{ $r = shift; $query = $r->uri; } i notice the first time i manage to get the sessionid from the $query, after that the value is lost due to the many request that comes in. How do i append the session ID to all the url before the response is sent out to the client. Thanks All help appreciated Firestar
How to change all the url of a particular website.. (append session id)
Hi . Hmm since i cannot get the cookie set by another URLDo you have any other suggestions for my problem. Current, i intend to pass the session id via the url. But the problem is let say first time i pass a url http://www.nus.edu.sg?sessionid=eeddffg i could get the sessionid from my mod perl module.. But subsequently, the value of the sessionid id is lost, as it proceed to get other request type(eg image). I intend to intercept the first request, and append the sessionid to the other requests before it is lost. Do your have any idea how to do? Thanks kheeTEck - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 17, 2001 12:07 AM Subject: RE: Fw: How to get cookie from a mod_perl proxy You cannot get a cooking that was set by another URL. Original Message: - From: ktgoh [EMAIL PROTECTED] Date: Mon, 14 May 2001 19:35:08 +0800 To: [EMAIL PROTECTED] Subject: Fw: How to get cookie from a mod_perl proxy > Hi, I am writing a perl_mod script for apache that will act as a proxy to > intercept all requests that comes through my proxy. I want to set a cookie in > the client's browser (to store a session ID) and retrieve it each time the > user make a request to other URL (assuming he has set my proxy as his proxy in > his browser configuration). > > My question is: Am i able to get the cookie i have set, from the client? I can > set the cookie for the client, but I have not been able to retrieve it so > far:(. Any help here is much appreciated. > > Regards, > Firestar > > Mail2Web - Check your email from the web at http://www.mail2web.com/ .
Re: the edge of chaos (URL correction)
My bad. it is www.dslreports.com/front/example.gif Sorry for those curious enough to check the URL out. On Thu, Jan 04, 2001 at 06:10:09PM -0500, Rick Myers wrote: > On Jan 04, 2001 at 17:55:54 -0500, Justin twiddled the keys to say: > > > > If you want to see what happens to actual output when this > > happens, check this gif: > >http://www.dslreports.com/front/eth0-day.gif > > You sure about this URL? I get a 404... > > Rick Myers[EMAIL PROTECTED] > > The Feynman Problem 1) Write down the problem. > Solving Algorithm 2) Think real hard. > 3) Write down the answer.
Complete URL Forbidden bug
Hi. When trying to pass full URL in HTTP request, I get "Forbidden" reply from apache. I've checked this with my server (apache/1.3.9 mod_perl/1.24) and with one of servers from "Sites using mod_perl" section on mod_perl site: % telnet www.imdb.com 80 Trying 208.33.219.16... Connected to us.sea.imdb.com. Escape character is '^]'. GET http://ddd/ HTTP/1.0 HTTP/1.1 403 Forbidden Date: Wed, 18 Oct 2000 11:34:27 GMT Server: Apache/1.3.11-dev (Unix) mod_perl/1.21_01-dev Connection: close Content-Type: text/html [skip] When using short URL ("GET / HTTP/1.0") all works ok. When using the same hostname as in main "ServerName" httpd.conf directive, all works ok (none of virtual host names or aliases doesn't fit). When not using mod_perl, all works ok. Any additional questions with E-mail please, I'm not subscribed to any of mod_perl lists. \bye Stas
Re: Getting data from external URL
Hmmm Looking at _trivial_http_get: if ($code =~ /^30[1237]/ && $buf =~ /\012Location:\s*(\S+)/) { # redirect So it certainly seems like it's *trying to handle it. As I recall (it was a late night when I had an application that wasn't working), I had single stepped down into the guts of LWP::Simple and realized that it was returning a failure indicator when encountering a 302 status. I had assumed that this was intended behavior, but now that I look at the pod of what we've currently got installed (1.32), it sure seems like it should work. I'll look into this a bit to see if I can recreate it, but for now, let's chalk it up to either (1) something that's been fixed since the version that I was using at the time, or (2) I'm just out of my head. More likely the latter... Sorry for the confusion. On 29 Aug 2000, Gisle Aas wrote: > Steve Reppucci <[EMAIL PROTECTED]> writes: > > > Just a word of warning: LWP::Simple doesn't follow redirects (at least, > > the last I checked, not sure if it's been changed in the 3 or 4 > > months since I've last used it...), > > If it does not follow redirects then that is a bug. Do you have a > test case? > > Not much has changed in the last 3 or 4 months either. > > Regards, > Gisle > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
Re: Getting data from external URL
Steve Reppucci <[EMAIL PROTECTED]> writes: > Just a word of warning: LWP::Simple doesn't follow redirects (at least, > the last I checked, not sure if it's been changed in the 3 or 4 > months since I've last used it...), If it does not follow redirects then that is a bug. Do you have a test case? Not much has changed in the last 3 or 4 months either. Regards, Gisle
Re: Getting data from external URL
On Mon, 28 Aug 2000, Jeff Beard wrote: > I just wrote a function yesterday that uses IO::Socket to interact with an > outside CGI program. It appears to work the way I want but this is my first > foray into writing TCP client code. > > It's basically this: > > sub tcp_client { > my ( $rhost, $rport, $query_string ) = @_; > > my $socket = IO::Socket::INET->new( PerrAddr => $rhost, > PeerPort => $rport, > Proto=> "tcp", > Type => SOCK_STREAM) > or die "Couldn't connect to $rhost:$rport : $!\n"; > > print $socket "GET /programname?$query_string\n"; At the very least send a HTTP/1.x part and a Host: header. Otherwise virtual hosts are hosed. -- Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
Re: Getting data from external URL
I just wrote a function yesterday that uses IO::Socket to interact with an outside CGI program. It appears to work the way I want but this is my first foray into writing TCP client code. It's basically this: sub tcp_client { my ( $rhost, $rport, $query_string ) = @_; my $socket = IO::Socket::INET->new( PerrAddr => $rhost, PeerPort => $rport, Proto=> "tcp", Type => SOCK_STREAM) or die "Couldn't connect to $rhost:$rport : $!\n"; print $socket "GET /programname?$query_string\n"; my $response; while ( <$socket> ) { $response .= $_ } close($socket); return \$answer; } --Jeff At 06:58 AM 8/28/00 -0400, Steve Reppucci wrote: >Just a word of warning: LWP::Simple doesn't follow redirects (at least, >the last I checked, not sure if it's been changed in the 3 or 4 >months since I've last used it...), so you need to be certain that you're >using it in a context where you're fetching something that won't return a >redirect. > >HTH... > >On Sat, 26 Aug 2000, Stas Bekman wrote: > > > On Sat, 26 Aug 2000, Rodney Broom wrote: > > > > > OK, lots of banter... > > > > > > Hey V, if you are on a *NIX system, then this is a fast way: > > > > > > open U, "lynx -source www.some.url.dom |"; > > > $data = join '', ; > > > > > > There, you're finished. Admittedly, this isn't terribly efficiant, > but it works > > > just fine and has short devel time. > > > > This one is much more efficient and requires even less coding: > > > > use LWP::Simple; > > $content = get("http://www.sn.no/") > > > > And it doesn't require you to be on any particular OS, as far as I know. > > > > see perldoc LWP::Simple and as advised by many others LWP::UserAgent for > > more advanced uses. > > >=-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= >Steve Reppucci [EMAIL PROTECTED] | >Logical Choice Software http://logsoft.com/ | >508/958-0183 Be Open | Jeff Beard __ Web:www.cyberxape.com Email: jeff at cyberxape dot com Location: Boulder, Colorado, USA
Re: Getting data from external URL
On Mon, 28 Aug 2000, Steve Reppucci wrote: > > Just a word of warning: LWP::Simple doesn't follow redirects (at least, > the last I checked, not sure if it's been changed in the 3 or 4 > months since I've last used it...), so you need to be certain that you're > using it in a context where you're fetching something that won't return a > redirect. That's why I've mentioned this :) LWP::UserAgent for more advanced uses. > > HTH... > > On Sat, 26 Aug 2000, Stas Bekman wrote: > > > On Sat, 26 Aug 2000, Rodney Broom wrote: > > > > > OK, lots of banter... > > > > > > Hey V, if you are on a *NIX system, then this is a fast way: > > > > > > open U, "lynx -source www.some.url.dom |"; > > > $data = join '', ; > > > > > > There, you're finished. Admittedly, this isn't terribly efficiant, but it works > > > just fine and has short devel time. > > > > This one is much more efficient and requires even less coding: > > > > use LWP::Simple; > > $content = get("http://www.sn.no/") > > > > And it doesn't require you to be on any particular OS, as far as I know. > > > > see perldoc LWP::Simple and as advised by many others LWP::UserAgent for > > more advanced uses. > > > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= > Steve Reppucci [EMAIL PROTECTED] | > Logical Choice Software http://logsoft.com/ | > 508/958-0183 Be Open | > > _ 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://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: Getting data from external URL
Just a word of warning: LWP::Simple doesn't follow redirects (at least, the last I checked, not sure if it's been changed in the 3 or 4 months since I've last used it...), so you need to be certain that you're using it in a context where you're fetching something that won't return a redirect. HTH... On Sat, 26 Aug 2000, Stas Bekman wrote: > On Sat, 26 Aug 2000, Rodney Broom wrote: > > > OK, lots of banter... > > > > Hey V, if you are on a *NIX system, then this is a fast way: > > > > open U, "lynx -source www.some.url.dom |"; > > $data = join '', ; > > > > There, you're finished. Admittedly, this isn't terribly efficiant, but it works > > just fine and has short devel time. > > This one is much more efficient and requires even less coding: > > use LWP::Simple; > $content = get("http://www.sn.no/") > > And it doesn't require you to be on any particular OS, as far as I know. > > see perldoc LWP::Simple and as advised by many others LWP::UserAgent for > more advanced uses. =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
Re: Getting data from external URL
Hello, Thanks everyone for such a simple solutions. I think I will use followig method as it seems much simpler. Thanks Vijay - Original Message - From: "Rodney Broom" <[EMAIL PROTECTED]> To: "Stas Bekman" <[EMAIL PROTECTED]> Cc: "Vijay" <[EMAIL PROTECTED]>; "mod_perl Maillinglist" <[EMAIL PROTECTED]> Sent: Saturday, August 26, 2000 10:24 AM Subject: Re: Getting data from external URL > SB> This one is much more efficient and requires even less coding: > SB> use LWP::Simple; > SB> $content = get("http://www.sn.no/") > > Even better, thanks Stas. > > >
Re: Getting data from external URL
SB> This one is much more efficient and requires even less coding: SB> use LWP::Simple; SB> $content = get("http://www.sn.no/") Even better, thanks Stas.
Re: Getting data from external URL
On Sat, 26 Aug 2000, Rodney Broom wrote: > OK, lots of banter... > > Hey V, if you are on a *NIX system, then this is a fast way: > > open U, "lynx -source www.some.url.dom |"; > $data = join '', ; > > There, you're finished. Admittedly, this isn't terribly efficiant, but it works > just fine and has short devel time. This one is much more efficient and requires even less coding: use LWP::Simple; $content = get("http://www.sn.no/") And it doesn't require you to be on any particular OS, as far as I know. see perldoc LWP::Simple and as advised by many others LWP::UserAgent for more advanced uses. _ 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://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: Getting data from external URL
OK, lots of banter... Hey V, if you are on a *NIX system, then this is a fast way: open U, "lynx -source www.some.url.dom |"; $data = join '', ; There, you're finished. Admittedly, this isn't terribly efficiant, but it works just fine and has short devel time. Rodney Broom
RE: Getting data from external URL
Hello Vijay, You can make simple HTTP GET or POST requests using the LWP and HTTP modules. I recommend that you read the ActivePerl help files. I have attached the one you really need but it probably won't make sense unless you read up on LWP. # A small sample follows: use LWP::UserAgent; # use HTTP::Request::Common qw(POST); $ua = new LWP::UserAgent; $ua->agent("Netscape 3.0"); $page_url = 'http://www.1freestuff.com/cgi-bin/topsites/topsites.cgi?puzzler'; $response = &get($page_url); # Do a GET. # print $response->as_string; # Get the NEW form number: $content = $response->content; $content =~ m/(value=")(\d.*)(")/ig; $number = $2; print "The magic number is: " . $number; sub get { my $page_url = $_[0]; my $request = new HTTP::Request(GET, "$page_url"); my $response = $ua->request($request); return $response; }; -Original Message- From: Vijay [mailto:[EMAIL PROTECTED]] Sent: Friday, August 25, 2000 11:15 PM To: [EMAIL PROTECTED]; mod_perl Maillinglist Subject: Getting data from external URL Hello, I want to get data from an external url in my perl program (either thru Embperl Execute or directly from perl). What I need is like this. There is a URL which gives some information in text format. I want to get that into a variable or file using perl and using my own html templates, I want to show that data. If anyone has done something like this, please let me know. Thanks Vijay Title: HTTP::Request::Common - Construct common HTTP::Request objects HTTP::Request::Common - Construct common HTTP::Request objects NAME SUPPORTED PLATFORMS SYNOPSIS DESCRIPTION SEE ALSO COPYRIGHT NAME HTTP::Request::Common - Construct common HTTP::Request objects SUPPORTED PLATFORMS Linux Solaris Windows SYNOPSIS use HTTP::Request::Common; $ua = LWP::UserAgent->new; $ua->request(GET 'http://www.sn.no/'); $ua->request(POST 'http://somewhere/foo', [foo => bar, bar => foo]); DESCRIPTION This module provide functions that return newly created HTTP::Request objects. These functions are usually more convenient to use than the standard HTTP::Request constructor for these common requests. The following functions are provided. GET $url, Header => Value,... The GET() function returns a HTTP::Request object initialized with the GET method and the specified URL. Without additional arguments it is exactly equivalent to the following call HTTP::Request->new(GET => $url) but is less cluttered. It also reads better when used together with the LWP::UserAgent->request() method: my $ua = new LWP::UserAgent; my $res = $ua->request(GET 'http://www.sn.no/') if ($res->is_success) { ... You can also initialize header values in the request by specifying some key/value pairs as optional arguments. For instance: $ua->request(GET 'http://www.sn.no/', If_Match => 'foo', From => '[EMAIL PROTECTED]', ); A header key called 'Content' is special and when seen the value will initialize the content part of the request instead of setting a header. HEAD $url, [Header => Value,...] Like GET() but the method in the request is HEAD. PUT $url, [Header => Value,...] Like GET() but the method in the request is PUT. POST $url, [$form_ref], [Header => Value,...] This works mostly like GET() with POST as the method, but this function also takes a second optional array or hash reference parameter ($form_ref). This argument can be used to pass key/value pairs for the form content. By default we will initialize a request using the application/x-www-form-urlencoded content type. This means that you can emulate a HTML POSTing like this: POST 'http://www.perl.org/survey.cgi', [ name => 'Gisle Aas', email => '[EMAIL PROTECTED]', gender => 'M', born => '1964', perc => '3%', ]; This will create a HTTP::Request object that looks like this: POST http://www.perl.org/survey.cgi Content-Length: 66 Content-Type: application/x-www-form-urlencoded name=Gisle%20Aas&email=gisle%40aas.no&gender=M&born=1964&perc=3%25 The POST method also supports the multipart/form-data content used for Form-based File Upload as specified in RFC 1867. You trigger this content format by specifying a content type of 'form-data' as one of the request headers. If one of the values in the $form_ref is an array reference, then it is treated as a file part specification with the following interpretation: [ $file, $filename, Header => Value... ] The first value in the array
Re: Getting data from external URL
Hello, > > I want to get data from an external url in my perl program (either thru > Embperl Execute or directly from perl). What I need is like this. > > There is a URL which gives some information in text format. I want to get > that into a variable or file using perl and using my own html templates, I > want to show that data. > > If anyone has done something like this, please let me know. > HTML::Embperl::ProxyInput maybe (ab)used to fetch the data from the remote host 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 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: Getting data from external URL
Apache::Request simply maps the Apache object into an Apache::Request object (I know that sounds like double-speak, but it's late), and adds some extra methods. I don't think that's what Vijay's original question is all about. What's needed is an HTTP::Request object. Look at LWP::UserAgent which brings together HTTP::Request and HTTP::Response objects and you also should grab HTTP::Headers. Like I said, it's late. I think that whole collection ball of wax is in libwww-perl available on CPAN. Other than the parsing and redisplaying that Vijay asked about, that's pretty much what a proxy server does, and there's a pretty detailed example or two in the Eagle book. As far as the parsing that response data, a mixture of good ole perl technique and HTML::Parser should be sufficient. -- Rob --On 08/25/00 21:33:14 -0700 Yann Ramin <[EMAIL PROTECTED]> wrote: > If you're in a modperl enviroment, and don't use CGI.pm, try using > Apache::Request (I'm not a fan of using Apache.pm for too much). Has > anyone ever considered making a wrapper for all the modules which get > back data from the request (roll Apache::Request, Apache::Cookie, etc, > into one)? Seems trivial. > > Yann > > > Vijay wrote: >> >> Hello, >> >> I want to get data from an external url in my perl program (either >> thru Embperl Execute or directly from perl). What I need is like >> this. >> >> There is a URL which gives some information in text format. I want >> to get that into a variable or file using perl and using my own html >> templates, I want to show that data. >> >> If anyone has done something like this, please let me know. >> >> Thanks >> >> Vijay > > -- > > > Yann Ramin[EMAIL PROTECTED] > Atrus Trivalie Productionswww.redshift.com/~yramin > Monterey High IT www.montereyhigh.com > ICQ 46805627 > AIM oddatrus > Marina, CA > > IRM Developer Network Toaster Developer > SNTS Developer KLevel Developer > > (yes, this .signature is way too big) > > "All cats die. Socrates is dead. Therefore Socrates is a cat." >- The Logician > >THE STORY OF CREATION > > In the beginning there was data. The data was without form and null, > and darkness was upon the face of the console; and the Spirit of IBM > was moving over the face of the market. And DEC said, "Let there be > registers"; and there were registers. And DEC saw that they carried; > and DEC seperated the data from the instructions. DEC called the data > Stack, and the instructions they called Code. And there was evening > and there was a maorning, one interrupt... >-- Rico Tudor > > William Safire's Rules for Writers: > > Remembe _ _ _ _ __ _ _ _ _ /\_\_\_\_\/\_\ /\_\_\_\_\_\ /\/_/_/_/_/ /\/_/ \/_/_/_/_/_/ QUIDQUID LATINE DICTUM SIT, /\/_/__\/_/ __/\/_//\/_/ PROFUNDUM VIDITUR /\/_/_/_/_/ /\_\ /\/_//\/_/ /\/_/ \/_/ /\/_/_/\/_//\/_/ (Whatever is said in Latin \/_/ \/_/ \/_/_/_/_/ \/_/ appears profound) Rob Tanner McMinnville, Oregon [EMAIL PROTECTED]
Re: Getting data from external URL
If you're in a modperl enviroment, and don't use CGI.pm, try using Apache::Request (I'm not a fan of using Apache.pm for too much). Has anyone ever considered making a wrapper for all the modules which get back data from the request (roll Apache::Request, Apache::Cookie, etc, into one)? Seems trivial. Yann Vijay wrote: > > Hello, > > I want to get data from an external url in my perl program (either thru > Embperl Execute or directly from perl). What I need is like this. > > There is a URL which gives some information in text format. I want to get > that into a variable or file using perl and using my own html templates, I > want to show that data. > > If anyone has done something like this, please let me know. > > Thanks > > Vijay -- Yann Ramin [EMAIL PROTECTED] Atrus Trivalie Productions www.redshift.com/~yramin Monterey High ITwww.montereyhigh.com ICQ 46805627 AIM oddatrus Marina, CA IRM Developer Network Toaster Developer SNTS Developer KLevel Developer (yes, this .signature is way too big) "All cats die. Socrates is dead. Therefore Socrates is a cat." - The Logician THE STORY OF CREATION In the beginning there was data. The data was without form and null, and darkness was upon the face of the console; and the Spirit of IBM was moving over the face of the market. And DEC said, "Let there be registers"; and there were registers. And DEC saw that they carried; and DEC seperated the data from the instructions. DEC called the data Stack, and the instructions they called Code. And there was evening and there was a maorning, one interrupt... -- Rico Tudor William Safire's Rules for Writers: Remembe
Getting data from external URL
Hello, I want to get data from an external url in my perl program (either thru Embperl Execute or directly from perl). What I need is like this. There is a URL which gives some information in text format. I want to get that into a variable or file using perl and using my own html templates, I want to show that data. If anyone has done something like this, please let me know. Thanks Vijay
Naked & in URL (was Re: Templating System)
"Keith G. Murphy" wrote: > Are there any browsers that do not actually handle the naked '&' > correctly? I confess that I also missed this, though I do understand > the reason: the first one's invalid HTML. It just seems to always work. Think about this: vs: Is the © in the first one the HTML entity for the copyright c-in-circle character or the query string argument seperater followed by an argument named 'copy'? Different browsers will make different interpretations depending on how well they adhere to the HTML spec, their known named entity list, and how hard they try to "do the right thing" with the erroneous naked ampersand. -- Devin Ben-Hur | President / CTO | mailto:[EMAIL PROTECTED] The eMarket Group | eMerchandise.com | http://www.eMerchandise.com 503/944-5044 x228 | "The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man." -- George Bernard Shaw
[OT] Apache::Benchmark URL
In the last two post I gave the wrong URL for the module. Sorry for that. So here is the right one. http://stason.org/works/modules/Apache-Benchmark-0.01.tar.gz I still cannot decide whether to call it HTTPD::Benchmark or Apache::Benchmark, therefore it's not on CPAN yet. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://perl.org http://stason.org/TULARC http://singlesheaven.com http://perlmonth.com http://sourcegarden.org
Location makes redirect and confuses CGI::url
Hello, this (longer) post deals with DirectoryIndex expansion, Apache::PerlRun (Registry gives the same) and CGI's url('-relative' => 1) method. The versions are 1.24, 2.68, 1.3.11 and 5.6.0+patches upto the end of May. In the end, there is a proposed patch for CGI.pm, but as I'm not sure if the behaviour is a bug or feature of mod_perl, I'm sending it to [EMAIL PROTECTED] as well, for comments. This config SetHandler perl-script PerlSetVar PerlRunOnce On PerlSendHeader On PerlHandler Apache::PerlRun and request for https://server/testing/ leads to redirect, where the interesting values (printed via %ENV) are PATH_INFO=/ PATH_TRANSLATED=/www/ REDIRECT_PATH_INFO=/ REDIRECT_PATH_TRANSLATED=/www/ REDIRECT_REQUEST_URI=/testing/ REDIRECT_SCRIPT_FILENAME=/www/testing REDIRECT_SCRIPT_NAME=/testing REDIRECT_URL=/testing/ REQUEST_URI=/testing/ SCRIPT_FILENAME=/www/testing/index.pl SCRIPT_NAME=/testing/index.pl This confuses CGI.pm, because $q->url('-relative' => 1) returns 'testing', not '' as would be expected. If I change the config to be SetHandler perl-script PerlSetVar PerlRunOnce On PerlSendHeader On PerlHandler Apache::PerlRun the redirect seems to be much less aggresive and the values are REDIRECT_URL=/testing/ REQUEST_URI=/testing/ SCRIPT_FILENAME=/www/testing/index.pl SCRIPT_NAME=/testing/index.pl There is no PATH_INFO value here, as well. And the PATH_INFO being set in the previous case is the cause of the trouble. I believe that the following patch fixes the problem -- from '/testing/', even if the path_info is '/', the relative address still needs to stay '', not 'testing', otherwise '/testing/testing' is achieved in the link. --- CGI.pm.orig Mon Jun 5 14:04:12 2000 +++ CGI.pm Mon Jun 5 14:04:48 2000 @@ -2183,6 +2183,7 @@ # and path if (exists($ENV{PATH_INFO})) { my $decoded_path = unescape($ENV{PATH_INFO}); + $decoded_path =~ s!^/!!; substr($script_name,$index) = '' if ($index = rindex($script_name,$decoded_path)) >= 0; } } else { Comments are gladly welcome. -- Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/ .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Re: URL rewriting & logging
Thanks. Apparently the problem is elsewhere, $c->user("user") works now, I don't know what I was looking at. Thanks everybody who answered. - Robert Thomas von Elling Skifter Eibner wrote: > > On Fri, May 26, 2000 at 09:55:12AM +0200, Robert wrote: > > I'm trying to use Eagle book-like URL rewriting to track sessions and > > I'd like to log session id in the 'user' field (so Analog can do all > > kind of usefull stats about sessions). I hoped I could just set 'user' > > throught Apache::Connection's user method, but it seems to be read-only. > > Is there any simple way to make Apache log some knowN string (say > > $ENV{SESSION_id}) to the user field? Or do I have to write complete > > LogHandler for it? Thanks for your help. > > I wrote a PerlTransHandler to allow access from a specific to a client when a >certain header was presenet (and had the right information) for a project at where I >work and for this I did set the "user" via Apache::Connection's user method. I have a >mod_perl 1.19 reference card from http://www.refcards.com/ which states that the >method is both read/writeable. > I use it like this: > my $c = $r->connection; > $c->user("user"); > > and it shows up in the log like this: > > 195.24.22.201 - user [25/May/2000:15:50:16 +0200] "GET /index.html HTTP/1.0" 304 - > > -- > Thomas Eibner
Re: URL rewriting & logging
On Fri, 26 May 2000, Robert wrote: > Hi, > > I'm trying to use Eagle book-like URL rewriting to track sessions and > I'd like to log session id in the 'user' field (so Analog can do all > kind of usefull stats about sessions). I hoped I could just set 'user' > throught Apache::Connection's user method, but it seems to be read-only. > Is there any simple way to make Apache log some knowN string (say > $ENV{SESSION_id}) to the user field? Or do I have to write complete > LogHandler for it? Thanks for your help. You can log anything in $r->notes with log_config using the %{}n notation. Say you put your session in $r->notes('SESSION' => $session). You would log it as %{SESSION}n This saved me from writing my own log handler. :-) -- -- Tom Mornini -- InfoMania Printing and Prepress
Re: URL rewriting & logging
On Fri, 26 May 2000, Robert wrote: > Hi, > > I'm trying to use Eagle book-like URL rewriting to track sessions and > I'd like to log session id in the 'user' field (so Analog can do all > kind of usefull stats about sessions). I hoped I could just set 'user' > throught Apache::Connection's user method, but it seems to be read-only. > Is there any simple way to make Apache log some knowN string (say > $ENV{SESSION_id}) to the user field? Or do I have to write complete > LogHandler for it? Thanks for your help. $r->auth_name($username); -- Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org http://xml.sergeant.org
Re: URL rewriting & logging
On Fri, May 26, 2000 at 09:55:12AM +0200, Robert wrote: > I'm trying to use Eagle book-like URL rewriting to track sessions and > I'd like to log session id in the 'user' field (so Analog can do all > kind of usefull stats about sessions). I hoped I could just set 'user' > throught Apache::Connection's user method, but it seems to be read-only. > Is there any simple way to make Apache log some knowN string (say > $ENV{SESSION_id}) to the user field? Or do I have to write complete > LogHandler for it? Thanks for your help. I wrote a PerlTransHandler to allow access from a specific to a client when a certain header was presenet (and had the right information) for a project at where I work and for this I did set the "user" via Apache::Connection's user method. I have a mod_perl 1.19 reference card from http://www.refcards.com/ which states that the method is both read/writeable. I use it like this: my $c = $r->connection; $c->user("user"); and it shows up in the log like this: 195.24.22.201 - user [25/May/2000:15:50:16 +0200] "GET /index.html HTTP/1.0" 304 - -- Thomas Eibner
URL rewriting & logging
Hi, I'm trying to use Eagle book-like URL rewriting to track sessions and I'd like to log session id in the 'user' field (so Analog can do all kind of usefull stats about sessions). I hoped I could just set 'user' throught Apache::Connection's user method, but it seems to be read-only. Is there any simple way to make Apache log some knowN string (say $ENV{SESSION_id}) to the user field? Or do I have to write complete LogHandler for it? Thanks for your help. - Robert
Re: Remote URL
>I want to build a web page dynamically with content from several >other web >sites. I need to be able to fetch the remote URL's content >into >variables. How do I do that? This really is not that difficult, and yes, lots of people certainly have done it. You have many options open to you, but the easiest (perhaps) would be to look into using the LWP::* series of modules. These modules have several methods for retrieving and parsing URL's, etc. You can return the result of an HTTP call and save the result as a variable. Also, you can use other methods to strip out HTML, etc. And this just touches the surface of what you can do. I would suggest reading "Web Client Programming with Perl", as well as all the LWP perldoc pages. But, if you cannot even get a simple program to work, your problem lies deeper than a misunderstanding of the tools available to you already. Perhaps if you posted your code in the most simple form in which it is failing, we can help. Jason Simms __ Get Your Private, Free Email at http://www.hotmail.com
Re: Remote URL
On Fri, 14 Apr 2000, Paul McCumber wrote: > I want to build a web page dynamically with content from several other web > sites. I need to be able to fetch the remote URL's content into variables. > How do I do that? > > For starters, I just have a module that just goes and gets a URL and writes > that URL back to the browser. Can't even get that to work. I think the > hardest thing for me is that there is just no way to debug it. Admittedly, > I'm new to this environment but I just getting killed. Very easy thing to > do in ASP but I want to use Perl and Apache and Linux. well, this isn't really mod_perl, just perl. if you're having trouble debugging (yes, mod_perl is a bit more of a challenge to debug, having to restart your server b/w code changes, unless you use StatINC), then i'd recommend writing your first iteration as a straight CGI script, using "strict" and all that good stuff. if it works properly, you could always run it (mostly) unchanged under Apache::Registry. for the fetching of remote web sites: have you tried LWP? very nice package. ky
RE: Remote URL
Take a look at Apache::ProxyStuff on CPAN. It mau already do what you want it do and if it doesn't it'll give you an idea of how you can do what you want to do. On 14-Apr-2000 Paul McCumber wrote: > I want to build a web page dynamically with content from several other web > sites. I need to be able to fetch the remote URL's content into variables. > How do I do that? > > For starters, I just have a module that just goes and gets a URL and writes > that URL back to the browser. Can't even get that to work. I think the > hardest thing for me is that there is just no way to debug it. Admittedly, > I'm new to this environment but I just getting killed. Very easy thing to > do in ASP but I want to use Perl and Apache and Linux. > > Somebody has to have done this. > > Paul -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems Mr. Scorpio says productivity is up 2% and it's all because of my motivational techniques, like donuts and the possibility of more donuts to come. -- Homer Simpson You Only Move Twice
Remote URL
I want to build a web page dynamically with content from several other web sites. I need to be able to fetch the remote URL's content into variables. How do I do that? For starters, I just have a module that just goes and gets a URL and writes that URL back to the browser. Can't even get that to work. I think the hardest thing for me is that there is just no way to debug it. Admittedly, I'm new to this environment but I just getting killed. Very easy thing to do in ASP but I want to use Perl and Apache and Linux. Somebody has to have done this. Paul
Re: self url
On Wed, 26 Jan 2000, Vladimir Ivaschenko wrote: > > Hello, > > Is there a way to get the URL of the current document in Embperl? > Sort of like $q->self_url in CGI.pm. from chapter 9 of wrapmod: If the URI argument is omitted, the I method will construct a fully qualified URI from B<$r> object, including the scheme, hostname, port, path and query string. Example: my $self_uri = Apache::URI->parse($r);