From simon.oliver at umist.ac.uk Mon May 13 04:47:41 2002 From: simon.oliver at umist.ac.uk (Simon Oliver) Date: Thu Aug 5 00:07:08 2004 Subject: Perl DBI Message-ID: <3CDF8BBD.E5DA08DC@umist.ac.uk> Is anyone using interested in the Perl DBI? There's a chance that the module's author, Tim Bunce, might be able to give a presentation/tutorial on the subject at UMIST in June. I'm trying to determine the amount of interest. -- Simon Oliver -- You are currently subscribed to manchester-pm-list. To unsubscribe, send the following message to majordomo@happyfunball.pm.org: unsubscribe manchester-pm-list From paulj at ccl.umist.ac.uk Mon May 13 12:00:45 2002 From: paulj at ccl.umist.ac.uk (Paul Johnston) Date: Thu Aug 5 00:07:08 2004 Subject: question about perl 5.6 Message-ID: Question I wish to generalise the scheme below: s/d/pack("U",100)/eg; s/e/pack("U",101)/eg; s/f/pack("U",102)/eg; i.e. take a web page with unicode character codes i.e. arabic and create a file with the actual unicode characters. So I think it should be like: s/&#([0-9]*)/pack("U",\1)/eg; However this does not work, something to do with when the parentheses are passed to \1 and this is evaluate I think? Any ideas, please note not all versions of perl support pack("U",value) Paul Johnston Unix System Admin Language Engineering UMIST Tel 0161 200 3089 Fax 0161 200 3099 -- You are currently subscribed to manchester-pm-list. To unsubscribe, send the following message to majordomo@happyfunball.pm.org: unsubscribe manchester-pm-list From chris at cpan.org Mon May 13 12:19:24 2002 From: chris at cpan.org (chris@cpan.org) Date: Thu Aug 5 00:07:08 2004 Subject: question about perl 5.6 In-Reply-To: References: Message-ID: <86r8kgm0df.fsf@void.printf.net> Hi, Paul. >>>>> "Paul" == Paul Johnston writes: Paul> s/&#([0-9]*)/pack("U",\1)/eg; Paul> However this does not work, something to do with when the Paul> parentheses are passed to \1 and this is evaluate I think? I'm not sure if this is correct, but I'd use $1 instead of \1 outside of the expression itself. Give that a try, perhaps? Everything else seems in order.. - Chris. -- $a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a -- You are currently subscribed to manchester-pm-list. To unsubscribe, send the following message to majordomo@happyfunball.pm.org: unsubscribe manchester-pm-list From robin at kitsite.com Mon May 13 12:39:28 2002 From: robin at kitsite.com (Robin Houston) Date: Thu Aug 5 00:07:08 2004 Subject: question about perl 5.6 In-Reply-To: ; from paulj@ccl.umist.ac.uk on Mon, May 13, 2002 at 06:00:45PM +0100 References: Message-ID: <20020513183927.A30593@puffinry.freeserve.co.uk> On Mon, May 13, 2002 at 06:00:45PM +0100, Paul Johnston wrote: > So I think it should be like: > > s/&#([0-9]*)/pack("U",\1)/eg; > > However this does not work, In a Perl expression (i.e. when you're using the /e switch) you have to use $1 in place of \1 to pick up the contents of the bracket. \1 is a reference to the constant scalar "1", which when evaluated as a number will come out to some fairly arbitrary memory address -- probably not what you wanted! There's a pertinent section in the "perlre" man page: WARNING on \1 vs $1 Some people get too used to writing things like: $pattern =~ s/(\W)/\\\1/g; This is grandfathered for the RHS of a substitute to avoid shocking the sed addicts, but it's a dirty habit to get into. That's because in PerlThink, the righthand side of a s/// is a double-quoted string. \1 in the usual double- quoted string means a control-A. The customary Unix meaning of \1 is kludged in for s///. However, if you get into the habit of doing that, you get yourself into trouble if you then add an /e modifier. s/(\d+)/ \1 + 1 /eg; # causes warning under -w Or if you try to do s/(\d+)/\1000/; You can't disambiguate that by saying \{1}000, whereas you can fix it with ${1}000. Basically, the operation of interpolation should not be confused with the operation of matching a backreference. Certainly they mean two different things on the left side of the s///. Bearing in mind that - \d is shorthand for [0-9] in a regular expression - entity references in HTML ought to be terminated with a semicolon Something like s/&#(\d+);/pack("U", $1)/eg; ought to do the trick. If you're using the Perl 5.6 series, you may need to bear in mind that the Unicode semantics are significantly different in the upcoming Perl 5.8. For example, print pack("U", 163); will print a pound sign (ISO-Latin-1 character 163) under 5.8-to-be, but under 5.6 will print a two-byte UTF-8 sequence. If you intend the output to be UTF-8, you may want to add something like eval q{ binmode(STDOUT, ":utf8") } if $] > 5.006; to the beginning of your program. (I added the eval because the second argument to binmode will cause a "Useless use of constant" warning at compile-time under older perls.) Does this help? .robin. -- You are currently subscribed to manchester-pm-list. To unsubscribe, send the following message to majordomo@happyfunball.pm.org: unsubscribe manchester-pm-list From simon.oliver at umist.ac.uk Thu May 16 05:58:38 2002 From: simon.oliver at umist.ac.uk (Simon Oliver) Date: Thu Aug 5 00:07:08 2004 Subject: Perl DBI Seminar References: <3CDF8BBD.E5DA08DC@umist.ac.uk> Message-ID: <3CE390DE.AFB05FD5@umist.ac.uk> Tim Bunce, the author of the Perl DBI will be speaking at UMIST on the 18th June, 2002 on the subject of the Perl DBI. This seminar will focus on specific aspects of his popular tutorial, Advanced DBI. It is aimed at Perl programmers with an understanding of the DBI and a desire to know more. If you would like to attend please contact me before 23rd May, 2002. At this early stage we have the opportunity to direct the focus of the seminar. Tim has suggested we take a vote:- - Performance: Speed, speed, speed: what helps, what doesn't; database design, application partitioning, network latency, stored procedures, caching etc. - New features: Such as DBI::PurePerl, $dbh->begin_work, meta-data methods, DBIx::AnyDBD support, $h->HandleError, latest work, future work - DBI class architecture, Tracing, Error Handling, Transactions. For further details please see: http://pm.bi.umist.ac.uk/activities.html -- Simon Oliver -- You are currently subscribed to manchester-pm-list. To unsubscribe, send the following message to majordomo@happyfunball.pm.org: unsubscribe manchester-pm-list