geoff's Journal http://use.perl.org/~geoff/journal/ geoff's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:03:17+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 geoff's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~geoff/journal/ still kicking after 7 years... http://use.perl.org/~geoff/journal/39105?from=rss apparently, the <a href="http://www.modperlcookbook.org/">mod_perl cookbook</a> appears in <a href="http://www.youtube.com/watch?v=HyxIrfjla88">the new Cracker video</a>. thanks to <a href="http://use.perl.org/~perigrin/">perigrin</a> for the discovery. geoff 2009-06-09T17:38:25+00:00 journal please don't re-spam me http://use.perl.org/~geoff/journal/36328?from=rss have email administrators not figured out yet that sending the From address "the mail you sent was spam" mails just doubles the amount of spam traffic? everyone knows the From address probably didn't originate the mail, right? have we learned nothing over the past, what, 9 years? geoff 2008-05-05T12:54:43+00:00 journal "it's just..." http://use.perl.org/~geoff/journal/35180?from=rss I was in a meeting yesterday where a seasoned but non-technical person was surprised that the project at hand involved a substantial amount of re-coding. "I thought it was just..." the sentence began, which then continued (in my mind) as "completely re-thinking $concept and normalizing $concept data across 38 new tables instead of the current 5" but sounded like "switching around a few tables" to everyone else.<br> <br> I've worked with lots of non-technical folks over the years, some good, many bad, and this person is one of the good ones, so I found it amusing rather than irksome. but, for the record...<br> <br> there is no such thing as "it's just..." in software engineering anymore. at least not for mature applications with an established userbase where real money is involved. geoff 2007-12-21T14:22:39+00:00 journal on garbled profiles http://use.perl.org/~geoff/journal/34562?from=rss anyone who has used <code>dprofpp</code> has seen entries like this:<blockquote><div><p> <tt>Garbled profile, missing an enter time stamp at<nobr> <wbr></nobr>/usr/bin/dprofpp line 785, &lt;fh&gt; line 144174.</tt></p></div> </blockquote><p>or</p><blockquote><div><p> <tt>Modification of non-creatable array value attempted, subscript -1 at<nobr> <wbr></nobr>/usr/bin/dprofpp line 679, &lt;fh&gt; line 142590</tt></p></div> </blockquote><p>ungarbling a profile is a lesson in patience and rote: you go down to the line in question, figure out what sub it's talking about (the number at that line), go to the top of the file, grep for that number, find the subroutine it's talking about, add that sub to your ignore list, lather, rinse, repeat until the problems go away.<br> <br> ugh<br> <br> while overloaded subroutines are notorious for this behavior, they are easy to weed out via a simple code scan. but once you remove the low-hanging fruit, it's a chore to ungarble a profile if your codebase is anything more than something very simple. and, for some reason, it always seems to boil down to DBI-based calls once I get to the bottom of things.<br> <br> well, this morning I decided enough was enough, I'm going to figure this out.I generally don't care about specific, low-level <code>DBI</code>-ish things - the amount of time (and number of calls) to <code>fetch()</code> is <b>much</b> more important to see than what <code>DBI</code> is doing under the hood in that mire of package madness. so, using a lot of verbose <code>Devel::Profiler</code> tracing and some moxy, I was able to add these packages to by <code>bad_pkgs</code> entry:</p><blockquote><div><p> <tt>&nbsp; DBD::_::st<br>&nbsp; DBD::_::db<br>&nbsp; DBD::st<br>&nbsp; DBD::db<br>&nbsp; DBI::st<br>&nbsp; DBI::db<br>&nbsp; DBI::dr)</tt></p></div> </blockquote><p>which hides low-level <code>DBI</code> calls from the profiler but not those from specific drivers (which contain enough of the database overhead to be interesting). so, with my profiling back in order, I can see all the stuff I'm interested in, including entries like</p><blockquote><div><p> <tt>&nbsp; 1.31&nbsp; &nbsp;0.293&nbsp; 0.293&nbsp; &nbsp;2365&nbsp; &nbsp;0.0001 0.0001&nbsp; DBD::mysql::st::execute<br>&nbsp; 1.02&nbsp; &nbsp;0.229&nbsp; 0.229&nbsp; &nbsp;4942&nbsp; &nbsp;0.0000 0.0000&nbsp; DBD::mysql::st::fetch</tt></p></div> </blockquote><p>anyway, I hope this helps some of you out there. happy profiling<nobr> <wbr></nobr>:)</p> geoff 2007-09-28T15:07:23+00:00 journal Devel::Profiler::Plugins::Template http://use.perl.org/~geoff/journal/33572?from=rss after sitting in my<nobr> <wbr></nobr><code>/devel</code> directory for a while, I finally released <code>Devel::Profiler::Plugins::Template</code> to CPAN yesterday.<br> <br> <a href="http://search.cpan.org/dist/Devel-Profiler-Plugins-Template/">http://search.cpan.org/dist/Devel-Profiler-Plugins-Template/</a> geoff 2007-06-21T15:36:27+00:00 journal making DBI writes no-ops http://use.perl.org/~geoff/journal/31897?from=rss one of our databases consists of mysql myisam tables, which don't have transactions so you can't rollback. this makes debugging and 'dry-run' modes very difficult. one of my coworkers suggested DBD::NullP but that doesn't quite fit the bill - I want to pull data, inspect it, but no commit changes...<br> <br> what I really need is some DBD driver that intercepts write statements (UPDATE, REPLACE, etc) and turns them in to no-ops. DBD::Proxy and/or DBD::ProxyServer seems to <i>almost</i> get me there, but I don't feel like I should have to go through a complex acl-style process for all my code - I should be able to swap out the driver and it should all just work. so, has anyone done anything like this? I'm contemplating writing something like DBD::NullWrites, which should be relatively simple once I get my head around the DBD API. and after figuring out whether I can make it generic to apply to any read-front-end (DBD::Oracle for reads, DBD::NullWrites for writes, etc). pointers from folks who have ventured into DBD:: space appreciated<nobr> <wbr></nobr>:) geoff 2006-12-13T13:58:35+00:00 journal on hope... http://use.perl.org/~geoff/journal/30251?from=rss for those of us that can't figure ourselves out quite yet <a href="http://www.wired.com/wired/archive/14.07/genius.html">there might be hope</a> geoff 2006-07-11T15:52:20+00:00 journal you can find anything http://use.perl.org/~geoff/journal/30192?from=rss so I'm working on my oscon slides, which this time involve quite a few screenshots. unfortunately, it seems that print screen doesn't capture the cursor, so I need to gimp-in my firefox hand if I want to illustrate clicking on a link. fine... if I can find the hand image on my filesystem.<br> <br> then I come across <a href="http://mail.gnome.org/archives/gnome-doc-list/2006-January/msg00004.html">this gem</a>. the internet is great. geoff 2006-07-06T18:00:35+00:00 journal "did you test that?" http://use.perl.org/~geoff/journal/29840?from=rss I've decided that I'm going to start a new trend. I will no longer answer "yes" when someone asks "did you test it?" unless I can point to unit tests. instead, my response will be "I poked it and it seemed to work, but it doesn't have tests."<br> <br> if we all start doing that maybe people will start to understand that tests you can point to count for a lot, while a few mouse clicks really don't.<br> <br> feel free to join me<nobr> <wbr></nobr>:) geoff 2006-06-08T15:20:48+00:00 journal API overkill http://use.perl.org/~geoff/journal/29409?from=rss although I'm probably the last person on the internet to do so, the other day I started cross-posting my personal photos to flickr. of course, didn't want to do anything by hand, so I went off to CPAN looking for an API. there were a few to choose from, but <code>Flickr::Upload</code> caught my attention as being somewhat simple... but the process that followed was anything but - register for an API key from flickr, figure out this auth key thingy (which I still haven't), the download a slurry of dependencies (which included an <code>Acme::</code> module, and which ended when I saw <code>CPAN.pm</code> wanted to install <code>SOAP::Lite</code>). all this just to upload a picture every once in a while? granted, I'm sure the full API offers much, much more, but for my immediate needs, no thanks.<br> <br> so, a bit of wandering through flickr showed they have an email upload option. so <code>MIME::Lite</code>, 10 lines of code, and 5 minutes later and I'm uploading photos. sometimes you need an uber API, and sometimes you don't...<br> <br> <i>so, will I start to receive photo spam as spammers hit random <code>@flickr.com</code> email addresses and stumble upon my upload address? hmm...</i> geoff 2006-04-22T15:17:22+00:00 journal just another typical day http://use.perl.org/~geoff/journal/29135?from=rss it's been a while since I've used POE, but lately I've been reminded of <a href="http://poe.perl.org/?Programming_POE/Introduction_to_POE">this bit</a> from it's documentation, which I think about constantly for some reason<blockquote><div><p> <tt>POE is event driven. Wait. What does that mean? To draw a somewhat relevant analogy... For most geeks, life is event driven. Most of the day is spent waiting for something interesting to happen.<br> <br>Ponder a friday evening. We're talking about a geek here so not much is going on. Just bad american tv. (is there any other kind of american tv?) Delivery Pizza arrives. This causes the geek to scramble for cash, pay the delivery man, and then hungrily devour pizza. When the pizza is gone, the geek resumes watching tv.<br> <br>The arrival of the pizza is an event. This causes a Pizza Arrival state, the collection of actions including paying for the pizza and eating it. When the Pizza Arrival state ends, the geek goes back to a passive wait state, waiting for the next event in his/her life.</tt></p></div> </blockquote><p>while I'm a fairly proactive coder, choosing to fill my idle times with yet more constructive coding, the past few weeks have felt remarkably event driven... in a bad way.</p> geoff 2006-03-28T18:00:35+00:00 journal on mac worms http://use.perl.org/~geoff/journal/28813?from=rss so, I'm reading the wall street journal this morning and the main story in the marketplace section begins like this<blockquote><div><p> <tt>"Users of Apple Computer Inc.'s Macintosh computers have long enjoyed the technology equivalent of a safe neighborhood, where the viruses and security nuisances that bedevil far more common Windows PCs are practically nonexistent."</tt></p></div> </blockquote><p>not being a current mac (or windows) user, I found this statement kinda funny - does nobody but me remember the early days of mac proliferation in academia where viruses were <i>everywhere</i>? for me, it was late high school and all through college, and disk after disk was hit with one virus or another, and one paper after another lost and needed to be rewritten, so eventually you needed to make space for one anti-virus program after another to combat it all (and remember, you needed to carry around your own boot and software disks, since only one mac in the lab had a hard drive, but the little ambulance icons were cute), and disks were $5.00 and that was a lot of money to a college student...<br> <br> anyway, for the sake of mac users everywhere, I'm glad to hear that <i>recent</i> mac users haven't been plagued with these problems. or maybe college was a lot longer ago than it feels...</p> geoff 2006-02-27T13:52:19+00:00 journal Devel::Cover++ http://use.perl.org/~geoff/journal/28560?from=rss just taking a moment to (re)state something the savvy folks in the perl world already know - <code>Devel::Cover</code> rocks.<br> <br> thanks <a href="http://www.pjcj.net/">paul</a>, for all you do to make our coding lives that much better. geoff 2006-02-02T16:53:04+00:00 journal like mark http://use.perl.org/~geoff/journal/26903?from=rss speaking of open source being a friendly and helpful place, I can't help pointing <a href="http://groups.google.com/group/comp.lang.perl.moderated/tree/browse_frm/thread/fa7a692159f00b37/bb46384f53580efb?rnum=11&amp;hl=en&amp;_done=%2Fgroup%2Fcomp.lang.perl.moderated%2Fbrowse_frm%2Fthread%2Ffa7a692159f00b37%2Fd031b2c9dc99b8c1%3Fhl%3Den%26#doc_8f0460c0d69c2177">this out</a> and stating for the record how much we all still stand to learn from mark. geoff 2005-09-27T23:49:58+00:00 journal on users http://use.perl.org/~geoff/journal/26897?from=rss so, I just went a few rounds with a user getting <a href="http://search.cpan.org/dist/WebService-CaptchasDotNet/">WebService-CaptchasDotNet</a> working while running in taint mode. not the world's most important module, but something that is apparently being used and needing fixing.<br> <br>as it turns out, the user didn't know much about perl - didn't know about <code>PREFIX</code> or <code>use lib</code> to manage local installs on a hosted machine, for example - so I gave him a few pointers along the way, in addition to fixing my module so it worked for him. in truth, I really didn't do much, and I was kinda embarrassed that it took two iterations to fix the problem. but it's all in a day's work for most of us here in the open source world, right?<blockquote><div><p> <tt>&gt;&gt;0.05 just uploaded to CPAN, and should appear around the world tomorrow.<br>&gt;&gt;<br>&gt;&gt;sorry it took so much effort to get this working for you...<br>&gt;<br>&gt; Please, no apologies. Thank you so much, you've been more responsive and<br>&gt; helpful that I ever imagined.</tt></p></div> </blockquote><p>I think I'm a little sad that the default user state is that they think they'll be alone when using code from CPAN or other open source projects.</p> geoff 2005-09-27T14:34:41+00:00 journal method call clarity http://use.perl.org/~geoff/journal/26429?from=rss ok, so every shop has style guidelines, and some of those style preferences differ from my own, and I'm perfectly fine with that - if the team wants 4 spaces but I'm a two-spacer, or if they don't care that they have some lines that are 172 characters, fine. but this one just doesn't make any sense to me:<br> <br> <i>all method/function calls end in () for 'clarity'</i> <br> <br> now, for function calls like this<blockquote><div><p> <tt>&nbsp; my $foo = bar();</tt></p></div> </blockquote><p>I think it makes sense, since the definition of <code>bar()</code> might get shuffled in larger codebases so just using the bareword might fail to compile someday.<br> <br> for method calls, however, I'm completely unconvinced. I don't see how</p><blockquote><div><p> <tt>&nbsp; my $foo = $obj-&gt;bar;</tt></p></div> </blockquote><p>is any less clear than</p><blockquote><div><p> <tt>&nbsp; my $foo = $obj-&gt;bar();</tt></p></div> </blockquote><p>but perl has lots of little easter eggs that even the best of us don't know, so I ask: in this case can</p><blockquote><div><p> <tt>&nbsp; $obj-&gt;bar</tt></p></div> </blockquote><p> <i>ever</i> mean anything different than</p><blockquote><div><p> <tt>&nbsp; $obj-&gt;bar()</tt></p></div> </blockquote><p>? and I don't mean for cases where you need to pass in arguments<nobr> <wbr></nobr>:) and I don't mean cases where <code>()</code> is required and tricky, like</p><blockquote><div><p> <tt>&nbsp; my $foo = $cv-&gt;();</tt></p></div> </blockquote><p>I mean, in all seriousness, exactly how does <code>()</code> add clarity to a method call? what else could you possibly expect <code>-&gt;bar</code> to represent?<br> <br> maybe it's the difference between</p><blockquote><div><p> <tt>&nbsp; $obj-&gt;bar</tt></p></div> </blockquote><p>and</p><blockquote><div><p> <tt>&nbsp; $obj-&gt;{bar}</tt></p></div> </blockquote><p>? if so, I don't buy it<nobr> <wbr></nobr>:)</p> geoff 2005-08-23T14:34:24+00:00 journal extending rss http://use.perl.org/~geoff/journal/26093?from=rss so I end up talking to <a href="http://onethumb.smugmug.com/">don macaskill</a> last night about an idea that <a href="shiflett.org">chris</a> and I bounced around a few months ago...<br> <br>rss ought to include some official tag for related links, both on a global level and a per-item level. the idea stemmed from standard blogs that have "people I'm reading" links in their page that need to be scraped by hand by feed aggregators - everyone would be far better off if those kind of links were official elements in the feed itself... or so our theory goes. geoff 2005-08-04T17:10:18+00:00 journal for the record http://use.perl.org/~geoff/journal/26052?from=rss overheard at oscon...<br> <br> <i>php is the country music of the programming world</i> <br> <br>it was said among a group of significant php figures and they didn't take offense, so you shouldn't either<nobr> <wbr></nobr>:) geoff 2005-08-03T00:08:11+00:00 journal Apache-Test support expands again http://use.perl.org/~geoff/journal/25661?from=rss well, it's just baby steps at this point, but I added <code>Apache::TestConfigParrot</code> and <code>Apache::TestRunParrot</code> to <a href="http://search.cpan.org/dist/Apache-Test/"> <code>Apache-Test</code> </a> yesterday. what this means is that if you add<blockquote><div><p> <tt>&nbsp; t/response/TestFoo/bar.pir</tt></p></div> </blockquote><p>to your tests you're now good to go. well, so long as <code>bar.pir</code> spits out TAP.<br> <br> for the moment this is only really useful for testing mod_parrot itself, but who knows...</p> geoff 2005-07-12T19:03:34+00:00 journal register early, register often http://use.perl.org/~geoff/journal/25209?from=rss early bird registration for this year's OSCon ends soon, so you only have a few days left to register for my tutorial, <a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6392">Test-Driven Apache Module Development</a>, on the cheap.<br> <br>I know it sounds dry, but it's really a good tutorial, and probably essential if you do any kind of Apache development. do you write libraries based on the mod_perl API? Apache C modules? even CGI scripts or (gasp) PHP? you'll learn how to test all of these with Apache-Test using the same Test::More that you already love.<br> <br> did I mention there's chocolate involved? geoff 2005-06-15T12:22:59+00:00 journal thanks and praise http://use.perl.org/~geoff/journal/25141?from=rss I just received this email, addressed to me personally:<blockquote><div><p> <tt>To: Geoffrey Young<br>Subject: mod_perl2 API change<br> <br>Thank you very much for your API change. What you were thinking about when doing this? Maybe your ass?<br> <br>Everything is broken now....<br>:((((</tt></p></div> </blockquote><p>nice.</p> geoff 2005-06-10T17:26:30+00:00 journal YAPC::NA 2005 http://use.perl.org/~geoff/journal/24491?from=rss I was fortunate enough to have two of my talks chosen for YAPC::NA 2005.<blockquote><div><p> <tt>Writing Tests with Apache-Test, Part II:<br> <br>At last year's YAPC, between the beer and buffalo wings, you got to know the basics of Apache-Test. Now, it's time to get familiar with what really makes it a really valuable testing platform. Apache-Test allows you to run tests directly within the mod_perl runtime environment, providing the ability to exercise server-side APIs in a way no other testing framework can. If mod_perl is your thing, you absolutely need to check this out.</tt></p></div> </blockquote><blockquote><div><p> <tt>A Few Cool Things About mod_perl 2.0:<br> <br>mod_perl 2.0 is certainly a lot to digest. But hidden deep in the recesses of this new release are lots of features that you won't find at the forefront of the typical "why mod_perl 2.0" discussion but which are super cool. Oh, and they are important to your migration strategy too. This talk will outline a few of the important but lesser known features of mod_perl 2.0 that will get you thinking in new directions as you migrate away from mod_perl 1.0.</tt></p></div> </blockquote><p>unfortunately, the talk that I most wanted to do (<i>Testing PHP with Perl</i> with <a href="http://shiflett.org/">Chris Shiflett</a>) wasn't selected. the talk met with a similar fate at <a href="http://conf.phpquebec.org/en/conf2005/">PHP Quebec</a>, which I gather is much like YAPC in its audience and expectations. I guess neither side has much of an interest in the other, at least not in the testing arena, which I find odd since it seems like the more people I talk to from either side the more they are willing to admit there is some degree of crossover in both directions. oh, well.</p> geoff 2005-05-02T17:46:41+00:00 journal mod_perl 2.0.0-RC5 released http://use.perl.org/~geoff/journal/24189?from=rss mod_perl 2.0.0-RC5, the next step toward an official "this is mod_perl 2.0" <a href="http://marc.theaimsgroup.com/?l=apache-modperl-dev&amp;m=111348626009762&amp;w=2">was announced</a> and uploaded to CPAN today.<br> <br> if you plan on migrating to this latest release, please take the time to read <a href="http://perl.apache.org/docs/2.0/rename.html">this document</a>, which outlines very, very important changes between this version of mod_perl and all prior 2.0-branch releases<blockquote><div><p> <tt>&nbsp; http://perl.apache.org/docs/2.0/rename.html</tt></p></div> </blockquote><p>this was a particularly stressful release for everyone, and I know a few people approached burnout-levels because of it. but hopefully mod_perl, and the rest of the perl community, is better off because of it.<br> <br> at any rate, enjoy!</p> geoff 2005-04-14T17:11:45+00:00 journal perl photo mailing list? http://use.perl.org/~geoff/journal/23717?from=rss like many here in our little perl world, I'm getting into digital photography as an official hobby (or back into photography, depending on how you look at it). despite all the resources out there with pictures to look at (and there are tons) I have yet to find a decent community to discuss photography the way I want to discuss it. not that there aren't lots of places, but they all seem to use the old bbs-type mode of communication, being web-based forums using a terrible interface with horrid colors. I like mailing lists.<br> <br> anyway, I know there are enough people here and around perl that are into photography - is there any interest in photo@perl.org or somesuch?<br> <br> ORA put out <a href="http://www.oreilly.com/catalog/digphotohks/">digital photography hacks</a> last year so we can kinda tie it into perl. and I spent way too much time getting set up in an all open source world, writing shell and perl scripts and figuring out life without photoshop, etc, so that might be a tie in too. geoff 2005-03-18T14:56:56+00:00 journal Apache-Test for the php CLI http://use.perl.org/~geoff/journal/22919?from=rss <b>UPDATE:</b> <i>you might find this all confusing if you haven't heard about our <code>Apache-Test</code> efforts yet and how it joins PHP and Perl together in the testing world. take a look at the talk <a href="http://shiflett.org/">Chris</a> and I gave at ApacheCon 2004: </i><ul><li><i>Testing PHP with Perl slides - <a href="http://xrl.us/phpperl">http://xrl.us/phpperl</a></i> </li><li>Testing PHP with Perl demo - <a href="http://xrl.us/phpperlcode">http://xrl.us/phpperlcode</a> </li><li>README from the demo, which has lots of details - <a href="http://xrl.us/phpperlREADME">http://xrl.us/phpperlREADME</a> </li></ul><p> now, back to the blog... <br> <br> today I added the ability to run client-side PHP scripts to <code>Apache-Test</code>. so, now you can have</p><blockquote><div><p> <tt>&nbsp; t/foo.t<br>&nbsp; t/bar.php<br>&nbsp; t/response/TestPHP/baz.php</tt></p></div> </blockquote><p>all within the same <code>t/</code> directory.<br> <br> the perl script <code>t/foo.t</code> will run using perl, just like always. <code>t/bar.php</code> will run using the php command-line interpreter, while <code>t/response/TestPHP/baz.php</code> will run via PHP <i>within the Apache runtime</i> (through standard <code>Apache-Test</code> magic). and all are executed with a simple <code>make test</code> and tabulated on the command line like you would expect.<br> <br> furthermore, the <code>test-more.php</code> that <code>Apache-Test</code> generates can be automatically found from the client-side tests as well. so, here is what a sample <code>t/foo.php</code> looks like:</p><blockquote><div><p> <tt>&lt;?php<br>&nbsp; require "test-more.php";<br> <br>&nbsp; plan(1);<br> <br>&nbsp; diag("this is a php test");<br> <br>&nbsp; is('php', 'perl', "something php passed");<br>?&gt;</tt></p></div> </blockquote><p>look familiar? so does the output...</p><blockquote><div><p> <tt>$ make test TEST_VERBOSE=1<br>/perl/perl-5.8.6/bin/perl -Iblib/arch -Iblib/lib \<br>t/TEST&nbsp; -clean<br>APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= APACHE_TEST_APXS= \<br>/perl/perl-5.8.6/bin/perl -Iblib/arch -Iblib/lib \<br>t/TEST&nbsp; -bugreport -verbose=1 t/foo.php t/foo.t<br>/usr/local/apache/bin/httpd&nbsp; -d<nobr> <wbr></nobr>/src/devel/perl-php-test/t -f<nobr> <wbr></nobr>/src/devel/perl-php-test/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS<br>using Apache/1.3.32<br> <br>waiting 60 seconds for server to start:<nobr> <wbr></nobr>..<br>waiting 60 seconds for server to start: ok (waited 1 secs)<br>server localhost.localdomain:8529 started<br>t/foo....1..1<br># this is a php test<br>not ok 1 - something php passed<br>#&nbsp; &nbsp; &nbsp;Failed test (t/foo.php at line 9)<br>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; got: 'php'<br>#&nbsp; &nbsp; &nbsp;expected: 'perl'<br># Looks like you failed 1 tests of 1.<br>FAILED test 1<br>&nbsp; &nbsp; &nbsp; &nbsp; Failed 1/1 tests, 0.00% okay<br>t/foo....1..1<br># this is a perl test<br>not ok 1 - something perl passed<br> <br>#&nbsp; &nbsp; &nbsp;Failed test (t/foo.t at line 7)<br>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; got: 'php'<br>#&nbsp; &nbsp; &nbsp;expected: 'perl'<br># Looks like you failed 1 test of 1.<br>dubious<br>&nbsp; &nbsp; &nbsp; &nbsp; Test returned status 1 (wstat 256, 0x100)<br>DIED. FAILED test 1<br>&nbsp; &nbsp; &nbsp; &nbsp; Failed 1/1 tests, 0.00% okay<br>Failed Test Stat Wstat Total Fail&nbsp; Failed&nbsp; List of Failed<br>-----------------------------------------------------------------------<nobr>-<wbr></nobr> -------<br>t/foo.t&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp;256&nbsp; &nbsp; &nbsp;1&nbsp; &nbsp; 1 100.00%&nbsp; 1<br>t/foo.php&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 1 100.00%&nbsp; 1<br>Failed 2/2 test scripts, 0.00% okay. 2/2 subtests failed, 0.00% okay.</tt></p></div> </blockquote><p>hard to tell which is <code>Test::More</code> and which is <code>test-more.php</code> isn't it? <br> <br> I find it interesting that in a very large testing framework here at work we use a mixture of <code>*.t</code> tests that have nothing to do with mod_perl or Apache, yet we just let <code>Apache-Test</code> run everything for convenience. now, PHP users can do the same - code PHP clients to talk to their PHP web app using <code>Test::More</code> syntax, or just use <code>Apache-Test</code> as the engine for their CLI scripts:</p><blockquote><div><p> <tt>$ t/TEST -no-httpd t/foo.php&nbsp; -v<br>[warning] skipping httpd configuration<br>t/foo....1..1<br># this is a php test<br>not ok 1 - something php passed<br>#&nbsp; &nbsp; &nbsp;Failed test (t/foo.php at line 5)<br>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; got: 'php'<br>#&nbsp; &nbsp; &nbsp;expected: 'perl'<br># Looks like you failed 1 tests of 1.<br>FAILED test 1<br>&nbsp; &nbsp; &nbsp; &nbsp; Failed 1/1 tests, 0.00% okay<br>Failed Test Stat Wstat Total Fail&nbsp; Failed&nbsp; List of Failed<br>-----------------------------------------------------------------------<nobr>-<wbr></nobr> -------<br>t/foo.php&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 1 100.00%&nbsp; 1<br>Failed 1/1 test scripts, 0.00% okay. 1/1 subtests failed, 0.00% okay.</tt></p></div> </blockquote> geoff 2005-01-28T03:04:31+00:00 journal digital photography http://use.perl.org/~geoff/journal/22620?from=rss because everyone with 3 kids needs a picture taking machine, I got a new Nikon D70 last week. so far, I've been pretty pleased with it, but because the camera is so complex I found that I needed to hunt around for useful information to get going.<br> <br> anyway, I've wanted to throw some notes together on some of the linux-oriented things I've done since I started shooting digital, as well as a collection of notes on the D70. nothing major or revolutionary (I'm mainly posting here so google picks it up<nobr> <wbr></nobr>:) but if it helps someone...<br> <br> <a href="http://www.crushedredpepper.com/nikon/">http://www.crushedredpepper.com/nikon/</a> geoff 2005-01-07T19:52:45+00:00 journal welcome to #perl-php http://use.perl.org/~geoff/journal/22121?from=rss just for kicks I created a new irc channel on <code>irc.perl.org</code>: <code>#perl-php</code>. I guess my intent was to provide a forum for folks interested in trying out the <a href="http://search.cpan.org/dist/Apache-Test/"> <code>Apache-Test</code> </a> hooks for testing PHP that <a href="http://shiflett.org/">Chris</a> and I <a href="http://www.xrl.us/phpperl">have been working on</a>. of course, like all things on irc, I suspect there will be lots of diversions as well, but just in case people need some hand-holding getting started, I'll be around there to help.<br> <br> stop on by. geoff 2004-12-03T14:13:16+00:00 journal mod_images_never_expire http://use.perl.org/~geoff/journal/22049?from=rss one of the most interesting talks I heard at ApacheCon was <a href="http://www.radwin.org/michael/blog/">Michael Radwin</a>'s <a href="http://public.yahoo.com/~radwin/talks/http-caching-apachecon2004.htm">HTTP Caching and Cache-busting for Content Publishers</a>. In that talk he presented an (ingeniously simple) Apache C extension module called <code>mod_images_never_expire.c</code>.<br> <br> I took that module, added some basic tests, and wrapped it up in an <code>Apache-Test</code>-based tarball, <a href="http://perl.apache.org/~geoff/mod_images_never_expire-example.tar.gz"> <code>mod_images_never_expire-example.tar.gz</code> </a>. <br> <br> in the below output, notice how <code>mod_images_never_expire.c</code> is compile and tested in a single command, all without invoking <code>perl</code> explicitly. <code>make</code> would simply compile the module, and <code>sudo make install</code> would install and activate the module for the specified Apache.<blockquote><div><p> <tt>$ tar zxvf mod_images_never_expire-example.tar.gz<br>$ cd mod_images_never_expire-example/<br> <br>$ export APACHE_TEST_APXS=/usr/local/apache/bin/apxs<br>$ make test<br>perl Makefile.PL<br>Checking if your kit is complete...<br>Looks good<br>Writing Makefile for mod_images_never_expire<br>make[1]: Entering directory `/src/mod_images_never_expire-example'<br>make[1]: Nothing to be done for `makefile'.<br>make[1]: Leaving directory `/src/mod_images_never_expire-example'<br>make[1]: Entering directory `/src/mod_images_never_expire-example'<br>/perl/perl-5.8.5/bin/perl -Iblib/arch -Iblib/lib \<br>t/TEST&nbsp; -clean<br>APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= APACHE_TEST_APXS=/usr/local/apache/bin/apxs \<br>/perl/perl-5.8.5/bin/perl -Iblib/arch -Iblib/lib \<br>t/TEST&nbsp; -bugreport -verbose=0<br>make[2]: Entering directory `/src/mod_images_never_expire-example/c-modules'<br>cd images_never_expire &amp;&amp; make mod_images_never_expire.so<br>make[3]: Entering directory `/src/mod_images_never_expire-example/c-modules/images_never_expire'<br>/usr/loca<nobr>l<wbr></nobr> <nobr> <wbr></nobr>/apache/bin/apxs -D APACHE1 -I/src/mod_images_never_expire-example/c-modules -c mod_images_never_expire.c<br>gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DUSE_HSREGEX -fpic -DSHARED_MODULE -I/usr/local/apache/include -I/src/mod_images_never_expire-example/c-modules -DAPACHE1&nbsp; -c mod_images_never_expire.c<br>gcc -shared -o mod_images_never_expire.so mod_images_never_expire.o<br>make[3]: Leaving directory `/src/mod_images_never_expire-example/c-modules/images_never_expire'<br>make[2]: Leaving directory `/src/mod_images_never_expire-example/c-modules'<br>/usr/local/apache/bin/httpd&nbsp; -d<nobr> <wbr></nobr>/src/mod_images_never_expire-example/t -f<nobr> <wbr></nobr>/src/mod_images_never_expire-example/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS<br>using Apache/1.3.32<br> <br>waiting 60 seconds for server to start:<nobr> <wbr></nobr>...<br>waiting 60 seconds for server to start: ok (waited 2 secs)<br>server localhost.localdomain:8529 started<br>t/01image.......ok<br>t/02nonimage....ok<br>All tests successful.<br>Files=2, Tests=24,&nbsp; 1 wallclock secs ( 1.35 cusr +&nbsp; 0.07 csys =&nbsp; 1.42 CPU)<br>[warning] server localhost.localdomain:8529 shutdown<br>make[1]: Leaving directory `/src/mod_images_never_expire-example'</tt></p></div> </blockquote> geoff 2004-11-29T16:23:39+00:00 journal ApacheCon slides http://use.perl.org/~geoff/journal/21922?from=rss As usual, ApacheCon was a blast this year. I wish I had the time to do a proper write up today, but I probably won't get around to it - I had too many great talks with too many great people to do it justice anyway.<br> <br> for those that are interested in the presentation materials from my talks, here they are.<br> <br> &nbsp;&nbsp;<i>Test-Driven Apache Module Development</i>: <a href="http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/test-driven-development.pdf">slides</a> and <a href="http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/test-driven-development-code.tar.gz">code</a> <br> <br> &nbsp;&nbsp;<i>mod_perl 2.0 at Warp Speed</i>: <a href="http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/mp2-warp.pdf">slides</a> <br> <br> &nbsp;&nbsp;<i>Testing PHP with Perl</i> (with <a href="http://shiflett.org/">Chris Shiflett</a>): <a href="http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/testing-php-with-perl.pdf">slides</a> and <a href="http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/testing-php-with-perl-code.tar.gz">code</a> <br> <br> many thanks to the folks who came to the talks and gave us such great feedback. geoff 2004-11-19T14:28:41+00:00 journal Apache::SSLLookup http://use.perl.org/~geoff/journal/21707?from=rss I released <a href="http://search.cpan.org/dist/Apache-SSLLookup/"> <code>Apache-SSLLookup</code> </a> to CPAN yesterday, which was created to address the issues mentioned in <a href="http://marc.theaimsgroup.com/?l=apache-modperl&amp;m=109724330117207&amp;w=2">this mod_perl discussion thread</a>.<br> <br> while the module is only really useful for interacting with mod_ssl, the code itself is actually a nice, simple example of a few new mod_perl 2.0 concepts.<br> <br> it is written entirely in XS (except for the <code>Dynaloader</code> bootstrapping, of course). that it uses XS at all means that the <a href="http://search.cpan.org/src/GEOFF/Apache-SSLLookup-2.00_01/Makefile.PL"> <code>Makefile.PL</code> </a>is a good example of how mod_perl 2.0 makes it very easy to generate a <code>Makefile</code> that can find what it needs on all platforms. in mod_perl 1.0 you needed a <a href="http://www.modperlcookbook.org/code/ch10/Cookbook-Apache-0.01/Makefile.PL"> <code>Makefile.PL</code> like this</a> to work on Win32. there's also a cool little <code>Apache-Test</code> feature in use there, which shows up only if a test fails.<br> <br> speaking of tests, if you want to use <code>Apache-Test</code> to test SSL things then you will need to generate server-side certificates for mod_ssl to use. I haven't generated certificates in ages, but fortunately I didn't need to figure it out again - simply creating the directory <code>t/conf/ssl</code> is enough to have <code>Apache-Test</code> automagically generate a handful of certificates for you. see the <code>ssl.conf.in</code> for an example of putting these to use so you can issue <code>https</code> requests in your tests.<br> <br> I also had a bit of fun in that the class is a proper subclass of <code>Apache::RequestRec</code>, but the constructor is written entirely in XS as well. so, the module shows you what you need to do to emulate<blockquote><div><p> <tt>our @ISA = qw(Apache::RequestRec);<br> <br>sub new {<br>&nbsp; my ($class, $r) = @_;<br> <br>&nbsp; return bless { _r =&gt; $r }, $class;<br>}</tt></p></div> </blockquote><p>in XS.<br> <br> lastly, it illustrates how to interact with Apache's new optional function hooks, which is a pretty cool thing if you happen to need to do that.<br> <br> anyway, enjoy.</p> geoff 2004-11-04T14:36:36+00:00 journal