demerphq's Journal http://use.perl.org/~demerphq/journal/ demerphq'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:11:27+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 demerphq's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~demerphq/journal/ German Perl Workshop http://use.perl.org/~demerphq/journal/32504?from=rss <p>Had a great time at the GPW. Met lots of interesting folks, saw some good talks (although probably didnt understand as much of them as I should given my crappy German skills), and had fun hanging out and meeting some of the people who I only know through the internet.</p><p>My talk went pretty well, it probably could be improved some, but considering it was the first time Ive presented to an audience of that size, (about 80-100 people I guess) I think it went just fine.</p><p>Annoyingly there are still some bugs in the Perl5 regex engine so a few things that should have worked didnt, but well thats life.</p><p>I probably shouldn't have drunk so much on the second day. I passed the point of being able to say no to more alcohol, and just might have made a fool out of myself blabbing on about my days as a courier in london...</p><p>Anyway, I'm really looking forward to the next perl gathering and hanging out with folks some more.</p><p>Cheers to the GPW organizers for doing a great job, and to eveyrbody that participated.</p> demerphq 2007-02-25T21:49:24+00:00 journal Perl5 should switch to using Git as its main source control http://use.perl.org/~demerphq/journal/32014?from=rss <p>I've been thinking a lot about source control lately. Ive been having issues with my development process (using svn/TortoiseSvn) and working with p5p lately that really makes me think that the current scheme is not all that cool.</p><p>Currently Perl5 uses a Perforce repository hosted by Activestate. FWICT you are only allowed read access if you have a commit bit and for obvious reasons the pool of people with commit bits is small, and because of attrition in the developer community,<nobr> <wbr></nobr>/appears/ to be shrinking.</p><p>Now, most of the work I do is new features, and accordingly I'm not that fussed about not having a commit bit. Forcing peer review and a sober-second-thought on new features is a good plan, and many a bug has been caught by the two man process. Although annoyingly a couple of doozies have passed oversight for some time without any notice at all. (Which I suppose is to be expected in any development project of this size and complexity.)</p><p>However what really annoys me is that I can't easily synchronize my local version with the ongoing patch and when I upload my changes its via a snapshot. My local history is lost, and when the patch is merged in its showed as being from the person who committed it, and not me (although the patch comment usually shows more details). On at least one occassion this has lead to someone blaming a bug on the commiter and not me, the actual responsible party.</p><p>So I want a system where i can maintain my local tree, where I can easily sync it with others, and etc. It looks to me like Git is the right choice. While svk also seems interesting I don't like the fact that its based on SVN which Im slowly coming to dislike on an achitectural basis.</p><p>The<nobr> <wbr></nobr>.svn directories everywhere, the size and number of files of change data, etc all really start to get on my nerves. The Git architecture seems much more sound, and has the benefit of being under heavy development by people who are doing stuff just like what the Perl5 developers are doing. As well as some very bright contributors like Linus Torvalds.</p><p>Now, I'm not a unix person in general, and it appears Git support on Windows is weak, but since it appears to work fine under cygwin I would happily change to using it. And frankly I'm getting more and more inclined to do a total permanent switchover to linux anyway.</p> demerphq 2006-12-29T15:21:23+00:00 journal Adopt a Penguin for Christmas http://use.perl.org/~demerphq/journal/31969?from=rss <p> I'm wondering how many Linux people will <a href="http://www.sanccob.co.za/adopt_a_penguin.htm">adopt a penguin</a> for Christmas. </p><p> I wonder if the Penguin conservation groups have already figured out how much money is floating around under a penguin logo.... </p><p> Considering they don't have a paypal account I guess not. </p> demerphq 2006-12-19T22:31:28+00:00 journal Perl5 Regex Engine Abstracted - Win A Metre of Beer! http://use.perl.org/~demerphq/journal/31796?from=rss <p> With patch <a href="http://public.activestate.com/cgi-bin/perlbrowse/29430">Change #29430</a> the regex engine should now be sufficiently abstracted that it is reasonably feasable to write a plugin to use a different regex engine in perl. The documentation for most of the interface is contained in the perlreguts module although one needs to understand the flags in the regexp.h in order to make it work. </p><p> The basic idea is that the existing perl engine and data structures have been ripped in half. The structures which the perl core must interact are now well defined and the parts that are "private" to a given regex engine implementation are now isolated from the core. </p><p> A big issue with Perl 5.8 and earlier Perls regex engine pluggability interface was that it was intended mostly for swapping in a DEBUG build of the real engine, with the expectation that any engine in use could cope with the data structures generated by any other engine. Additionally some of the management routines for regexps were harded coded into the core, with the expectation that the core routine could handle any engines data. All of these design issues meant that basically you couldnt plug an arbitrary engine into perl. You would have to apply core patches to do even the meanest implementation. </p><p> In the new scheme what Perl needs to know about a pattern, is defined by the <code>struct regexp</code>. What Perl needs to know about a regex engine is defined by the <code>struct regexp_engine</code>. All a plug in needs to do is create a <code>regexp_engine</code> that contains the appropriate callbacks and populate %^H appropriatly when the module is use()d. Perl will then use the compiler routine specified by the engine to create a <code>regexp</code> struct which it will then use as though it was its own. The <code>regexp</code> structure contains a pointer to the <code>regexp_engine</code> structure which created it, so the regexp is completely encapsulated. You can compile a regexp using one engine and pass it through to a routine expecting a normal regexp and everything would work out. </p><p> So now all we need to do is get some intrepid hacker to actually put all this to good use and write a plug in for another engine. </p><p> And you know what? </p><p> <b> The first person that publishes a proper regexp engine plug in for BleadPerl (soon to be Perl 5.10) will get a <em>METRE OF BEER</em> for doing so.... </b> </p><p> Ill give a bonus prize (to be determined) if the engine ported is the latest TCL engine. </p><p> So lets see how long it takes...<nobr> <wbr></nobr>:-) </p><p> <small>Note: I'm going to publish this challenge elsewhere over the next few days. Thanks to AdamK for the idea of the prize.</small> </p> demerphq 2006-12-03T16:43:11+00:00 journal Life goes on http://use.perl.org/~demerphq/journal/31040?from=rss <p> Welp, I'm back at the office for my last week. While I was they moved my desk to a different floor and when I came back I didnt even know where I was supposed to be! Anyway, its only a week of handover activities and then I can get back to hacking perl... </p><p> Speaking of hacking perl, my latest plan is to get the regex engine truely pluggable. Id like to make it possible, and preferably <i>easy</i>, to use alternate regex engines such as PCRE inside of perl. </p><p> My motivation for this is mostly to enable lexically scoped and run time control over debugging regexes, and partly so that I can do performance comparisons with other engines. </p><p> The possibilities are kinda crazy tho. If done properly one could easily implement the Perl 6 grammar engine as a perl 5 regex engine implementation, which itself uses perl 5's regex engine internally. Yes, this means one could hypothetically write their own regex engine <b>in Perl</b>.<nobr> <wbr></nobr>:-) </p><p> I have to say, im really eager to get cracking on this. Id love to benchmark PCRE against Perls native language, and well lexically scoped debug mode regexes would be a real asset to debugging unexpected regex behaviour. </p><p> (Trying to post more often to my journal.) </p> demerphq 2006-09-18T12:45:27+00:00 journal Regex hacking http://use.perl.org/~demerphq/journal/30996?from=rss <p> I recently left my job and have been decompressing from a long period of continuous employment by enjoying some time off with some nice weather, bike riding, late mornings, breakfast at the cafe and lots of hacking. </p><p> I've managed to close off most of my regex engine todo list: ANYOF and jump tries, aho-corasick startclass matching, postitive-look(ahead|behind) optimisation (theres some rough edges to deal with on this one yet), charname support in the parser, and about 75% of what needs to happen to the debug output to make it "non-regex engine hacker" friendly.</p><p> All this combined with my earlier efforts (single-char-ANYOF to EXACT, simple-TRIE's) mean that perl now comfortably outperforms python in the so-called <a href="http://utcc.utoronto.ca/~cks/space/blog/python/MoreRegexpPerformance"> "rebench"</a> tests. (bleadperl average time per test: 28 usecs, python average time per test: 297 usecs) The use of regex preprocessors to do "trie" like optimisation will no longer be necessary, and in fact will often slow things down, as it will result in duplicating things that are already happening internally. </p><p> I need to revisit perlreguts and update it with what Ive learned, and in some cases what has changed. </p><p> I need to update my journal more often.<nobr> <wbr></nobr>:-( </p><p> Things still to do: Clean up/reorganize re Debug stuff to be easier to use. Look into using reghop4() for things. Look into the MAGIC hack for making things pluggable. Look into migrating code in sv.c re_dup over to regcomp.c Maybe split regcomp into several pieces to make it smaller and easier to manage. </p> demerphq 2006-09-14T18:06:29+00:00 journal Data::Dump::Streamer 1.11 released http://use.perl.org/~demerphq/journal/24850?from=rss <p>Released the new version of DDS yesterday. Diotalevi from perlmonks worked with me to make it handle a couple of special cases in a much better way.</p><p>The main new features are that weakrefs, overloaded objects and closures are all now dumped properly. In particular the lexicals that are bound to a closure a dumped along with it. AFAIK this is the first tool ever to have this feature.</p><p>Thanks dio.<nobr> <wbr></nobr>:-)</p> demerphq 2005-05-24T13:00:03+00:00 news Hacking the core.... http://use.perl.org/~demerphq/journal/23840?from=rss <p> Hacking the core has got be one of the most interesting things I've done. Not being much of C programmer (im one of those Pascal weenies) its been a non stop rollercoaster ride of learning, head banging and even more learning. </p><p> Anyway, I finally was able to achieve a dream of mine and add Trie matching to Perls regex engine. Raphael applied it to 5.9.2 as patch 24044 on March 18, 2005. A moment I doubt I will ever forget.<nobr> <wbr></nobr>:-) </p><p> Since then ive been plugging away at the second phase of my regex plans which is to add Aho-Corasick matching support. I released a patch for it just the other day but sofar it hasnt worked out as well as the plain Trie patch. It seems to have problems building on some folks machines, and seems to add an unnacceptable overhead to some regexes that involve normal Tries and not Aho-Corasick enhanced ones. </p><p> I have to say the slowdown is at the point totally inexplicable, as I would expect the code from the second patch to be in fact slightly more efficient. Theres weirdness afoot that i really dont understand. </p><p> Anyway, it feels good to have contributed this, especially as it should eventually result in performance improvements in things like SpamAssassin which would probably be a boon to many folks out there. And doing a little bit to fight spam makes me feel good.<nobr> <wbr></nobr>:-) </p> demerphq 2005-03-25T13:49:17+00:00 journal Dumper distress http://use.perl.org/~demerphq/journal/5012?from=rss Well. Every time I think my new Dumper is finished I discover some new bug. And often the bug aint mine, but rather a perl bug or a Data::Dumper bug.<p> Anyway, Ive come to the conclusion that (and 'a data structure' means any arbitrary data structure) </p><ul> <li> Its not possible to correctly dump a perl data structure with just one pass (which is what Data::Dumper tries to do). </li><li> Its not possible to dump a data structure correctly without using the tools in Array::RefElem </li><li> Its not possible to correctly dump a data structure using named vars only. </li></ul><p> Also in the course of developing Data::BFDump I have discovered bugs in </p><ul> <li> Data::Dumper </li><li> Perl </li><li> B::Deparse </li><li> Test::More </li><li> List::Utils </li><li> Data::Dump </li></ul><p> This accounts for some of the most well known and highly regarded authors in Perldom. And you know what? Of the bugs I have reported <b>NONE</b> of the authors has responded. Not so much of a peep. Even on the perl5porters list I got only one reply. Frankly the impression I get of that place is that if you cant write C/C++ code in your sleep then they wont even speak to you. A pretty disappointing reaction considering the kind of community that Ive come to love at places like Perlmonks.</p><p> Dont get me wrong I appeciate that the perl porters work hard and do a good job. I appreciate that many of the authors above are very busy people with lots on their plate. But a lousy email saying 'ACK' to a bug report really doesnt seem like that much to ask. Hell at least I went out of my way to find and inform them of the bug.</p><p> a slighty annoyed demerphq</p> demerphq 2002-05-17T15:51:01+00:00 journal Dumper difficulties... http://use.perl.org/~demerphq/journal/4084?from=rss I'm currently working a new dumper module in my spare time. In the process I've found a few minor bugs in both Data::Dump and Data::Dumper.<p> For instance Data::Dump will go into fits (infinte loop) when trying to dump the following</p><blockquote><div><p> <tt>my ($x,$y);<br>$x=\$y;<br>$y=\$x;<br>print dump([$x,$y]);</tt></p></div> </blockquote><p>And a bug in dumper can be seen from</p><blockquote><div><p> <tt>use Data::Dumper;<br>$Data::Dumper::Purity=1;<br>my ($x,$y,$z);<br>$x=\$y;<br>$y=\$z;<br>$z='Foo';<br>print Dumper($x);<br>__END__<br>#Outputs<br>$VAR1 = \\'Foo';</tt></p></div> </blockquote><p>Problem is that this is wrong (doesnt look it though does it?)</p><blockquote><div><p> <tt># this is fine...<br>$$$x='Bar';<br># this is an illegal attempt to alter a read only variable.<br>$$$VAR1='Bar';</tt></p></div> </blockquote><p>Im looking forward to releasing my new dumper in the next few days. It wont have either of these problems and represents a new approach to dumper modules... Look for it on CPAN under the name Data::BFDumper in the next few days....</p> demerphq 2002-04-10T13:57:22+00:00 journal