Re: RFC: Apache::Request::Forms (or something similar)
"Jeffrey W. Baker" wrote: On Thu, 18 May 2000, brian moseley wrote: On Thu, 18 May 2000, Autarch wrote: pretty slow if you build a string using .= instead of using smarter methods, like pushing strings onto an array and then joining it. You tried to sell me that when I was at CP, and I didn't buy it then either. This is a benchmark of .= versus join. 50 20-byte strings are joined: Concat: 2 wallclock secs ( 1.34 usr + 0.27 sys = 1.61 CPU) Join: 4 wallclock secs ( 3.63 usr + 0.19 sys = 3.82 CPU) .= concatenation is way faster. Also, building a 50-element array in Perl takes up vastly more memory than building a 1000-byte string. The string and the Perl process together require an RSS of 11MB, while the array and the Perl process eat an RSS of 51MB. seems very odd. ".=" copies the string every time, and then concatenates the new addition to the end. "join" may do something internally like that, but i'd expect it to be optimized. and so what? that's all moot when it comes to generating html; you push strings and then simply print: @table = (); loop { @tr = (); loop { ... push(@row,"td",$data,"/td\n"); } push(@table,"tr",@row,"/tr\n"); } ... print(@table,$str,$val,$other); (you could easily use more object-oriented CGI-like methods, of course...) no joining or concatenation needed. -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.
Re: Q: DBMS update framework for use within Apache::DBI?
"Bruce W. Hoylman" wrote: "Gunther" == Gunther Birznieks [EMAIL PROTECTED] writes: Gunther This first criteria seems a tad odd to me. What business Gunther scenario is there for this? The framework is to support an intranet time tracking application. The business rules of the system dictate there are no deletions of previously submitted time ... only inserts/updates. Therefore I can say without question that an existing time record will *always* exist (a modify), albeit in a potentially 'dirty' state (rule #2). Furthermore, if a particular time period has not been accounted for, i.e. no time record has been previously submitted, a default time record will be presented for modification, and subsequent submission (an insert). This is seamless to the client requesting the period. If there is no default time record available, then a 0-hour time record is presented for modification/submission (also an insert). need custom record locking? how about adding a field such as 'lock' which is set when a record is requested, so only one user can modify it? i.e. your script sends a flag to others who've requested a 'lock'ed record. i'd also put a timeout on it so that if a user quits his browser or gets distracted, his page gets updated to another location after freeing up the lock... -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.
Re: Oops Re: ANNOUNCE: mod_perl guide version 1.23
Stas Bekman wrote: On Sun, 14 May 2000, w trillich wrote: i noticed this in the html source of the new guide (this was on porting cgi to mod_perl): LINK REL=STYLESHEET TYPE="text/css" HREF="style.css" TITLE="refstyle" style type="text/css" !-- @import url(style.css); -- /style doubt this is what was supposed to show up in our browsers... looks like asp, or similar, isn't turned on. Why, this is all fine, the !-- -- are exectly in the JS, for old browsers. right, i grok that !-- -- hides it from older browsers; but i thought the CONTENTS of file "style.css" should be showing up there, instead of '@import...', until i (just now) learned of the '@rules' of css. but now, i'm thinking that you've got a redundancy there (maybe for good reason--i dunno). here's a sample i ran across at www.hwg.org/resources/faqs/cssFAQ.html: LINK REL=STYLESHEET HREF="main.css" TYPE="text/css" STYLE TYPE="text=css" !-- @import url(http://www.and.so.on.partial1.css); @import url(http://www.and.so.on.partial2.css); other statements -- /STYLE they link to 'main.css' and then import some others; you've linked to 'style.css' and then imported it again. and do you need to include the 'url()' gadget? maybe there's a way to put a hilite bar in the left margin this way...? tables may still be easier. hmm... Hmm, interesting. Do you have a code sample? testing this on netscape 4.7 gave me fits with 'font-family' in the 'pre' tag: it just wouldn't take (everything was always times-roman). so here's what i came up with: style type="text/css" !-- .box { background-color: #cc; /* border: 1pt; */ border-left-width: 12pt; border-style: solid; border-color: #99; margin: 1pt; padding: 9pt; } /* pre { == that'd be awful nice to keep frum munging the html background-color: #cc; border-color: #99; border-left-width: 5pt; margin: 1pt; padding: 9pt; font-family: courier,monospace,arial,sans-serif; == no-go! white-space: pre; } */ -- /style then, wrap your pre/pre tags into div class="box".../div tags: div class="box"pre#!perlbr exit 0;/pre/div maybe you can decode what i was doing wrong on the 'font-family' thing (or, maybe for code a monospace font isn't that crucial--only when lots-o-spaces are used to visually align clusters of assignments)... HTH :)
Re: newbie question - require
Brett Lee wrote: but with mod_perl, the info in the hash tables seems to be found "every other refresh" (which has me stumped). Would anyone be able to suggest a solution or reading material on this? don't forget to check your stuff out with single-process mode, via 'apachectl stop; apache -X'; if it's acting sporadically in your browser, it may be because you're talking to different child apache servers, each in its own state of affairs... http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it
Re: Apache::AutoIndex patch
"Alexei V. Barantsev" wrote: w trillich [EMAIL PROTECTED] writes: speaking of autoindex issues-- i can't get apache to display the HEADER or README files (above and below the tabular file listing), and when i posted my most recent question, someone else piped up and said they've got the same snag. I have both and all works right, options HeaderName and ReadmeName really set names of these files. Moreover, I use Apache::Autoindex with Apache::OutputChain to apply CSS to the directory index. MUCHO thanks for that tip! delightful! (i knew it must be possible--thanks!) From my /server-status Module Name: Apache::AutoIndexContent handlers: none aha--that's a perl gasdget, n'est-ce que pas? i'm using the standard mod_autoindex.c (see below). Configuration Phase Participation: Create Directory Config, Create Server Config Request Phase Participation: none Module Directives: IndexIgnore - a list of file names DirectoryIndex - one or more file extensions HeaderName - a list of file names ReadmeName - a list of file names FancyIndexing - Limited to on or off (superseded by IndexOptions FancyIndexing) IndexOrderDefault - {Ascending,Descending} {Name,Size,Description,Date} AddDescription - Descriptive text followed by one or more filenames IndexOptions - one or more index options Current Configuration: httpd.conf DirectoryIndex "index.html index.htm index.shtml index.phtml index.mhtml index.pl index.php3" IndexOptions FancyIndexing ScanHTMLTitles ReadmeName README HeaderName HEADER IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t mine's still broke... here's my /server-status Server Version: Apache/1.3.9 [snip] Module Name: mod_autoindex.c Content handlers: httpd/unix-directory Configuration Phase Participation: Create Directory Config, Merge Directory Configs Request Phase Participation: none [snip] IndexOptions IconsAreLinks FancyIndexing ReadmeName README HeaderName HEADER IndexIgnore .??* *~ *# HEADER* README* RCS
Re: Source Code Shows Up in IE But Not Netscape
Bri Carey wrote: When I display an .iphtml page in Netscape, everything seems to be fine. When I display it in IE (4.72), I get a plain text output of the source code, including html tags. Why this discrepancy? I've tried setting the default type to text/html in the httpd.conf file and that didn't seem to do the trick. I appreciate the input that I've received. I've also noticed that both browsers display the code, although they format the html properly, when I try to execute the script inside of a standard .html document. I know that's not the standard (embedded Perl should have .iphtml extensions - at least that's the way it seems to be). Yes, I have made the appropriate changes in the httpd.conf file: PerlModule Apache::ePerl Files ~ "/root/of/webmaster/area/.+\.html$" Options +ExecCGI SetHandler perl-script PerlHandler Apache::ePerl /Files You can see this now at http://www.uncricket.com/index1.html Thanks again for any input. Regards, Bri even though cliff said: I don't think you are using the Files directive properly. Try something like this: DirectoryMatch /root/of/webmaster/area/ FilesMatch ".*\.html?$" SetHandler perl-script PerlHandler Apache::ePerl Options +ExecCGI /FilesMatch /DirectoryMatch and he's probaly got something there--but if netscape is getting eperl-processed html and explorer is getting the source to the perl-bristled code, there's something very odd going on there. whether you use lynx or opera or icab, the browser should get what the server sends out, and -- UNLESS you have browser-specific settings somewhere -- they should ALL receive the exact same stuff. i.e. if you turn off eperl, then everyone will see the perl that bristles throughout your html. if it's on and working, then all browsers will get the resulting html markup. ...unless you have some browser-specific gizmo happening, which (if my fading gray cells are working) is possible in apache. [as a security measure, to hide the inner workings of our website, we use .htaccess frequently to enable eperl here and there while letting the user think everything is just a plain old html file, as in: # .htaccess settings file: Files {somePatternMaybe}.html SetHandler perl-script PerlHandler Apache::ePerl Options +ExecCGI /Files hopefully this will make it more difficult for black-hatted sniffers to know what's happening behind the scenes... now if we could only get apache to not identify itself in the "Server:" header...]
without Apache::Registry, redefined subs still?
redefined subs with perlrun? pertinent parts, from httpd.conf: #for running perl scripts PerlModule Apache::PerlRun #for running perl internally from within apache #PerlModule Apache::Registry ErrorDocument 401 /cgi-bin/noAccess.pl ScriptAlias /cgi-bin /usr/lib/cgi-bin/ Directory /usr/lib/cgi-bin order allow,deny allow from all Options -Indexes +ExecCGI /Directory # allow arbitrary *.perl files to be scattered throughout the site. FilesMatch "\.(pl|perl)" Options +ExecCGI SetHandler perl-script PerlSendHeader On PerlHandler Apache::PerlRun /FilesMatch from /var/log/apache/errors.log: Subroutine b redefined at /usr/lib/cgi-bin/noAccess.pl line 20. i thought that only happened with Apache::Registry...? -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.
schwartzian
from his webtechniques article a while back--(source code is available at www.webtechniques.com)... here's a slice from r.schwartz's quickie DBIlogger-- $r-push_handlers ( PerlLogHandler = sub { my $orig = shift; my $r = $orig-last; my @data = ( ht_time($orig-request_time, '%Y-%m-%d %H:%M:%S', 0), $r-get_remote_host, $r-method, # $orig-uri, #$r-header_in('Host') .# for virtual hosts? ($r-the_request =~ /^\S+\s+(\S+)/)[0], $r-connection-user, $r-header_in('Referer'), $r-header_in('User-agent'), $orig-status, $r-bytes_sent, ); ... } ); where would an intrepid innocent turn for details on what methods and/or fields are available to the PerlLogHandler in the passed arglist @_ array (okay, $_[0] or shift) ? apparently -last and -request_time and -status ..and $_[0]-last has submethods including get_remote_host, method, the_request, header_in, bytes_sent ..what else is available, and what's the documentation called?
Re: perl in configs /perl
sorry i haven't been clearer about this: with a few inserted debug statements (say, printing the string to my tty directly) i can tell that the perl code gets executed. but no apache settings are affected. ZERO effect on apache. doesn't act as if its done a damn thing. apache ignores it even though it executes. the only settings it goes by are the ones in the httpd.conf/srm.conf/access.conf files which existed before/after (independent of) this script being called. package Apache::ReadConfig; # in case that isn't set my $set = "END_SETTINGS"; VirtualHost xxx.yyy.zzz.qqq ServerAdmin webmaster\@$host DocumentRoot $docroot ServerName $host DirectoryIndex index # index.html index.cgi CustomLog $logroot/access.log common CustomLog $logroot/referer.log referer CustomLog $logroot/agent.log agent ScriptLog $logroot/scriptDebug.log @{[join "", map THIS, qw(/cgi-bin/ /cgi/)]} ScriptAlias $_ /usr/lib/cgi-bin THIS /VirtualHost END_SETTINGS Apache-httpd_conf($set); __END__ that's basically the script (with the variables filled in, inside a loop, of course). # apachectl configtest Syntax OK # apachectl graceful # so i go to my browser and try going to one of my virtual hosts: http://virtual1.myhost.com/ and instead of the files at the proper docroot, i get http://www.myhost.com/ files--i.e. apache has gotten no virtual host directive. none. so forget that i looked for useful data under /server-info and /perl-status... the fact that it matches the apache setup (i.e. IT'S WRONG) seemed to be a reasonably accurate report of a screwy situation. THE PERL CODE IS RUNNING, BUT *NOT* AFFECTING ANY APACHE SETTINGS. do i need to write the string to a file and then INCLUDE it in the httpd.conf file after the script runs? feels like i have issued a directive in access.conf that disables perl sections (or 'do "file.pl"') scripts for taking any effect. or, there's a directive within the perl code that's missing. help!
Re: Perl Section...
while($domain = $sth-fetchrow_array) { $PerlConfig .= "CONFIG"; VirtualHost $ipAddr ServerName www.$domain ServerAdmin webmaster@$domain ServerAlias $domain DocumentRoot $baseDir/www.$domain/htdocs/ /VirtualHost CONFIG } doesn't $sth-fetchrow_array() return a reference to an array, instead of a simple scalar? $row = $sth-fetchrow_array; foreach $col ( @$row ) { ... } ?
Re: perl in configs /perl KAPUT
In a running httpd you can see how you have configured the CPerl sections through the URI L/perl-status|debug/Apache_Status_Embedded_Inter, by choosing IPerl Section Configuration from the menu. In order to make this item show up in the menu you should set C$Apache::Server::SaveConfig to a true value. When you do that the IApache::ReadConfig namespace (in which the configuration data is stored) will not be flushed, making configuration data available to Perl modules at request time. i must be thick today. not only can i get no effect from perldo "file.pl"/perl but http://localhost/perl-status|debug/Apache_Status_Embedded_Inter gives me 404 not found. /perl-stat by itself works fine; from there i can tell the PerlRequire (actually perldo "file"/perl) has been run. i just want a couple simple virtual hosts on one ip number. the perl code (under "package Apache::ReadConfig;" of course) does run (i can tell by having it display the same string it sends to Apache-httpd_conf()) but doesn't change any apache settings. if this helps, here's the display from http://localhost/perl-status?ApacheReadConfig . . . hashes ApacheReadConfig::Directory, ApacheReadConfig::DirectoryMatch, ApacheReadConfig::Files, ApacheReadConfig::FilesMatch, ApacheReadConfig::Limit, ApacheReadConfig::Location, ApacheReadConfig::LocationMatch, ApacheReadConfig::VirtualHost ios ApacheReadConfig::TTY any clues?
Re: perl in configs /perl
Stas Bekman wrote: I still don't know your name, so I'll just use 'you' :) or trillich (or even 'will' on my birthday). First, please keep the replies posted to the list. We don't want to answer something more than once, when it goes to the list, someone will answer you and it'll be stored in the archive for other people use. So please repost your reply to the list. whoops. 'reply' button is smarter than i am, at times. BTW, please don't refer to a file with a full path on your system just because it was installed there. It confuses people. The second file is at the mod_perl dist at mod_perl-x.xx/eg/perl_sections_2.txt . you've obviously not been sitting over my shoulder lately! i have spent days looking for examples referenced like that. some are under /usr/src which i don't have installed; others are under perl library module directories, others are in /usr/doc. talk about confusion! (in addition, /eg/ seems to be a low-keystroke way to refer to the actual directory, which is actually /examples/. very confusing.) plus, if i sought mod_perl i might not run into apache_mod_perl... so i figure it's easier for someone to decode a full pathname than to imagine and hope and conjure out of thin air which path to append... It's incorrect! The files are located in the *mod_perl distribution*, and they are located just where I've said and not where your binary distribution has happen to include them. You have been looking in all wrong places, you could ask the list first and even better to search the mailing list archives. i try to do some background work before dumping my troubles on other unsuspecting folk. but lemme tellya, looking for the precise configuration file for the precise command is a lot more taxing than just opening a control panel and clicking some checkboxes and menus... so how does one find out what the distribution pathname is when all one has to go by is the installed set of files? (lemme rephrase--the installed fileset is all i know of, to go by.) and still apache ignores my perl 'Apache-httpd_conf($c);'...