From david at cloudgraphics.com Fri Jul 1 12:01:08 2005 From: david at cloudgraphics.com (David Heayn) Date: Fri, 1 Jul 2005 15:01:08 -0400 Subject: [LA.pm] global regex matches In-Reply-To: <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> Message-ID: At 10:56 PM -0700 6/30/05, Peter Benjamin wrote: >At 10:08 PM 6/30/2005, David Heayn wrote: > > $thingie =~ s/$tempURL/$redirLoc\?$encryptName/; > >add a g at the end? > >And the g in the if statement is not going to do what you expect. >So, the g in the statement above will make all the URLs the >same as $encryptName. So I guess I'm lost on this one. I can't figure out how to do a multi-search match tests (within a string) and replace them with a custom new string. So here's the problem again, if you're interested: $string *sometimes* has more than 1 URL inside of it. I need to match each URL instance (always in the form of http://* ) and replace it with a http://...redir?###, where each replacement will have a different redir?#### code. Any pointers? David Heayn * http://www.cloudgraphics.com * 213/925.3283 From pete at peterbenjamin.com Fri Jul 1 12:12:01 2005 From: pete at peterbenjamin.com (Peter Benjamin) Date: Fri, 01 Jul 2005 12:12:01 -0700 Subject: [LA.pm] global regex matches In-Reply-To: References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> Message-ID: <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> At 12:01 PM 7/1/2005, David Heayn wrote: >$string *sometimes* has more than 1 URL inside of it. I need to match >each URL instance (always in the form of http://* ) and replace it >with a http://...redir?###, where each replacement will have a >different redir?#### code. nest a second loop inside the if that loops until no more subs are done. Test if a sub was done or not by comparing the before and after line. Yeah, there are better ways, but I would have to recall them accurately, thus no code from me today. I have class in a few minutes. From david at cloudgraphics.com Mon Jul 4 21:41:07 2005 From: david at cloudgraphics.com (David Heayn) Date: Tue, 5 Jul 2005 00:41:07 -0400 Subject: [LA.pm] regex -ing numbers In-Reply-To: <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> Message-ID: I'm trying to use regex again. This time I haven't a clue where to look. The program is for my personal weather home page. I need to compress lengthy descriptions into little bites that are still useful and then I use the space between forecasts to split out the current day and de-convert everything as an end step. chunk I'm having problems with is below: $conditionsVar = "T-storms 28% chance Chance of T-storms 30% chance Chance of T-storms 21% chance Partly Cloudy Partly Cloudy" # this line doesn't really exist, it's just today's data. $conditionsVar =~ s/Partly Cloudy/PCloudy/ig; # this line works $conditionsVar =~ s/Chance of T-storms (\d{1,2})% chance/ChanceofT-storms($1)%chance/ig; #doesn't work $conditionsVar =~ s/T-storms (\d{1,2})% chance/T-storms($1)%chance/ig; #doesn't work $conditionsVar =~ s/Chance of T-storms/CoTStorms/ig; #this line works #and then, $conditionsVar produces this: T-storms 28% chance CoTStorms 30% chance CoTStorms 21% chance PCloudy PCloudy #$conditionsVar needs to read like the end; PCloudy oh yes- happy 4th to all David Heayn * http://www.cloudgraphics.com * 213/925.3283 From pete at peterbenjamin.com Tue Jul 5 10:29:37 2005 From: pete at peterbenjamin.com (Peter Benjamin) Date: Tue, 05 Jul 2005 10:29:37 -0700 Subject: [LA.pm] regex -ing numbers In-Reply-To: References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> Message-ID: <6.1.2.0.2.20050705102911.05a5c470@peterbenjamin.com> Try changing the \d to [0-9] I do not know why this sometimes work. Or rather why \d does not work. From david at cloudgraphics.com Tue Jul 5 13:20:39 2005 From: david at cloudgraphics.com (David Heayn) Date: Tue, 5 Jul 2005 16:20:39 -0400 Subject: [LA.pm] regex -ing numbers In-Reply-To: <6.1.2.0.2.20050705102911.05a5c470@peterbenjamin.com> References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> <6.1.2.0.2.20050705102911.05a5c470@peterbenjamin.com> Message-ID: At 10:29 AM -0700 7/5/05, Peter Benjamin wrote: >Try changing the \d to [0-9] > >I do not know why this sometimes work. >Or rather why \d does not work. Odd. this seems to work. David Heayn * http://www.cloudgraphics.com * 213/925.3283 From david at cloudgraphics.com Thu Jul 7 14:28:40 2005 From: david at cloudgraphics.com (David Heayn) Date: Thu, 7 Jul 2005 17:28:40 -0400 Subject: [LA.pm] shopping carts In-Reply-To: References: <20050629043637.8A7DA3AA515@ws5-8.us4.outblaze.com> <6.1.2.0.2.20050629001140.090e9b38@peterbenjamin.com> <6.1.2.0.2.20050629203016.036df278@peterbenjamin.com> <6.1.2.0.2.20050630134259.03871c90@peterbenjamin.com> <6.1.2.0.2.20050630225421.0379aa30@peterbenjamin.com> <6.1.2.0.2.20050701121040.072cb0b8@peterbenjamin.com> <6.1.2.0.2.20050705102911.05a5c470@peterbenjamin.com> Message-ID: I was wondering if anyone has had any experience setting up/recommending a shopping cart type program. I've looked around cgi-resources.com a bit and it seems all their programs are geared at physical inventory items. I'm seeking a strictly digital media format where a user could browse through pictures or movie clips with the option of buying them and having them available for immediate download. I'm not really at the point where I want to start thinking about adding DRM encoding to the purchased files. David Heayn * http://www.cloudgraphics.com * 213/925.3283 From rspier at pobox.com Mon Jul 11 21:33:52 2005 From: rspier at pobox.com (Robert Spier) Date: Mon, 11 Jul 2005 21:33:52 -0700 Subject: [LA.pm] FYI: Lightning talks at OSCON 2005 References: <20050711052514.GC2645@panix.com> Message-ID: Lightning Talks at the 2005 O'Reilly Open Source Convention Lightning talks are brief (5-minute) talks that focus on a single example, idea, project, or technique. Lightning talks do not attempt to cover all aspects of their subject matter, but rather to present one facet of the idea clearly and succinctly. To submit a proposal for a lightning talk, please send your proposed title and an abstract of up to four sentences to osc-lt-2005-submit-perl at plover.com For more complete information, visit: http://perl.plover.com/lt/osc2005/ From ask at develooper.com Wed Jul 13 07:26:39 2005 From: ask at develooper.com (=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?=) Date: Wed, 13 Jul 2005 07:26:39 -0700 Subject: [LA.pm] Apache::DBI pings In-Reply-To: References: Message-ID: <71A4F990-2DB8-44F0-BC5F-54589916C0CD@develooper.com> On May 16, 2005, at 3:24 PM, Kevin Scaldeferri wrote: > I was reading through Apache::DBI... you know, for fun... and there > was > something about this snippet that confused me: > > [....] > > I had always assumed that the ping happened every N seconds, but I > came > to realize that it's only if it's been more than N seconds since the > last query. Of course, it turns out it's actually documented that > that > is the case: I was going to make it an option, but I couldn't figure out when the old behavior would be what you want, so in the next version I'm changing it as seen below. - ask =================================================================== --- DBI.pm (revision 1401) +++ DBI.pm (working copy) @@ -110,7 +110,6 @@ and (($now - $LastPingTime{$dsn}) >= $PingTimeOut {$dsn}) ) ? 1 : 0; print STDERR "$prefix need ping: ", $needping == 1 ? "yes" : "no", "\n" if $Apache::DBI::DEBUG > 1; - $LastPingTime{$dsn} = $now; # check first if there is already a database-handle cached # if this is the case, possibly verify the database-handle @@ -118,6 +117,7 @@ # handle in order to avoid problems (dying inside ping) when # RaiseError being on and the handle is invalid. if ($Connected{$Idx} and (!$needping or eval{$Connected{$Idx}- >ping})) { + $LastPingTime{$dsn} = $now; print STDERR "$prefix already connected to '$Idx'\n" if $Apache::DBI::DEBUG > 1; return (bless $Connected{$Idx}, 'Apache::DBI::db'); } @@ -344,7 +344,9 @@ using the ping method (default). Setting the timeout < 0 will de- activate the validation of the database handle. This can be used for drivers, which do not implement the ping-method. Setting the timeout > 0 will ping the -database only if the last access was more than timeout seconds before. +database if the last ping was more than timeout seconds before. +Apache::DBI 0.94 and older would ping only if the last access was more +than timeout seconds before. For the menu item 'DBI connections' you need to call Apache::Status BEFORE Apache::DBI ! For an example of the configuration order see startup.pl. -- http://www.askbjoernhansen.com/ From RNathan at baxglobal.com Thu Jul 14 14:31:41 2005 From: RNathan at baxglobal.com (Ranga Nathan) Date: Thu, 14 Jul 2005 14:31:41 -0700 Subject: [LA.pm] perl and Twisted? Message-ID: Has anyone rolled Perl servers with Twisted (www.twistedmatrix.com)? I like the Twisted framework. POE is mentioned in one of the Twisted articles but POE is something different. Is there an equivalent of Twisted? __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 From rspier at pobox.com Thu Jul 21 18:48:10 2005 From: rspier at pobox.com (Robert Spier) Date: Thu, 21 Jul 2005 18:48:10 -0700 Subject: [LA.pm] Lightning talks deadline extended References: <20050721120653.GC8567@buffy.mag-sol.com> Message-ID: Lightning Talks at the 2005 O'Reilly Open Source Convention Because the submissions process opened so late, I will continue to accept lightning talks submissions up to the last minute. To submit a talk proposal, please send your proposed title and an abstract of up to four sentences to osc-lt-2005-submit-perl at plover.com or contact me in person at OSCON. For more complete information, visit: http://perl.plover.com/lt/osc2005/ Thanks. From cch2cch at netscape.net Thu Jul 28 12:14:02 2005 From: cch2cch at netscape.net (cch2cch@netscape.net) Date: Thu, 28 Jul 2005 15:14:02 -0400 Subject: [LA.pm] list/scalar context Message-ID: <669EE467.419733C5.001D754E@netscape.net> the following statement is similar to the one on P.49 of "Programming Perl" 2nd Edition. $cnt does prodcues a value 3. But it seems a bit counter intuitive to me ( I think it should be a 2). $cnt=(($x,$y)=(1,2,3)); # p.49 "Programming Perl 2nd edition print "cnt=$cnt x=$x y=$y\n"; Particularly when in this statement only two elements survive the assignment. @cnt=(($x,$y)=(1,2,3)); print "array cnt=@cnt\n"; __________________________________________________________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp From Peter at PSDT.com Thu Jul 28 13:29:19 2005 From: Peter at PSDT.com (Peter Scott) Date: Thu, 28 Jul 2005 13:29:19 -0700 Subject: [LA.pm] list/scalar context In-Reply-To: <669EE467.419733C5.001D754E@netscape.net> References: <669EE467.419733C5.001D754E@netscape.net> Message-ID: <6.1.2.0.2.20050728132622.03494988@mail.webquarry.com> At 12:14 PM 7/28/2005, cch2cch at netscape.net wrote: >the following statement is similar to the one on P.49 of "Programming >Perl" 2nd Edition. They're on the 3rd edition now. Catch up :-) >$cnt does prodcues a value 3. But it seems a bit counter intuitive to >me ( I think it should be a 2). p. 75 of the 3rd edition says: List assignment in scalar context returns the number of elements produced by the expression on the *right* side of the assignment. >$cnt=(($x,$y)=(1,2,3)); # p.49 "Programming Perl 2nd edition >print "cnt=$cnt x=$x y=$y\n"; > >Particularly when in this statement only two elements survive the assignment. > >@cnt=(($x,$y)=(1,2,3)); >print "array cnt=@cnt\n"; It depends on whose intuition is talking :-) Usually, I care about this in some expression like if (my($x, $y) = /(...)(...)/) and I certainly do want thaty to evaluate to the number of elements on the RHS, because I already know how many there are on the LHS. But I want to do different things depending on whether or not any elements got assigned. So I recommend you adjust your expectations :-) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ http://www.perlmedic.com/ From david at cloudgraphics.com Fri Jul 29 17:39:13 2005 From: david at cloudgraphics.com (David Heayn) Date: Fri, 29 Jul 2005 20:39:13 -0400 Subject: [LA.pm] stopping wide character In-Reply-To: <6.1.2.0.2.20050728132622.03494988@mail.webquarry.com> References: <669EE467.419733C5.001D754E@netscape.net> <6.1.2.0.2.20050728132622.03494988@mail.webquarry.com> Message-ID: I'm using a perl script off perl.com that explains how to build a simple RSS-> HTML feed service. It works OK visually and functionally, except I keep getting error/warning emails that I can't seem to track down. This has been happening pretty much everyday for the last 2 weeks or so. Envelope-to: david at cloudgraphics.com From: root at rez.androtics.com (Cron Daemon) To: david at cloudgraphics.com Subject: Cron perl /home/cloudgra/www/home/cgi-bin/rss.pl X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: Date: Fri, 29 Jul 2005 16:55:04 -0700 Wide character in print at /home/cloudgra/www/home/cgi-bin/rss.pl line 308. If I look at line 308 it's blank. 307: open(WRITE, "+>$daypop"); 308: 309:# print HTML chunk 310:print WRITE "\n"; 311:print WRITE "\n"; 312:print WRITE "
" . $rss->channel('title') . "
"; Is there a command like chomp to delete wide characters? David Heayn * http://www.cloudgraphics.com * 213/925.3283