Re: Client capabilities
HTTP defines an 'Accept' header. Joel Palmius wrote: Is there a mod_perl API (or some other standard way) to determine what a client web browser is capable of displaying? (images, tables, plugins...) I am developing a web questionnaire system in mod_perl (1.26) and I'm thinking about maybe dividing the display code into different levels depending on what the client can handle (no graphics no css for lynx-like browsers, stylesheets and images for most browsers, and plugin extensions for more advanced browsers). Only, I can't figure out how to determine if a client is capable of displaing an image, a stylesheets or (as an example) a J2RE 1.4 java-plugin compatible applet. When reading the HTTP_ACCEPT environment variable, both lynx and mozilla say they can handle image/png, while in practise lynx cannot display that. // Joel -- Constant shallowness leads to evil. --- Martin Haase-Thomas |Tel.: +49 30 43730-558 Software Development| [EMAIL PROTECTED] ---
Re: [Q maybe OT] forward
Hi Perrin, first of all please excuse my late answer - lots of things in mind to care about, as I'm hopefully close to releasing the 0.2 version of the serverpage implementation (and besides I urgently need a new job, too). But thank you for your presice statement, that is exactly what I needed, and you helped me a lot. I think that it'll be a consice offer to the programmer if I declare 'redirect', 'moved', and 'forward' to be events on which enclosing handlers have to react approximately. Which means that a 'redirect' should lead to a 301 response, a 'moved' to a 302, and a 'forward' to whatever. But these are in fact not of the server page's concerns. Would you agree with this approach? regards M Perrin Harkins wrote: Martin Haase-Thomas wrote: forwarding is a term that i borrowed from the JSP concept - which i'm currently trying to implement in perl. JSP forward is directly equivalent to an internal redirect. It's just an include that doesn't return. In short, it's a GOTO statement. Thank you Sun. - Perrin -- Constant shallowness leads to evil. --- Martin Haase-Thomas |Tel.: +49 30 43730-558 Software Development| [EMAIL PROTECTED] ---
Re: [Q maybe OT] forward
Hi Andrew, thanx for the idea to have a look at Apache::ASP. I took that look meanwhile and to me that seems to be an overhead. Maybe I'm naive, because it wasn't much more than a glance, but the code copes with things a server page *never* has to worry about, things like session handling and so on. Apache::ASP looks more like a Java class packet (you know: one of these endless stories that java people use to wrap their code in - but I don't linme java, as you already may assume...) than a perl module. In my understanding a server page is nothing but a document that has to be processed by the server, and the result of this process is sent to the client. All the other aspects of a web application, like sessions or cacheing or th like ar not what the page itself has to care about. It either knows the respective values, because the handler passed them through to it - or it doesn't. But maybe I'm bragging now - wait a few weeks and we'll hopefully both see whether I'm right or not. Kind regards Martin Andrew Ho wrote: Hello, MHTforwarding is a term that i borrowed from the JSP concept - which i'm MHTcurrently trying to implement in perl. PHJSP forward is directly equivalent to an internal redirect. It's just PHan include that doesn't return. In short, it's a GOTO statement. Thank PHyou Sun. This concept is supported better in Apache::ASP, where you can just pass arguments directly to the target page. If you use the internal_redirect() method, you have to use notes(), pnotes(), globals, or some other cumbersome method to pass arguments. 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 -- -- Constant shallowness leads to evil. --- Martin Haase-Thomas |Tel.: +49 30 43730-558 Software Development| [EMAIL PROTECTED] ---
[Q maybe OT] forward
Hi all, maybe this is going to be a little off topic, but it won't take you much time: I am quite certain that recently I saw a server response code concerning forwarding. It may have looked like HTTP_DOCUMENT_FORWARDED or anything alike. Silly enough I can't recall where I saw it (or whether I even just dreamt it), so my questions are: 1. Has anyone ever seen that ghost before? 2. If I'm right, what is the correct memnonic, what's its code - and: where an I find it? perl5.6.1-Apache::Constants::Exports.pm doesn't mention it. Hope it wasn't all just a dream... thx M -- http://www.meome.de --- Martin Haase-Thomas |Tel.: +49 30 43730-558 meOme AG|Fax.: +49 30 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: [Q maybe OT] forward
;) you're right. meanwhile i found out that it seems to have something to do with proxies. forwarding is a term that i borrowed from the JSP concept - which i'm currently trying to implement in perl. it means nearly the same as redirect, but without telling the client. (as far as i've understood it do far. maybe it's just luxury and i'm going to leave it out.) thank you both for your clues and guesses. i think the best idea will lie in informing the programmer that there has been some sort of an 'event' while processing the page - and leave the uncomfortable decision what do to with this 'event' up to him... ... whistling ... :) M Per Einar Ellefsen wrote: At 07:44 24.04.2002, Martin Haase-Thomas wrote: Hi all, maybe this is going to be a little off topic, but it won't take you much time: I am quite certain that recently I saw a server response code concerning forwarding. It may have looked like HTTP_DOCUMENT_FORWARDED or anything alike. Silly enough I can't recall where I saw it (or whether I even just dreamt it), so my questions are: 1. Has anyone ever seen that ghost before? 2. If I'm right, what is the correct memnonic, what's its code - and: where an I find it? perl5.6.1-Apache::Constants::Exports.pm doesn't mention it. Hope it wasn't all just a dream... Must have been :) Apache::Constants doesn't mention anything about FORWARD, neither does httpd.h. There is DOCUMENT_FOLLOWS, but that's got nothing to do with it. What do you mean by forwarding anyway? Like redirect? -- http://www.meome.de --- Martin Haase-Thomas |Tel.: +49 30 43730-558 meOme AG|Fax.: +49 30 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: Unsubscribe me please [KILL THIS THREAD]
:) giggle... Perrin Harkins wrote: Please kill this thread. Some people are not good at dealing with mailing lists. At least this guy was polite. - Perrin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
[OT?] What exactly is forwarding?
Hi all, I know this is not perfectly the right list for my topic, but before subscribing to another for just one question... forgive me if I'm going to be boring. Even more, because my question is rather philosophical. If you consider JSPs, there is a tag called jsp:forward page=... /. My question is: how do I have to understand 'forward'? The java documentation isn't that verbose, and I can imagine two possible meanings: 1. Forwarding is some sort of an internal redirect to the servlet engine which the browser will not be informed of. From this point of view forwarding will be nearly the same as a dynamic include. 2. Forwarding is the same as a redirect. Maybe a superfluous question for some of you, for me it isn't actually. So, if anyone knows an answer - or knows the number of the RFC I'll find the information: you're welcome! Thanx a lot in advance Martin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: [OT] Thought for the Day
Should we tell the yellow press in the end? ;) Martin Carlos Ramirez wrote: I wrote an article about Apache::Motd for UNIX SysAdmin magazine (March 2001 issue). Here's the link: http://www.samag.com/documents/s=1153/sam0103a/ -Carlos Geoffrey Young wrote: John Eisenschmidt wrote: Sinister, aren't I? G For the record I did email directly an explanation of what -o does and to exclude it for clean fortunes, and that it's more fun to make your own. I have quotes from all the Dogma movies that are called within my mod_perl index.html on my website. =) Suddenly this thread is on-topic. everyone might want to look at Apache::MOTD - it's a similar idea to the Unix motd functionality whose implementation is quite clever. --Geoff -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: [OT?] What exactly is forwarding?
Thank you both. I thought so: it is one of these typical JSP features - but now it works in perl, too ;) Cheers Martin Perrin Harkins wrote: Paul Lindner wrote: You'll find that $r-internal_redirect() is the mod_perl equivalent. Also Apache::ASP containts the Transfer() method which accomplishes the same thing. Personally, I always thought this was sort of a strange part of JSP. It really shows the page-centric thinking behind it. Doing a forward is essentially a GOTO statement for JSP. When I write mod_perl apps, I never feel the need for that sort of thing, with so many better ways to accomplish things (OO, method calls, dispatch tables, template includes). - Perrin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
[OT] redirect STDOUT
Hi all, instead of committing suicide after having tried and searched for all of the day now i'd rather ask you: does anyone know how to redirect STDOUT into a scalar variable, so that a 'print anything' will not appear on STDOUT, but only in my buffer? desperate Martin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: How to invoke the save dialog box when clicking in the link, which is generated by PERL script.
try: [EMAIL PROTECTED] M. SubbaReddy wrote: Hello Gurus, I am very sorry, if this post is on wrong list. I have a perl script, which gives dynamic page with search files list. Pdf and text files are displaying in browser, when clicking in the link of file. But, I want to save on to disk, instead displaying in browser. Like: On click a hyperlink, we can invoke the add to Favorite window using... document.write ( a href='javascript:window.external.AddFavorite(url, description)' ..) Similarly, how do I invoke the Save Target As dialog box. Instead I want to save on to disk on click the hyperlink. = a href=javascript:window.external.SaveAs('http://books.com/js.pdf',filename) js book/a Kindly, please give me hint. Thanks in advance. Regards, ~ SubbaReddy .M Sr. Programmer, Frontlinesoft, Hyderabad http://www.frontlinesoft.com Ph: 91-40-3392147, 3391683 (O) ICQ: 56093095 -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
[WOT] Opcode/ Safe
Hi all, maybe this is really far WOT, but one shouldn't give up hope, as we all know... Does anyone have experience with Opcode and Safe? The thing is that I have to create my own secure namespace for some reasons - and don't know how to do. What does not work is the following: #!/usr/bin/perl -w use Safe; my $page = new Safe (huhu); $page-deny qw(:base_io :base_orig :base_thread :filesys_read :sys_db :filesys_open :filesys_write :subprocess :ownprocess :still_to_be_decided :dangerous); $page-permit qw(print ref entereval); $page-deny qw(rand srand); $page-reval (sysopen '/bla/blub.html' || kill 15, 1906); Anyone with an idea? btw: funny things will happen if you type 1 instead of 1906 ... :) regards Martin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: [WOT] Opcode/ Safe
Ok, forget my post, her's the answer: #!/usr/bin/perl -w use Safe; my $page = new Safe (huhu); my $opset = Opcode::opset qw(:base_io :base_orig :base_thread :filesys_read :sys_db :filesys_open :filesys_write :subprocess :ownprocess :still_to_be_decided :dangerous); $page-deny(Opcode::opset_to_ops($opset)); $page-permit qw(print ref ); $page-deny (qw(rand srand)); $page-reval (eval \ print 'huhu' \); print $@.\n; Martin Haase-Thomas wrote: Hi all, maybe this is really far WOT, but one shouldn't give up hope, as we all know... Does anyone have experience with Opcode and Safe? The thing is that I have to create my own secure namespace for some reasons - and don't know how to do. What does not work is the following: #!/usr/bin/perl -w use Safe; my $page = new Safe (huhu); $page-deny qw(:base_io :base_orig :base_thread :filesys_read :sys_db :filesys_open :filesys_write :subprocess :ownprocess :still_to_be_decided :dangerous); $page-permit qw(print ref entereval); $page-deny qw(rand srand); $page-reval (sysopen '/bla/blub.html' || kill 15, 1906); Anyone with an idea? btw: funny things will happen if you type 1 instead of 1906 ... :) regards Martin -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: Use of uninitialized value. with no line number in error log
perl sighandlers require the signal as their first argument. so i assume that it may not be a good idea to call Carp::cluck(), as any of the Carp methods expect strings. try typing as follows: $SIG{WARN} = sub { Carp::cluck (received signal shift() at line.__LINE__) }; martin Tim Noll wrote: Stas Bekman wrote: I know this is a pretty generic question, but if nobody knows a quick answer, I can get more specific in a later post. Under Apache 1.3.22 / mod_perl 1.26, even while using $SIG{__WARN__} = \Carp::cluck, I keep getting Use of uninitialized value. in the Apache error log, with absolutely no line number or back trace or anything else. Does anybody know what might cause this? Thanks. Where did you set $SIG{__WARN__}? Try in startup.pl as early as possible. It's set in startup.pl, which is basically a modified version of the example from perl.apache.org/guide. It works beautifully for every other error I've come across, which is why this one is so curious. As I mention in my earlier follow-up to my own post, I eventually traced the problem to an incorrect driver string in DBI-connect. However, that doesn't explain (to me anyway) why I wasn't getting more detail in the error log. Perhaps I'll delve into DBI.pm, unless someone can explain this to me beforehand. -Tim -- http://www.meome.de -- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] --
Re: Anyone for JavaScript question
The simple onUnload() construction will not work. You will have to open a new browser window on unload displaying the output of your server program. martin Medi Montaseri wrote: I know this is off topic, but I thought someone could use a break... Given a page called xyz.html, I want to measure the amount of time a user spent on this screen (or page) along with other usability metrics. So I figured I'll use JavaScript since its running the entire time the page is up. Then I decided to use onload() and onunload() events to determine start and end of the session. The onload() part is easy. However when onunload() event happens, I need to execute a server side program and feed it the data that was collected. So I figured I setup a dumy form and invoke form.submit() onUnload. Would this work or is there a better method. I also thought about a redirect followed by another rediect to where the user wanted to go, but that gets too browser dependent and I don't like it when others hijak my browser. -- - Medi Montaseri [EMAIL PROTECTED] Unix Distributed Systems EngineerHTTP://www.CyberShell.com CyberShell Engineering - -- http://www.meome.de -- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] --
Re: [OT] Re: Anyone for JavaScript question
hi nigel, i never tried aou JSRS before, so i can't judge about it. but posting the data to a hidden frame might not work on an unload event. imagine the user types in another url and löeaves the whole frameset. but now we're running far WOT ... :) martin Nigel Hamilton wrote: Hi Martin, You could try posting the form to a hidden frame or you could use Javascript remote scripting (JSRS) to communicate the onUnload event to your server. Nigel -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
Re: Use of uninitialized value. with no line number in error log
you're right, i forgot about those two perl signals. ashamed martin Stas Bekman wrote: Martin Haase-Thomas wrote: perl sighandlers require the signal as their first argument. so i assume that it may not be a good idea to call Carp::cluck(), as any of the Carp methods expect strings. try typing as follows: $SIG{WARN} = sub { Carp::cluck (received signal shift() at line.__LINE__) }; Sorry Martin, but this is incorrect. There is no signal SIGWARN. $SIG{__WARN__} and $SIG{__DIE__} are special perl signal handlers, which accept the string as the first argument (actually expect a list). This has no effect: perl -MCarp -le '$SIG{WARN} = sub { Carp::cluck (received signal shift() at line.__LINE__) }; warn doh, doh' dohdoh at -e line 1. While this does: perl -MCarp -le '$SIG{__WARN__} = sub { Carp::cluck (received signal shift() at line.__LINE__) }; warn doh, doh' received signal shift() at line1 at -e line 1 main::__ANON__('dohdoh at -e line 1.^J') called at -e line 1 The Carp::cluck trick is correct, unless someone somewhere redefines $SIG{__WARN__}. martin Tim Noll wrote: Stas Bekman wrote: I know this is a pretty generic question, but if nobody knows a quick answer, I can get more specific in a later post. Under Apache 1.3.22 / mod_perl 1.26, even while using $SIG{__WARN__} = \Carp::cluck, I keep getting Use of uninitialized value. in the Apache error log, with absolutely no line number or back trace or anything else. Does anybody know what might cause this? Thanks. Where did you set $SIG{__WARN__}? Try in startup.pl as early as possible. It's set in startup.pl, which is basically a modified version of the example from perl.apache.org/guide. It works beautifully for every other error I've come across, which is why this one is so curious. As I mention in my earlier follow-up to my own post, I eventually traced the problem to an incorrect driver string in DBI-connect. However, that doesn't explain (to me anyway) why I wasn't getting more detail in the error log. Perhaps I'll delve into DBI.pm, unless someone can explain this to me beforehand. -Tim -- http://www.meome.de --- Martin Haase-Thomas | Tel.: 030 43730-558 meOme AG| Fax.: 030 43730-555 Software Development| [EMAIL PROTECTED] ---
[Q] Apache::File-new
Hi, I searched in the book, I searched in the FAQs - no I ask u: Does Apache::File-new start a subrequest? There are some mystical lines in my rewrite_log, which might come from there. Thanx a lot Martin
Re: [Q] Apache::File-new
) applying pattern '^(.*)_jsp(.*)$' to uri '/67567' 192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (1) pass through /67567 Lots to read I know. Hope you'll have the patience. Many thanx in advance, best regards Martin Geoffrey Young wrote: [EMAIL PROTECTED]"> Martin Haase-Thomas wrote: Hi,I searched in the book, I searched in the FAQs - no I ask u:Does Apache::File-new start a subrequest? no. it is merely a layer over Perl's file IO methods (Perl_do_openfrom what I can see). There are some mystical linesin my rewrite_log, which might come from there. that seems strange. maybe post the lines if they are causing yougrief..HTH--Geoff
Re: Apache::DBI
(doesApache::DBI overload the DBI methods?) No, it doesn't. It uses Apache and DBI. Did you install the package via the "Makefile.PL" stanza? Maybe you should just install it another time. On the other hand, Apache::DBI doesn't export anything. Try calling it with the package name explicitly. kind regards Martin Marty J. Rogers wrote: [EMAIL PROTECTED]"> I had tried that, with the same result. (doesApache::DBI overload the DBI methods?) Fullerror is as follows. Again, any help is _highly_appreciated.Marty[error] Can't locate object method "connect_on_init" via package "Apache::DBI" at /etc/httpd/conf/startup.pl line 28.Compilation failed in require at (eval 14) line 1.Syntax error on line 1276 of /usr/local/apache/conf/httpd.conf:Can't locate object method "connect_on_init" via package "Apache::DBI" at /etc/httpd/conf/startup.pl line 28.Compilation failed in require at (eval 14) line 1.--On Tue, 12 Feb 2002 08:44:12 Martin Haase-Thomas wrote: Marty J. Rogers wrote: [snip]From httpd.conf:PerlModule Apache::DBI CGI DBD::mysql \Apache::AuthenDBIPerlRequire /path/to/startup.plAlias /perl/ /path/to/perlPerlModule Apache::RegistryLocation /perlSetHandler perl-scriptPerlHandler Apache::RegistryOptions ExecCGIallow from allPerlSendHeader On/Locationand from startup.pl:use DBI(); use Apache::DBI(); # !! :) use DBD::mysql();...DBI-connect_on_init("DBI:mysql:dbname", "user","pass", {Options here}Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com
Re: Apache::DBI
Marty J. Rogers wrote: [snip] From httpd.conf: PerlModule Apache::DBI CGI DBD::mysql \ Apache::AuthenDBI PerlRequire /path/to/startup.pl Alias /perl/ /path/to/perl PerlModule Apache::Registry Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader On /Location and from startup.pl: use DBI(); use Apache::DBI(); # !! :) use DBD::mysql(); . . . DBI-connect_on_init(DBI:mysql:dbname, user,pass, {Options here} Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com
QUESTION
Hi all, I hope there'll be someone here to help we with a mod_perl prob, of which I thought first it wouldn't be one. I refer to the "Writing Apache Modules" book by Stein/MacEachern. The prob is quite simple: I have to redirect certain requests under certain conditions to another URL (and please believe me: I tried with mod_rewrite, this way seems to be more efficient). I'm using Apache 1.3.22 on Debian Linux 2.4.17. These are the lines from my httpd.conf: PerlFreshRestart On PerlTaintCheck On PerlSetEnv SHORTNAMES /etc/apache/shortnames.txt PerlAddVar PROJECT_DOCUMENT_ROOT /home/disp05/app/fn/ PerlRequire /usr/local/sbin/appstart Location / SetHandler perl-script PerlHandler Apache::StaticServer /Location The stanza in StaticServer.pm that fails is: if ($redirect = $shortnames-get($fname, WAIT, 1)) { if ($redirect !~ /$r-server()-server_hostname/) { $r-content_type('text/html'); $r-header_out ( Location = $redirect ); $log-debug($redirect); return REDIRECT; } ... } $shortnames is an Apache::SharedMem segment, containing a vast amount of shortnames as keys and the corresponding URLs as values. The funny thing is now, that although I do everything exactly as I find it in the book on p.125 (content_type, header_out, REDIRECT), I get pure nonsense. This is what a libwww-perl client displays when I try to access the address: 500 (Internal Server Error) unexpected EOF before status line seen Client-Date: Wed, 06 Feb 2002 13:40:25 GMT This is what I find in access_log: 192.168.255.75 - - [06/Feb/2002:14:46:24 +0100] "GET /psycho HTTP/1.0" 200 - "-" "libwww-perl/5.50" And this is what stands in error_log: [Wed Feb 6 14:46:24 2002] [debug] /usr/local/share/perl/5.6.1/Apache/StaticServer.pm(45): [client 192.168.255.75] http://www.domain.de/app/fn/portal_welcome_jsp/52329.html The error log proves that the second if() matches, as the entry comes from my $log-debug(...). Has anyone got an idea? I'm close to depression -;) Many thanx in advance Martin