From lmzaldivar at gmail.com Tue Oct 3 10:35:43 2006 From: lmzaldivar at gmail.com (luis medrano) Date: Tue, 3 Oct 2006 10:35:43 -0700 Subject: SPUG: inserting content into mysql database Message-ID: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> List, I running this code feeding a database: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_title','$post_status','$comment_status','$ping_status','$post_name','$post_modified','$post_modified_gmt','$guid')") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(); but my problem is if any of the values of @post_content or $post_title contain apostrophe the script show this error not executing of feeding the database: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith s secret visits to heir' at line 2 at posting-news.pl anybody knows how can I fix this without removing the apostrophe? Thanks, Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/0f3e4fa4/attachment.html From keith.reed at philips.com Tue Oct 3 10:40:42 2006 From: keith.reed at philips.com (Keith Reed) Date: Tue, 3 Oct 2006 13:40:42 -0400 Subject: SPUG: inserting content into mysql database In-Reply-To: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> Message-ID: Check out dbh->quote() Keith "luis medrano" Sent by: spug-list-bounces+keith.reed=philips.com at pm.org 2006-10-03 10:35 AM To spug-list at pm.org cc Subject SPUG: inserting content into mysql database Classification List, I running this code feeding a database: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_title','$post_status','$comment_status','$ping_status','$post_name','$post_modified','$post_modified_gmt','$guid')") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(); but my problem is if any of the values of @post_content or $post_title contain apostrophe the script show this error not executing of feeding the database: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith s secret visits to heir ' at line 2 at posting-news.pl anybody knows how can I fix this without removing the apostrophe? Thanks, Luis_____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/ef3123d9/attachment.html From jazzdev at gmail.com Tue Oct 3 10:45:32 2006 From: jazzdev at gmail.com (JD Brennan) Date: Tue, 3 Oct 2006 10:45:32 -0700 Subject: SPUG: inserting content into mysql database In-Reply-To: References: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> Message-ID: In SQL you have to double the single quotes. update FOO set X = 'This couldn''t happen to you' of course there'a method in Perl to do it, as Keith mentioned. JD On 10/3/06, Keith Reed wrote: > > > Check out dbh->quote() > > Keith > > > > > > > > *"luis medrano" * > > Sent by: > spug-list-bounces+keith.reed=philips.com at pm.org > > 2006-10-03 10:35 AM > To > spug-list at pm.org cc > > Subject > SPUG: inserting content into mysql database Classification > > > > > > > > > List, > > I running this code feeding a database: > my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, > post_date_gmt, post_content,post_title, post_status, comment_status, > ping_status,post_name, post_modified, post_modified_gmt,guid) > > VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_title','$post_status','$comment_status','$ping_status','$post_name','$post_modified','$post_modified_gmt','$guid')") > or die; # "Couldnt prepare statement: " . dbh->errstr; > > my $rv1 = $sth1->execute(); > > > but my problem is if any of the values of @post_content or $post_title > contain apostrophe the script show this error not executing of feeding the > database: > > DBD::mysql::st execute failed: You have an error in your SQL syntax; check > the manual that corresponds to your MySQL server version for the right > syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith > s secret visits to heir ' at line 2 at posting-news.pl > > anybody knows how can I fix this without removing the apostrophe? > > Thanks, > Luis_____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/3c5974a0/attachment.html From scratchcomputing at gmail.com Tue Oct 3 10:47:50 2006 From: scratchcomputing at gmail.com (Eric Wilhelm) Date: Tue, 3 Oct 2006 10:47:50 -0700 Subject: SPUG: inserting content into mysql database In-Reply-To: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> References: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> Message-ID: <200610031047.50256.ewilhelm@cpan.org> # from luis medrano # on Tuesday 03 October 2006 10:35 am: >anybody knows how can I fix this without removing the apostrophe? placeholders? They seem to be barely mentioned in the DBD::mysql pod, but at least a couple of the do() examples use them. Maybe try the DBI docs http://search.cpan.org/~timb/DBI-1.52/DBI.pm --Eric -- The reasonable man adapts himself to the world; the unreasonable man persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. --George Bernard Shaw --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From pdarley at kinesis-cem.com Tue Oct 3 11:01:35 2006 From: pdarley at kinesis-cem.com (Peter Darley) Date: Tue, 3 Oct 2006 11:01:35 -0700 Subject: SPUG: inserting content into mysql database In-Reply-To: Message-ID: JD, The problem with this is that it leaves you open to other types of SQL injection, which may be an issue or not, depending on where the data is coming from. Also, different dbs have different ways of escaping quotes, so formatting your data by hand loses something in terms of portability. I'd strongly suggest using the quote function if it's good enough in MySQL (which I don't have an opinion about), or use place holders if the quote isn't strong enough. Thanks, Peter Darley -----Original Message----- From: spug-list-bounces+pdarley=kinesis-cem.com at pm.org [mailto:spug-list-bounces+pdarley=kinesis-cem.com at pm.org]On Behalf Of JD Brennan Sent: Tuesday, October 03, 2006 10:46 AM To: spug-list at pm.org Subject: Re: SPUG: inserting content into mysql database In SQL you have to double the single quotes. update FOO set X = 'This couldn''t happen to you' of course there'a method in Perl to do it, as Keith mentioned. JD On 10/3/06, Keith Reed wrote: Check out dbh->quote() Keith "luis medrano" Sent by: spug-list-bounces+keith.reed=philips.com at pm.org 2006-10-03 10:35 AM To spug-list at pm.org cc Subject SPUG: inserting content into mysql database Classification List, I running this code feeding a database: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_t itle','$post_status','$comment_status','$ping_status','$post_name','$post_mo dified','$post_modified_gmt','$guid')") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(); but my problem is if any of the values of @post_content or $post_title contain apostrophe the script show this error not executing of feeding the database: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith s secret visits to heir ' at line 2 at posting-news.pl anybody knows how can I fix this without removing the apostrophe? Thanks, Luis_____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/6c216ed5/attachment-0001.html From kenslinux at shaw.ca Tue Oct 3 11:01:18 2006 From: kenslinux at shaw.ca (Ken Clarke) Date: Tue, 03 Oct 2006 11:01:18 -0700 Subject: SPUG: inserting content into mysql database References: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> Message-ID: <005b01c6e715$ed360df0$1000a8c0@kens> If you are doing much work at all with DBI, I highly recommend Programming the Perl DBI (http://www.oreilly.com/catalog/perldbi/). It's one of the best written technical books I've read (and I've read quite a few :). Take care. >> Ken Clarke >> Contract Web Programmer / E-commerce Technologist >> www.PerlProgrammer.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/d04925f9/attachment.html From spug at punch.net Tue Oct 3 11:15:29 2006 From: spug at punch.net (Tom Heady) Date: Tue, 03 Oct 2006 11:15:29 -0700 Subject: SPUG: inserting content into mysql database In-Reply-To: <200610031047.50256.ewilhelm@cpan.org> References: <50aeae6f0610031035r205c1142k213b7bbe892ddbf6@mail.gmail.com> <200610031047.50256.ewilhelm@cpan.org> Message-ID: <4522A8C1.2030107@punch.net> Eric Wilhelm wrote: > # from luis medrano > # on Tuesday 03 October 2006 10:35 am: > >> anybody knows how can I fix this without removing the apostrophe? > > placeholders? They seem to be barely mentioned in the DBD::mysql pod, > but at least a couple of the do() examples use them. > Example: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute($post_author,$post_date, $post_date_gmt,$post_content,$post_title,$post_status,$comment_status, $ping_status,$post_name,$post_modified,$post_modified_gmt,$guid); Or: use SQL::Abstract; my $fieldvals = { post_author => $post_author, post_date => $post_date, post_date_gmt => $post_date_gmt, post_content => $post_content, post_title => $post_title, post_status => $post_status, comment_status => $comment_status, ping_status => $ping_status, post_name => $post_name, post_modified => $post_modified, post_modified_gmt => $post_modified_gmt, guid => $guid }; my $sql = SQL::Abstract->new; my($stmt, @bind) = $sql->insert("wp_posts", $fieldvals); my $sth1 = $dbh->prepare($stmt) or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(@bind); Tom From pdarley at kinesis-cem.com Tue Oct 3 11:29:43 2006 From: pdarley at kinesis-cem.com (Peter Darley) Date: Tue, 3 Oct 2006 11:29:43 -0700 Subject: SPUG: inserting content into mysql database In-Reply-To: Message-ID: JD, The simplest problem comes when there are multiple escape characters for the quotes. For example, if I have a string that looks like: test\';select 4; and the apostrophes get doubled, it becomes test\'';select 4; and when the quotes are added it becomes 'test\'';select 4;', and this is what I get in my database I see: neo=# select 'test\'';select 4;'; ?column? ---------- test' (1 row) ?column? ---------- 4 (1 row) So, as you see if I replaced ;select 4; with ;delete from my_table;, I would be able to delete everything from my_table. Similarly I could insert stuff into the db, etc. There are probably other chances for sql injection with this weak quoting as well. Thanks, Peter -----Original Message----- From: JD Brennan [mailto:jazzdev at gmail.com] Sent: Tuesday, October 03, 2006 11:09 AM To: Peter Darley Subject: Re: SPUG: inserting content into mysql database I agree that using a quote function specific to your DB is the best. I think it is useful to know what's going on under the covers though, which is why I mentioned that it's doubling the single quotes. What SQL injection attacks are you still open to if you quote the single quotes? I thought that would close that hole. JD On 10/3/06, Peter Darley < pdarley at kinesis-cem.com> wrote: JD, The problem with this is that it leaves you open to other types of SQL injection, which may be an issue or not, depending on where the data is coming from. Also, different dbs have different ways of escaping quotes, so formatting your data by hand loses something in terms of portability. I'd strongly suggest using the quote function if it's good enough in MySQL (which I don't have an opinion about), or use place holders if the quote isn't strong enough. Thanks, Peter Darley -----Original Message----- From: spug-list-bounces+pdarley=kinesis-cem.com at pm.org [mailto:spug-list-bounces+pdarley=kinesis-cem.com at pm.org]On Behalf Of JD Brennan Sent: Tuesday, October 03, 2006 10:46 AM To: spug-list at pm.org Subject: Re: SPUG: inserting content into mysql database In SQL you have to double the single quotes. update FOO set X = 'This couldn''t happen to you' of course there'a method in Perl to do it, as Keith mentioned. JD On 10/3/06, Keith Reed wrote: Check out dbh->quote() Keith "luis medrano" Sent by: spug-list-bounces+keith.reed= philips.com at pm.org 2006-10-03 10:35 AM To spug-list at pm.org cc Subject SPUG: inserting content into mysql database Classification List, I running this code feeding a database: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_t itle','$post_status','$comment_status','$ping_status','$post_name','$post_mo dified','$post_modified_gmt','$guid')") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(); but my problem is if any of the values of @post_content or $post_title contain apostrophe the script show this error not executing of feeding the database: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith s secret visits to heir ' at line 2 at posting-news.pl anybody knows how can I fix this without removing the apostrophe? Thanks, Luis_____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/a9e6416e/attachment.html From pdarley at kinesis-cem.com Tue Oct 3 12:09:05 2006 From: pdarley at kinesis-cem.com (Peter Darley) Date: Tue, 3 Oct 2006 12:09:05 -0700 Subject: SPUG: inserting content into mysql database Message-ID: JD, The simplest problem comes when there are multiple escape characters for the quotes. For example, if I have a string that looks like: test\';select 4; and the apostrophes get doubled, it becomes test\'';select 4; and when the quotes are added it becomes 'test\'';select 4;', and this is what I get in my database I see: neo=# select 'test\'';select 4;'; ?column? ---------- test' (1 row) ?column? ---------- 4 (1 row) So, as you see if I replaced ;select 4; with ;delete from my_table;, I would be able to delete everything from my_table. Similarly I could insert stuff into the db, etc. There are probably other chances for sql injection with this weak quoting as well. Thanks, Peter -----Original Message----- From: JD Brennan [mailto:jazzdev at gmail.com] Sent: Tuesday, October 03, 2006 11:09 AM To: Peter Darley Subject: Re: SPUG: inserting content into mysql database I agree that using a quote function specific to your DB is the best. I think it is useful to know what's going on under the covers though, which is why I mentioned that it's doubling the single quotes. What SQL injection attacks are you still open to if you quote the single quotes? I thought that would close that hole. JD On 10/3/06, Peter Darley < pdarley at kinesis-cem.com> wrote: JD, The problem with this is that it leaves you open to other types of SQL injection, which may be an issue or not, depending on where the data is coming from. Also, different dbs have different ways of escaping quotes, so formatting your data by hand loses something in terms of portability. I'd strongly suggest using the quote function if it's good enough in MySQL (which I don't have an opinion about), or use place holders if the quote isn't strong enough. Thanks, Peter Darley -----Original Message----- From: spug-list-bounces+pdarley=kinesis-cem.com at pm.org [mailto:spug-list-bounces+pdarley=kinesis-cem.com at pm.org]On Behalf Of JD Brennan Sent: Tuesday, October 03, 2006 10:46 AM To: spug-list at pm.org Subject: Re: SPUG: inserting content into mysql database In SQL you have to double the single quotes. update FOO set X = 'This couldn''t happen to you' of course there'a method in Perl to do it, as Keith mentioned. JD On 10/3/06, Keith Reed wrote: Check out dbh->quote() Keith "luis medrano" Sent by: spug-list-bounces+keith.reed= philips.com at pm.org 2006-10-03 10:35 AM To spug-list at pm.org cc Subject SPUG: inserting content into mysql database Classification List, I running this code feeding a database: my $sth1=$dbh->prepare("INSERT INTO wp_posts(post_author, post_date, post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name, post_modified, post_modified_gmt,guid) VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_t itle','$post_status','$comment_status','$ping_status','$post_name','$post_mo dified','$post_modified_gmt','$guid')") or die; # "Couldnt prepare statement: " . dbh->errstr; my $rv1 = $sth1->execute(); but my problem is if any of the values of @post_content or $post_title contain apostrophe the script show this error not executing of feeding the database: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20secret%20visits%20to%20heiress/article.do">Goldsmith s secret visits to heir ' at line 2 at posting-news.pl anybody knows how can I fix this without removing the apostrophe? Thanks, Luis_____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/2a64274f/attachment.html From lmzaldivar at gmail.com Tue Oct 3 13:07:50 2006 From: lmzaldivar at gmail.com (luis medrano) Date: Tue, 3 Oct 2006 13:07:50 -0700 Subject: SPUG: removing a special character Message-ID: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> List, I need to remove this character ' but I'm using linux if I copy paste it will show something like this ??. any idea how can I fix this or how can I just remove everything except numbers and letters? Thanks, luis From mcrawfor at u.washington.edu Tue Oct 3 13:31:48 2006 From: mcrawfor at u.washington.edu (Miles Crawford) Date: Tue, 3 Oct 2006 13:31:48 -0700 (PDT) Subject: SPUG: removing a special character In-Reply-To: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> References: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> Message-ID: Luis, Try something like this: $foo = 'string\' with b at d `chars'; $foo =~ s/[^a-z0-9]//i; But read http://perldoc.perl.org/perlre.html first ;) -miles On Tue, 3 Oct 2006, luis medrano wrote: > List, > > I need to remove this character ' but I'm using linux if I copy paste > it will show something like this ??. any idea how can I fix this or > how can I just remove everything except numbers and letters? > > Thanks, > luis > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From mcrawfor at u.washington.edu Tue Oct 3 13:35:42 2006 From: mcrawfor at u.washington.edu (Miles Crawford) Date: Tue, 3 Oct 2006 13:35:42 -0700 (PDT) Subject: SPUG: removing a special character In-Reply-To: References: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> Message-ID: Crap! How about this instead: $foo = 'string\' with b at d `chars'; $foo =~ s/[^a-z0-9]//ig; I forgot the 'g' - the first one only removed the first bad char. You may also want to add a ' ' to the a-z0-9 bit to preserve spaces. -miles On Tue, 3 Oct 2006, Miles Crawford wrote: > > > Luis, > > Try something like this: > > > $foo = 'string\' with b at d `chars'; > > $foo =~ s/[^a-z0-9]//i; > > But read http://perldoc.perl.org/perlre.html first ;) > > -miles > > > On Tue, 3 Oct 2006, luis medrano wrote: > >> List, >> >> I need to remove this character ' but I'm using linux if I copy paste >> it will show something like this ?. any idea how can I fix this or >> how can I just remove everything except numbers and letters? >> >> Thanks, >> luis >> _____________________________________________________________ >> Seattle Perl Users Group Mailing List >> POST TO: spug-list at pm.org >> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list >> MEETINGS: 3rd Tuesdays >> WEB PAGE: http://seattleperl.org/ > From lmzaldivar at gmail.com Tue Oct 3 13:39:03 2006 From: lmzaldivar at gmail.com (luis medrano) Date: Tue, 3 Oct 2006 13:39:03 -0700 Subject: SPUG: removing a special character In-Reply-To: References: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> Message-ID: <50aeae6f0610031339m3f488a3bge99c19253269000f@mail.gmail.com> Works great, but how I keept the spaces? On 10/3/06, Miles Crawford wrote: > > > > Crap! > > How about this instead: > > $foo = 'string\' with b at d `chars'; > > $foo =~ s/[^a-z0-9]//ig; > > I forgot the 'g' - the first one only removed the first bad char. > > You may also want to add a ' ' to the a-z0-9 bit to preserve spaces. > > -miles > > > > > On Tue, 3 Oct 2006, Miles Crawford wrote: > > > > > > > Luis, > > > > Try something like this: > > > > > > $foo = 'string\' with b at d `chars'; > > > > $foo =~ s/[^a-z0-9]//i; > > > > But read http://perldoc.perl.org/perlre.html first ;) > > > > -miles > > > > > > On Tue, 3 Oct 2006, luis medrano wrote: > > > >> List, > >> > >> I need to remove this character ' but I'm using linux if I copy paste > >> it will show something like this ?. any idea how can I fix this or > >> how can I just remove everything except numbers and letters? > >> > >> Thanks, > >> luis > >> _____________________________________________________________ > >> Seattle Perl Users Group Mailing List > >> POST TO: spug-list at pm.org > >> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > >> MEETINGS: 3rd Tuesdays > >> WEB PAGE: http://seattleperl.org/ > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/3230d0fe/attachment-0001.html From mcrawfor at u.washington.edu Tue Oct 3 13:41:29 2006 From: mcrawfor at u.washington.edu (Miles Crawford) Date: Tue, 3 Oct 2006 13:41:29 -0700 (PDT) Subject: SPUG: removing a special character In-Reply-To: <50aeae6f0610031339m3f488a3bge99c19253269000f@mail.gmail.com> References: <50aeae6f0610031307h362093a6yd4671b0921834090@mail.gmail.com> <50aeae6f0610031339m3f488a3bge99c19253269000f@mail.gmail.com> Message-ID: > Works great, but how I keept the spaces? Read my own reply, or even better read http://perldoc.perl.org/perlre.html ;) -miles > > > > On 10/3/06, Miles Crawford wrote: >> >> >> >> Crap! >> >> How about this instead: >> >> $foo = 'string\' with b at d `chars'; >> >> $foo =~ s/[^a-z0-9]//ig; >> >> I forgot the 'g' - the first one only removed the first bad char. >> >> You may also want to add a ' ' to the a-z0-9 bit to preserve spaces. >> >> -miles >> >> >> >> >> On Tue, 3 Oct 2006, Miles Crawford wrote: >> >> > >> > >> > Luis, >> > >> > Try something like this: >> > >> > >> > $foo = 'string\' with b at d `chars'; >> > >> > $foo =~ s/[^a-z0-9]//i; >> > >> > But read http://perldoc.perl.org/perlre.html first ;) >> > >> > -miles >> > >> > >> > On Tue, 3 Oct 2006, luis medrano wrote: >> > >> >> List, >> >> >> >> I need to remove this character ' but I'm using linux if I copy paste >> >> it will show something like this ?. any idea how can I fix this or >> >> how can I just remove everything except numbers and letters? >> >> >> >> Thanks, >> >> luis >> >> _____________________________________________________________ >> >> Seattle Perl Users Group Mailing List >> >> POST TO: spug-list at pm.org >> >> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list >> >> MEETINGS: 3rd Tuesdays >> >> WEB PAGE: http://seattleperl.org/ >> > >> > From lmzaldivar at gmail.com Wed Oct 4 10:06:02 2006 From: lmzaldivar at gmail.com (luis medrano) Date: Wed, 4 Oct 2006 10:06:02 -0700 Subject: SPUG: xml parsing Message-ID: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> List, I trying to grab the content of xml file is under this tag 1-56592-243-3 but I tried to do it like this: my $isbn=$$item{'book:isbn'}; and returns empty but if I do it like this : my $isbn=$$item{book:isbn}; it gives me this error: syntax error at books.pl line 64, near "{book:" syntax error at books.pl line 185, near "}" Execution of book.pl aborted due to compilation errors. any idea how I can work around this? Thanks, Luis From cwilkes-spug at ladro.com Wed Oct 4 10:18:40 2006 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed, 4 Oct 2006 10:18:40 -0700 Subject: SPUG: xml parsing In-Reply-To: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> References: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> Message-ID: <20061004171840.GB7326@www2.ladro.com> On Wed, Oct 04, 2006 at 10:06:02AM -0700, luis medrano wrote: > List, > I trying to grab the content of xml file is under this tag > 1-56592-243-3 but I tried to do it like this: [ snip ] > any idea how I can work around this? Use a perl module like XML::Simple to handle XML. You'll save yourself the trouble of trying to do it yourself. Chris From charles.e.derykus at boeing.com Wed Oct 4 10:30:19 2006 From: charles.e.derykus at boeing.com (DeRykus, Charles E) Date: Wed, 4 Oct 2006 10:30:19 -0700 Subject: SPUG: xml parsing In-Reply-To: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> Message-ID: >my $isbn=$$item{'book:isbn'}; >and returns empty but if I do it like this : >my $isbn=$$item{book:isbn}; That should be: My $isbn = ${$item{book:isbn}}; Here's some clarification from 'perldoc perldsc': The seemingly equivalent construct in Perl, $$aref[$i] first does the deref of $aref, making it take $aref as a reference to an array, and then dereference that, and finally tell you the i'th value of the array pointed to by $AoA. If you wanted the C notion, you'd have to write "${$AoA[$i]}" to force the $AoA[$i] to get evaluated first before the leading "$" dereferencer. ... -- Charles DeRykus ________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From krahnj at telus.net Wed Oct 4 11:00:34 2006 From: krahnj at telus.net (John W. Krahn) Date: Wed, 04 Oct 2006 11:00:34 -0700 Subject: SPUG: xml parsing In-Reply-To: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> References: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> Message-ID: <4523F6C2.5060603@telus.net> luis medrano wrote: > List, > I trying to grab the content of xml file is under this tag > 1-56592-243-3 but I tried to do it like this: > > my $isbn=$$item{'book:isbn'}; > > and returns empty but if I do it like this : > > my $isbn=$$item{book:isbn}; > > it gives me this error: > > syntax error at books.pl line 64, near "{book:" > syntax error at books.pl line 185, near "}" > Execution of book.pl aborted due to compilation errors. That is because ':' is not a "word" character and so the key has to be quoted like your first example. (Only alphanumeric and underscore characters will be automagically quoted.) Also, the usual way to dereference is: my $isbn = $item->{ 'book:isbn' }; As to why it is empty, it is hard to say. Could 'item' be an actual hash and not a hash reference? John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From tim at consultix-inc.com Wed Oct 4 14:42:24 2006 From: tim at consultix-inc.com (Tim Maher) Date: Wed, 4 Oct 2006 14:42:24 -0700 Subject: SPUG: Advice on sub return-code policies? Message-ID: <20061004214224.GA25541@jumpy.consultix-inc.com> The client I'm working with this week wants to develop a large enterprise application in Perl using a special policy: every sub needs to return a standardized "error code". They won't be writing /everything/ in the OO style, so encapsulating the error codes within objects isn't an attractive choice. Any ideas on how they can comply with their policy without undermining their ability to do normal things, like chain functions together (as in reverse sort keys)? An "out-of-band" delivery mechanism would seem to be needed, but it would have to be sophisticated enough to be usable with multi- threaded apps, and no too inefficient. Are there any CPAN modules that can help? What advice would you offer to a client like this? -Tim *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 10/9: Perl Programming 11/8: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From AEH at akc.org Wed Oct 4 15:08:10 2006 From: AEH at akc.org (Adrian Hands) Date: Wed, 4 Oct 2006 18:08:10 -0400 Subject: SPUG: Advice on sub return-code policies? References: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: <862E491E88FFFE44846C445B4881DD7C7377C6@PUG.ad.akc.org> hmmm...any chance of convincing them to: 1. make a distinction between a "procedural sub", that returns a "standard return code" and a "functional sub", that returns a value useful in an expression or 2. interpret the policy to say the sub needs to throw zero-or-one of a set of standardized "exceptions" ? -----Original Message----- From: spug-list-bounces+aeh=akc.org at pm.org on behalf of Tim Maher Sent: Wed 10/4/2006 5:42 PM To: spug-list at pm.org Subject: SPUG: Advice on sub return-code policies? The client I'm working with this week wants to develop a large enterprise application in Perl using a special policy: every sub needs to return a standardized "error code". They won't be writing /everything/ in the OO style, so encapsulating the error codes within objects isn't an attractive choice. Any ideas on how they can comply with their policy without undermining their ability to do normal things, like chain functions together (as in reverse sort keys)? An "out-of-band" delivery mechanism would seem to be needed, but it would have to be sophisticated enough to be usable with multi- threaded apps, and no too inefficient. Are there any CPAN modules that can help? What advice would you offer to a client like this? -Tim *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 10/9: Perl Programming 11/8: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061004/970989b0/attachment.html From jerry.gay at gmail.com Wed Oct 4 15:28:20 2006 From: jerry.gay at gmail.com (jerry gay) Date: Wed, 4 Oct 2006 15:28:20 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <20061004214224.GA25541@jumpy.consultix-inc.com> References: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: <1d9a3f400610041528i5749e39cqe628bedf7e871adb@mail.gmail.com> On 10/4/06, Tim Maher wrote: > The client I'm working with this week wants to develop a large > enterprise application in Perl using a special policy: every sub needs > to return a standardized "error code". > *every* sub? C destined for use with File::Find? C subroutines? a sub which returns the value of C? this is one place where perl falls down, as there is no standard error reporting mechanism. since there is more than one way to do it, many module authors choose to do it differently. this includes many different ways in core modules, and even core perl ops, as illustrated above. One Way To Do It is very hard to implement in perl, especially when you're using modules written by other authors. perhaps this can be abstracted a bit. suggest a well-defined set of error reporting mechanisms, and standard sets of error codes (perhaps better still one set across reporting mechanisms.) if there's an error reporting framework, enterprise component authors can specify via documentation which error mechanisms they employ, and component users will have a clear idea of what's required to process component errors. ~jerry From MichaelRWolf at att.net Wed Oct 4 22:29:42 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Wed, 4 Oct 2006 22:29:42 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: > The client I'm working with this week wants to develop a large > enterprise application in Perl using a special policy: every sub needs > to return a standardized "error code". [...] > What advice would you offer to a client like this? 1. The nice thing about "standards" is that there are so many to choose from!!!! 2. Or to take liberties with an Alan Perlis epigram.... When someone says "I want a programming language in which I need only say what I wish done", give him a lollipop. Perhaps you can candy coat the request like this... When a user says "I want a system in which every function call is consistent", give him a lollipop. See more Alan Perlis epigrams at: Perlisisms - "Epigrams in Programming" by Alan J. Perlis http://www.cs.yale.edu/quotes.html or Epigrams on Programming http://www-pu.informatik.uni-tuebingen.de/users/klaeren/epigrams.html 3. Take a look at the root problem of trying to get consistent with the flexibility and expressiveness (say "inconsistency") of Perl. I've seen a few discussions of the root problem. See Contextual::Return (or the section in Perl Best Practices) for an extended discussion. Contextual::Return - Create context-senstive return values - search.cpan.org http://search.cpan.org/~dconway/Contextual-Return/lib/Contextual/Return.pm 4. Divide the problem into small enough contexts that "standardized return values" makes sense. I've often heard it said that there is nothing more unfair than treating un-equals as equals. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From MichaelRWolf at att.net Wed Oct 4 22:31:36 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Wed, 4 Oct 2006 22:31:36 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <862E491E88FFFE44846C445B4881DD7C7377C6@PUG.ad.akc.org> Message-ID: > 2. interpret the policy to say the sub needs to throw zero-or-one of a set of standardized "exceptions" Standardized exceptions. I like that!!!! From mike at planetudes.com Thu Oct 5 10:42:58 2006 From: mike at planetudes.com (Mike McLaughlin) Date: Thu, 5 Oct 2006 10:42:58 -0700 (PDT) Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <20061004214224.GA25541@jumpy.consultix-inc.com> References: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: <37382.65.174.224.66.1160070178.squirrel@www.planetudes.com> Any organzization that wants to implement something as silly as this should have a solution such as: linear code with no subroutines. This easily skirts their rules and gives them exactly what they deserve. Tim Maher wrote: Tim Maher wrote: > The client I'm working with this week wants to develop a large > enterprise application in Perl using a special policy: every sub needs > to return a standardized "error code". > > They won't be writing /everything/ in the OO style, so encapsulating > the error codes within objects isn't an attractive choice. > > Any ideas on how they can comply with their policy without undermining > their ability to do normal things, like chain functions together (as > in reverse sort keys)? > > An "out-of-band" delivery mechanism would seem to be needed, but it > would have to be sophisticated enough to be usable with multi- > threaded apps, and no too inefficient. Are there any CPAN modules > that can help? > > What advice would you offer to a client like this? > > -Tim > *-------------------------------------------------------------------* > | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | > | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | > *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* > | UPCOMING CLASSES; 10/9: Perl Programming 11/8: Intermediate Perl | > | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | > | See MinimalPerl.com for details, free chapters, and ordering | > *-------------------------------------------------------------------* > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From MichaelRWolf at att.net Thu Oct 5 10:50:47 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 5 Oct 2006 10:50:47 -0700 Subject: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript Message-ID: What are your favorite code formatters? I've got to do some code reformatting, and wanted to know which ones to research deeper. When _I_ *write* code, I use emacs' built-in cperl-mode, html-mode, and java-mode. I'm mostly happy with them -- they're right there under my finger tips, and they happen automagically. But this is a *rewrite* (or reformat) job, and I'm lazy (one of 3 virtues). I don't want to fat-finger all the code in emacs. What automated (or semi-automated) tools give you the best results? Thanks! -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From MichaelRWolf at att.net Thu Oct 5 11:03:14 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 5 Oct 2006 11:03:14 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <37382.65.174.224.66.1160070178.squirrel@www.planetudes.com> Message-ID: Although I do share a bit of your view (see my previous semi-playful posts), I do think that there *are* subsets of code that work well together, and therefore benefit from a consistent interface (e.g. call parameter positions or names, and return values). Certainly, code above the system call level can reap benefits from consistency like this: Errno - System errno constants - search.cpan.org http://search.cpan.org/~gbarr/Errno/Errno_pm.PL A foolish consistency is the hobgoblin of little minds. -- Ralph Waldo Emerson Emerson does not explain the difference between foolish consistency and wise consistency. Nor could we. That's the balance between art and science that we balance every day in our code. Many folks have never heard the "A foolish" part of this quote, so they consider all consistency to be evil. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From brianwisti at yahoo.com Thu Oct 5 11:03:28 2006 From: brianwisti at yahoo.com (Brian Wisti) Date: Thu, 05 Oct 2006 11:03:28 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <20061004214224.GA25541@jumpy.consultix-inc.com> References: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: <452548F0.3030000@yahoo.com> Tim Maher wrote: > The client I'm working with this week wants to develop a large > enterprise application in Perl using a special policy: every sub needs > to return a standardized "error code". > > They won't be writing /everything/ in the OO style, so encapsulating > the error codes within objects isn't an attractive choice. > > Any ideas on how they can comply with their policy without undermining > their ability to do normal things, like chain functions together (as > in reverse sort keys)? > > An "out-of-band" delivery mechanism would seem to be needed, but it > would have to be sophisticated enough to be usable with multi- > threaded apps, and no too inefficient. Are there any CPAN modules > that can help? > > What advice would you offer to a client like this? > > -Tim I am curious about why they want a standardized error code returned from every function. I think I know why they they think they want it, but maybe there's an easier way to get what they really want without doing it the way they think they want it done. I think. My first thought would be to incorporate a __DIE__ handler and parse the error code from the input to &die. I don't know how efficient or thread-safe that solution is, though. Kind Regards, Brian Wisti http://coolnamehere.com/ From cascadiadude at gmail.com Thu Oct 5 11:25:41 2006 From: cascadiadude at gmail.com (Godfrey .) Date: Thu, 5 Oct 2006 11:25:41 -0700 Subject: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript In-Reply-To: <20061005175110.C29F81797B@x6.develooper.com> References: <20061005175110.C29F81797B@x6.develooper.com> Message-ID: Hello, For JavaScript I have found that Rhino (Java) [http://en.wikipedia.org/wiki/Rhino_%28JavaScript_engine%29] as a very useful tool. I can be extended to indent and to compress javascript. It also provides some error checking of the javascript code. Cheers, Godfrey On 10/5/06, Michael R. Wolf wrote: > What are your favorite code formatters? I've got to do some code > reformatting, and wanted to know which ones to research deeper. > > When _I_ *write* code, I use emacs' built-in cperl-mode, html-mode, and > java-mode. I'm mostly happy with them -- they're right there under my > finger tips, and they happen automagically. > > But this is a *rewrite* (or reformat) job, and I'm lazy (one of 3 virtues). > I don't want to fat-finger all the code in emacs. > > What automated (or semi-automated) tools give you the best results? > > Thanks! > > -- > Michael R. Wolf > All mammals learn by playing! > MichaelRWolf at att.net > > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From aaron at activox.com Thu Oct 5 11:34:11 2006 From: aaron at activox.com (aaron salo) Date: Thu, 05 Oct 2006 11:34:11 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <37382.65.174.224.66.1160070178.squirrel@www.planetudes.com> References: <20061004214224.GA25541@jumpy.consultix-inc.com> <37382.65.174.224.66.1160070178.squirrel@www.planetudes.com> Message-ID: <45255023.3030409@activox.com> And a pony. And ice cream. With sprinkles. :) Mike McLaughlin wrote: > Any organzization that wants to implement something as silly as this > should have a solution such as: > > linear code with no subroutines. This easily skirts their rules and gives > them exactly what they deserve. From cos at indeterminate.net Thu Oct 5 11:51:31 2006 From: cos at indeterminate.net (John Costello) Date: Thu, 5 Oct 2006 11:51:31 -0700 (PDT) Subject: SPUG: Emerson (was Re: Advice on sub return-code policies? In-Reply-To: <20061005180350.36A0A179D2@x6.develooper.com> Message-ID: On Thu, 5 Oct 2006, Michael R. Wolf wrote: > A foolish consistency is the hobgoblin of little minds. > -- Ralph Waldo Emerson > > Emerson does not explain the difference between foolish consistency and wise > consistency. Nor could we. That's the balance between art and science that > we balance every day in our code. > > Many folks have never heard the "A foolish" part of this quote, so they > consider all consistency to be evil. But he did give a hint to his meaning in the full sentence. The part above is only the first clause; the second clause often is dropped. A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. My interpretation is that he was arguing against close-mindedness and impracticality. From itayf at u.washington.edu Thu Oct 5 12:30:49 2006 From: itayf at u.washington.edu (Itay Furman) Date: Thu, 5 Oct 2006 21:30:49 +0200 (IST) Subject: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript In-Reply-To: <20061005175135.8C030179C9@x6.develooper.com> References: <20061005175135.8C030179C9@x6.develooper.com> Message-ID: On Thu, 5 Oct 2006, Michael R. Wolf wrote: > When _I_ *write* code, I use emacs' built-in cperl-mode, html-mode, and > java-mode. I'm mostly happy with them -- they're right there under my > finger tips, and they happen automagically. > > But this is a *rewrite* (or reformat) job, and I'm lazy (one of 3 virtues). > I don't want to fat-finger all the code in emacs. > In emacs: marking the whole buffer, or some region, and then 'M-x ident-region' does save me a lot of work. (After making sure I'm in cperl-mode, or whatever appropriate mode.) There might be some mode-specific functions but I don't remeber for sure -- I always use the above. Cheers, Itay -- Itay Furman phone : +972 (0)2 648 1940 email : itayf at fastmail.fm From bill at celestial.com Thu Oct 5 13:53:51 2006 From: bill at celestial.com (Bill Campbell) Date: Thu, 5 Oct 2006 13:53:51 -0700 Subject: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript In-Reply-To: References: <20061005175135.8C030179C9@x6.develooper.com> Message-ID: <20061005205351.GA7096@alexis.mi.celestial.com> On Thu, Oct 05, 2006, Itay Furman wrote: > > >On Thu, 5 Oct 2006, Michael R. Wolf wrote: > >> When _I_ *write* code, I use emacs' built-in cperl-mode, html-mode, and >> java-mode. I'm mostly happy with them -- they're right there under my >> finger tips, and they happen automagically. >> >> But this is a *rewrite* (or reformat) job, and I'm lazy (one of 3 virtues). >> I don't want to fat-finger all the code in emacs. >> > >In emacs: marking the whole buffer, or some region, and then > 'M-x ident-region' >does save me a lot of work. (After making sure I'm in >cperl-mode, or whatever appropriate mode.) >There might be some mode-specific functions but I don't remeber >for sure -- I always use the above. Cleaning up code like this may well cause more problems than it solves if one has to incorporate updates from a third party as it can render ``patch'' worthless. I've ofen used ``indent'' to clean up third party C code so that I can figure out the program logic. Once I've figured out what's going on, I'll make changes in the original so diff and patch are useful with outside updates. IHMO Stallman standards and emacs tends to create C code that look OK in emacs, but is incomprehensible with a sensible editor like vi :-). Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Systems, Inc. UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ When you have an efficient government, you have a dictatorship. -- Harry Truman From m3047 at inwa.net Thu Oct 5 17:00:51 2006 From: m3047 at inwa.net (Fred Morris) Date: Thu, 5 Oct 2006 17:00:51 -0700 Subject: SPUG: Advice on sub return-code policies? In-Reply-To: <20061004214224.GA25541@jumpy.consultix-inc.com> References: <20061004214224.GA25541@jumpy.consultix-inc.com> Message-ID: <200610051700.51747.m3047@inwa.net> In the present case, I think I'd reframe that as "what advice would you offer to the consultant in a situation like this"? Ok, ok, levity aside... Is the distinction between "sub" and "function" real or carelessness with language? Avoid being careless with language! On Wednesday 04 October 2006 14:42, Tim Maher wrote: > [...] every sub needs > to return a standardized "error code". > > [...] like chain functions together (as > in reverse sort keys)? > > An "out-of-band" delivery mechanism would seem to be needed, but it > would have to be sophisticated enough to be usable with multi- > threaded apps, and no too inefficient. Are there any CPAN modules > that can help? eval() is your friend; of course, you know this. ;-) You might have to put a wrapper around stuff to make it conform. If simply writing results into a hashref (I'm sure there's some way to get at the guts of what is Perl and put keys in the hashref which are tied to the subroutine names) isn't sturdy enough, seems to me you could cook up something akin to a parse tree, and use it to accumulate and track the "useful" output of subroutines. > What advice would you offer to a client like this? Keeping with the reframing, can they cogently explain what they really mean, and are they cognizant of the limitations of this paradigm? You ought to get paid to work through this with them, if they don't have a solid understanding. I would want to explore if there was room for a distinction between functions which return useful function results, and subroutines which can be overloaded to return an error code. You'd have to "sandbox" the functions and aggregate any errors which occured in them, I suppose. Would I recommend this as a good approach? While the individual practices might have utility in certain situations, as a package deal to comply with some hidebound and unexamined corporate policy... I'd examine the policy first. -- Fred Morris http://www.inwa.net/~m3047/contact.html From tim at consultix-inc.com Thu Oct 5 19:24:10 2006 From: tim at consultix-inc.com (Tim Maher) Date: Thu, 5 Oct 2006 19:24:10 -0700 Subject: SPUG: Top 10 reasons for using OOP ? Message-ID: <20061006022410.GA21303@jumpy.consultix-inc.com> Damian Conway once posted a list somewhere providing a set of criteria to use in deciding whether to write an app in the OO or traditional style. It may have been presented as "10 questions to help you decide whether to use OO", or the "top 10 reasons to use OO", or something else along these lines. I've been googling in vain for it; does somebody know where it is? -Tim *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 10/9: Perl Programming 11/8: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From damian at conway.org Thu Oct 5 20:34:31 2006 From: damian at conway.org (Damian Conway) Date: Thu, 05 Oct 2006 20:34:31 -0700 Subject: SPUG: Top 10 reasons for using OOP ? In-Reply-To: <20061006022410.GA21303@jumpy.consultix-inc.com> References: <20061006022410.GA21303@jumpy.consultix-inc.com> Message-ID: <4525CEC7.8050800@conway.org> Tim asked: > Damian Conway once posted a list somewhere providing a set of criteria > to use in deciding whether to write an app in the OO or traditional style. > It may have been presented as "10 questions to help you decide whether to > use OO", or the "top 10 reasons to use OO", or something else along > these lines. > > I've been googling in vain for it; does somebody know where it is? It's been reproduced (and annotated) in several places. Two of which are: http://www.perlmonks.org/?node=91080 http://perltraining.com.au/tips/2005-01-25.html HTH! Damian From MichaelRWolf at att.net Thu Oct 5 21:06:24 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 5 Oct 2006 21:06:24 -0700 Subject: SPUG: Top 10 reasons for using OOP ? In-Reply-To: <4525CEC7.8050800@conway.org> Message-ID: > http://www.perlmonks.org/?node=91080 > http://perltraining.com.au/tips/2005-01-25.html And "Perl Best Practices", pp 318-319. Chapter 15 - "Objects". -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From itayf at u.washington.edu Thu Oct 5 21:15:31 2006 From: itayf at u.washington.edu (Itay Furman) Date: Fri, 6 Oct 2006 06:15:31 +0200 (IST) Subject: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript In-Reply-To: <20061005205351.GA7096@alexis.mi.celestial.com> References: <20061005175135.8C030179C9@x6.develooper.com> <20061005205351.GA7096@alexis.mi.celestial.com> Message-ID: On Thu, 5 Oct 2006, Bill Campbell wrote: > Date: Thu, 5 Oct 2006 13:53:51 -0700 > From: Bill Campbell > To: spug-list at pm.org > Subject: Re: SPUG: tidy in 3 flavors; Perl, HTML, JavaScript > > On Thu, Oct 05, 2006, Itay Furman wrote: >> >> >> On Thu, 5 Oct 2006, Michael R. Wolf wrote: >> >>> When _I_ *write* code, I use emacs' built-in cperl-mode, html-mode, and >>> java-mode. I'm mostly happy with them -- they're right there under my >>> finger tips, and they happen automagically. >>> >>> But this is a *rewrite* (or reformat) job, and I'm lazy (one of 3 virtues). >>> I don't want to fat-finger all the code in emacs. >>> >> >> In emacs: marking the whole buffer, or some region, and then >> 'M-x ident-region' >> does save me a lot of work. (After making sure I'm in >> cperl-mode, or whatever appropriate mode.) >> There might be some mode-specific functions but I don't remeber >> for sure -- I always use the above. > > Cleaning up code like this may well cause more problems than it solves if > one has to incorporate updates from a third party as it can render > ``patch'' worthless. > True. (I do this cleaning only when I "take over" the code.) The problem, though, comes out from _cleaning up the code_ regardless of the tool used for that. > IHMO Stallman standards and emacs tends to create C code that look OK in > emacs, but is incomprehensible with a sensible editor like vi :-). > > Bill As far as I remember the major programming modes allow you to choose between few code layout styles; I think I avoided the default. Itay -- Itay Furman phone : +972 (0)2 648 1940 email : itayf at fastmail.fm From tim at consultix-inc.com Fri Oct 6 06:16:13 2006 From: tim at consultix-inc.com (Tim Maher) Date: Fri, 6 Oct 2006 06:16:13 -0700 Subject: SPUG: Top 10 reasons for using OOP ? In-Reply-To: <20061006040655.1786A1797C@x6.develooper.com> References: <4525CEC7.8050800@conway.org> <20061006040655.1786A1797C@x6.develooper.com> Message-ID: <20061006131613.GA23968@jumpy.consultix-inc.com> On Thu, Oct 05, 2006 at 09:06:24PM -0700, Michael R. Wolf wrote: > > http://www.perlmonks.org/?node=91080 > > http://perltraining.com.au/tips/2005-01-25.html > > And "Perl Best Practices", pp 318-319. Chapter 15 - "Objects". > Michael R. Wolf Thanks, but FYI, in my book it's pages 320-321. *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 10/9: Perl Programming 11/8: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From MichaelRWolf at att.net Sun Oct 8 21:39:33 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Sun, 8 Oct 2006 21:39:33 -0700 Subject: SPUG: CPAN links without version or author Message-ID: All links I find in CPAN have the version number imbedded like this: http://search.cpan.org/~thaljef/Perl-Critic-0.2/lib/Perl/Critic.pm When I want to refer to the module, but make sure that subsequent accesses get the *latest* version, it's easy enough to edit them by hand to something like this (if I don't forget): http://search.cpan.org/~thaljef/Perl-Critic/lib/Perl/Critic.pm But what if the author changes? I've seen links like this. http://search.cpan.org/perldoc?Perl::Critic To my way of thinking (since I'm *thinking* about the module), the link should *only* have the module name in it. That's just good data abstraction. I shouldn't have to know or care who the author is or what the current version is. Does anyone know the guts of CPAN well enough to know if the pubic links are likely to change? And is there a better way (i.e. no manual editing necessary) to grab links to *modules* without manually removing the author and version information? -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From sthoenna at efn.org Mon Oct 9 01:03:55 2006 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Mon, 9 Oct 2006 01:03:55 -0700 Subject: SPUG: CPAN links without version or author In-Reply-To: <20061009044012.348E6177C6@x6.develooper.com> References: <20061009044012.348E6177C6@x6.develooper.com> Message-ID: <20061009080355.GA2488@efn.org> On Sun, Oct 08, 2006 at 09:39:33PM -0700, Michael R. Wolf wrote: > And is there a better way (i.e. no manual editing necessary) to grab links > to *modules* without manually removing the author and version information? I'm not sure what you mean. Grab from where? Is there a reason you can't form http://search.cpan.org/perldoc/Mod::Name links for yourself? On the off chance that you meant links to *distributions*, that would be http://search.cpan.org/dist/Dist-Name. But be aware that that will show the latest version, including developer versions. From MichaelRWolf at att.net Mon Oct 9 08:17:52 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Mon, 9 Oct 2006 08:17:52 -0700 Subject: SPUG: CPAN links without version or author In-Reply-To: <20061009080355.GA2488@efn.org> Message-ID: > I'm not sure what you mean. Grab from where? Maybe this is clearer. Take a look at the text version of the first result for searching for Perl::Critic. Perl::Critic Critique Perl source code for best-practices Perl-Critic-0.2 - 10 Sep 2006 - Jeffrey Ryan Thalhammer The first link "Perl::Critic" *looks* like it's independent of version, so I'd like it to *act* that way: 1. The href part should *not* contain version (or author) information so that I can right-mouse->"copy link location" and get a link that will always take me back to the *current* version of the module. 2. If I traverse that link, I should be able to copy the address line and achieve the same thing. The second link, "Perl-Critic-0.2" *looks* different. It should *act* different. Specifically, it *looks* like it contains version information, so if I copy the link location or follow it, I should be able to use that link to get me back to this version of the module. > Is there a reason you can't form http://search.cpan.org/perldoc/Mod::Name links for yourself? 1. A prime virtue -- laziness. 1a. I don't want to be so diligent. I'm human and prone to errors of omission. 1b. I don't always have tools that make editing the href part of an tag easy. 1c. When I'm using HTML-based (as opposed to text-based) tools, the href part is often hidden from me. I don't like tags whose contents isn't in alignment with the href attribute. 1d. It seem like the kind of repetitive book keeping that I should not have to do. 2. Human factors engineering. If things look different, they should act different. 3. I'd like to have a system that is designed to prevent link rot. Too many version-dependent links will age to point at obsolescent code. I'd like to have the system prevent this problem. From jobs-noreply at seattleperl.org Mon Oct 9 14:17:15 2006 From: jobs-noreply at seattleperl.org (SPUG Jobs) Date: Mon, 9 Oct 2006 14:17:15 -0700 (PDT) Subject: SPUG: Perl Programmer opening, Portland, OR Message-ID: We are looking for a proficient Perl programmer to work in a small team responsible for supporting/extending existing Perl-based enterprise level web site. Prior experience with test-driven development and the ability to work with existing code base is a must. Candidate needs to be able to work both independently and in team setting leveraging development best practices. Requirements: 5+ years of programming experience 2-3+ years of Object Oriented Perl development experience 1+ years of Apache mod_perl development Thorough knowledge of UNIX/Linux operating system *Pay is DOE $30-37/hr and W2 status, will accept 1099 pending acceptable requirements. **This is a 18 month contract opportunity in the Portland, OR area. If you are interested, please send a resume with hourly compensation requirements to; patrick at infogroupnw.com Thanks!! Patrick Schmeckpeper Senior Recruiter INFOGROUP NORTHWEST PHONE: 503.841.9582 |EMAIL: patricks at infogroupnw.com From cos at indeterminate.net Tue Oct 10 21:16:19 2006 From: cos at indeterminate.net (John Costello) Date: Tue, 10 Oct 2006 21:16:19 -0700 (PDT) Subject: SPUG: Tech Books (Perl and other technical goodies) via SPL and KCLS Message-ID: Holders of Seattle Public Library cards may access Safari Books Online, including several Perl books online, using their SPL library cards. If you want to read an entire eBook or just dip into one for reference, they are accessible from , along with the rest of the SPL eBook collection. King County Library System cardholders may access a number of books from Books 24 x 7 at . Books 24 x 7 doesn't offer the ORA books, however. From james at banshee.com Wed Oct 11 08:38:50 2006 From: james at banshee.com (James Moore) Date: Wed, 11 Oct 2006 08:38:50 -0700 Subject: SPUG: Tech Books (Perl and other technical goodies) via SPL and KCLS In-Reply-To: Message-ID: <00b201c6ed4b$596e78a0$6401a8c0@BansheeSoftware.local> Thanks! Had no idea this was a SPL service - that's fantastic! - James From aaron at activox.com Fri Oct 13 08:05:02 2006 From: aaron at activox.com (aaron salo) Date: Fri, 13 Oct 2006 08:05:02 -0700 Subject: SPUG: OT: Ruby Hosting In-Reply-To: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> References: <50aeae6f0610041006w75d97d09jb9c649c637d218e6@mail.gmail.com> Message-ID: <452FAB1E.1070306@activox.com> Since it's pretty quiet, I thought I would risk an off-topic question - does anyone have a recommendation for a reliable outfit that does Ruby on Rails shared web hosting? Extra points if they also offer Subversion. ~!a From apv at sedition.com Fri Oct 13 11:35:35 2006 From: apv at sedition.com (apv) Date: Fri, 13 Oct 2006 11:35:35 -0700 Subject: SPUG: OT: Ruby Hosting In-Reply-To: <452FAB1E.1070306@activox.com> Message-ID: <9D9E3496-5AE9-11DB-A357-003065B0FEEE@sedition.com> I have a partially on topic reply. DreamHost does ROR and Perl on FastCGI. Plus ssh with enough disk space to install just about anything extra you need. This is an associate link for me: http://www.dreamhost.com/r.cgi?apv Or plain: http://www.dreamhost.com/ You can also retroactively give credit after signing up to anyone who uses them which includes some of the core Catalyst crew if you want to support their work. They are *very* inexpensive for what you get but not the most reliable (they do seem to be sincerely trying to iron out lingering problems). -Ashley On Friday, Oct 13, 2006, at 08:05 US/Pacific, aaron salo wrote: > Since it's pretty quiet, I thought I would risk an off-topic question - > does anyone have a recommendation for a reliable outfit that does Ruby > on Rails shared web hosting? Extra points if they also offer > Subversion. > > ~!a > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > From tim at consultix-inc.com Sat Oct 14 09:47:34 2006 From: tim at consultix-inc.com (Tim Maher) Date: Sat, 14 Oct 2006 09:47:34 -0700 Subject: SPUG: Minimal Perl update; free chapters, paperback is shipping Message-ID: <20061014164734.GA4480@jumpy.consultix-inc.com> From: Tim Maher, Consultix Re: Update on "Minimal Perl" book If you like free samples--and who doesn't--you can now download three chapters of Minimal Perl for free, via links at http://MinimalPerl.com: * Perl as a (better) grep Command (Manning Publications web site) * Perl as a (better) find Command (UNIX Review web site) * Scripting Techniques (Manning Publications web site) The paper edition of "Minimal Perl for UNIX/Linux People" began shipping from the publisher (http://manning.com/maher) on Oct 10. I'm told that other booksellers won't have the book in stock for about 3 more weeks, so the publisher is currently the only vendor providing fast delivery. Those preferring digital (and therefore /searchable/) books can buy the E-book for $22.50 at http://manning.com/maher Useful articles on topics that didn't make the final cut for the book due to space limitations are available at http://MinimalPerl.com Reviews of the book are coming soon from people at UNIXreview.com and The Perl Review. Finally, I'll be giving a free talk on Minimal Perl to the Seattle Area System Administrators Guild on November 9th; see http://MinimalPerl.com for further details. -Tim P.S. So far, only 10 typos have been found, which ain't bad for a 504 page book! But more may be lurking between the lines ... *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 11/8-10: Intermediate Perl 12/11: Shell Prog. | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From MichaelRWolf at att.net Sat Oct 14 17:07:18 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Sat, 14 Oct 2006 17:07:18 -0700 Subject: SPUG: Tech Books (Perl and other technical goodies) via SPL and KCLS In-Reply-To: Message-ID: Great. Thanks. I've always thought that giving a card number to spl.org was much more fun than giving a card number to amazon.com!!!! -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net > -----Original Message----- > From: spug-list-bounces+michaelrwolf=att.net at pm.org [mailto:spug-list- > bounces+michaelrwolf=att.net at pm.org] On Behalf Of John Costello > Sent: Tuesday, October 10, 2006 9:16 PM > To: spug-list at pm.org > Subject: SPUG: Tech Books (Perl and other technical goodies) via SPL and > KCLS > > > Holders of Seattle Public Library cards may access Safari Books Online, > including several Perl books online, using their SPL library cards. If > you want to read an entire eBook or just dip into one for reference, they > are accessible from > , > along with the rest of the SPL eBook collection. > > King County Library System cardholders may access a number of books from > Books 24 x 7 at . Books 24 > x 7 doesn't offer the ORA books, however. > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ From MichaelRWolf at att.net Mon Oct 16 13:28:03 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Mon, 16 Oct 2006 13:28:03 -0700 Subject: SPUG: Safari available to ACM Professional Members Message-ID: I just found out that I can have a Safari bookshelf with 10 units as a benefit of ACM membership. Professional Development Centre http://pd.acm.org/ Here's a bit from that page... # Free Online Books The ACM PD Centre now includes 500 selections from the SafariR Enterprise Library. Available to ACM Professional Members, this online repository includes technical books from leading publishers such as O'Reilly, Addison-Wesley, Cisco Press and more. Learn more. The ACM PD Centre also includes a custom collection of 395 online books, powered by Books24x7R. Both ACM Professional and Student Members enjoy free unlimited access to these online volumes on today's most popular IT topics. Learn more. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From asa.martin at gmail.com Mon Oct 16 17:02:03 2006 From: asa.martin at gmail.com (Asa Martin) Date: Mon, 16 Oct 2006 17:02:03 -0700 Subject: SPUG: Quoting Question Message-ID: Hi everyone, Long-time lurker, infrequent poster, but I have this really annoying quoting question. I'm writing a remote SSH script (but not using Net::SSH so any solution can't utilize any special Net::SSH stuff). I log into a remote system using ssh, read a file from the remote system into memory, parse through it line by line, and on certain lines make substitutions. Then I need to write the new file to the system. I am trying to send the changed stuff to the new file using the echo command, but it's not working very well. For example: for my $line (@array_of_lines) if ($line =~ /com2sec\s+.*$stuff_to_match/) { $line =~ s/$stuff_to_match/$new_stuff/; } $ssh->send('echo "$line"'); # this expands stuff I don't want it to! } $stuff_to_match and $new_stuff contain special characters, like quotes, $, @, etc. that I don't want expanded in the regular expression. And $line contains tabs, quotations, special characters, including # signs and $ signs, etc. I'll want the white space and quotes to come across correctly, but any variable names that might be in $line I don't want expanded. Any help would be appreciated. Thanks, Asa P.S. The remote system is a Linux-type box (F5 Load Balancer) so I have the full set of Linux tools available if something better than echo would work. The problem is that I have only that one send() routine of some unknown SSH module. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061016/2e0d8036/attachment.html From asa.martin at gmail.com Mon Oct 16 17:04:47 2006 From: asa.martin at gmail.com (Asa Martin) Date: Mon, 16 Oct 2006 17:04:47 -0700 Subject: SPUG: Quoting Question In-Reply-To: References: Message-ID: The echo line should be: $ssh->send("echo \"$line\" >> $new_file"); That's the line that isn't working right. Thanks! On 10/16/06, Asa Martin wrote: > > Hi everyone, > > Long-time lurker, infrequent poster, but I have this really annoying > quoting question. I'm writing a remote SSH script (but not using Net::SSH so > any solution can't utilize any special Net::SSH stuff). I log into a remote > system using ssh, read a file from the remote system into memory, parse > through it line by line, and on certain lines make substitutions. Then I > need to write the new file to the system. I am trying to send the changed > stuff to the new file using the echo command, but it's not working very > well. > > For example: > > for my $line (@array_of_lines) > if ($line =~ /com2sec\s+.*$stuff_to_match/) { > $line =~ s/$stuff_to_match/$new_stuff/; > } > $ssh->send('echo "$line"'); # this expands stuff I don't want it to! > } > > $stuff_to_match and $new_stuff contain special characters, like quotes, $, > @, etc. that I don't want expanded in the regular expression. And $line > contains tabs, quotations, special characters, including # signs and $ > signs, etc. I'll want the white space and quotes to come across correctly, > but any variable names that might be in $line I don't want expanded. > > Any help would be appreciated. > > Thanks, > > Asa > > P.S. The remote system is a Linux-type box (F5 Load Balancer) so I have > the full set of Linux tools available if something better than echo would > work. The problem is that I have only that one send() routine of some > unknown SSH module. > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061016/0fbd6cc8/attachment.html From bill at celestial.com Mon Oct 16 17:17:54 2006 From: bill at celestial.com (Bill Campbell) Date: Mon, 16 Oct 2006 17:17:54 -0700 Subject: SPUG: Quoting Question In-Reply-To: References: Message-ID: <20061017001754.GA15992@ayn.mi.celestial.com> On Mon, Oct 16, 2006, Asa Martin wrote: > > Hi everyone, > > Long-time lurker, infrequent poster, but I have this really annoying > quoting question. I'm writing a remote SSH script (but not using > Net::SSH so any solution can't utilize any special Net::SSH stuff). I > log into a remote system using ssh, read a file from the remote system > into memory, parse through it line by line, and on certain lines make > substitutions. Then I need to write the new file to the system. I am > trying to send the changed stuff to the new file using the echo > command, but it's not working very well. I generally use rsync for this type of thing because (a) one can easily restrict access to specific directories controlling access by IP address, and (b) it doesn't require potentially dangerous security issues when allowing passwordless unattended operations. rsync remotesystem::remote_module/filename /tmp/filename process filename rsync /tmp/filename remotesystem::remote_module/filename There are a variety of options to rsync that can be used to insure safe copies (it generally creates a new file, renaming it when done so that programs using it won't see a partial file). Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software, LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``The fact is that the Constitution was intended to protect us from the government, and we cannot expect the government to enforce it willingly'' -- Dave E. Hoffmann, Reason Magazine March 2002 From jlb at io.com Mon Oct 16 17:30:02 2006 From: jlb at io.com (Jon Burdge) Date: Mon, 16 Oct 2006 19:30:02 -0500 (CDT) Subject: SPUG: Quoting Question In-Reply-To: References: Message-ID: <20061016192223.Y22971@eris.io.com> I'm not totally clear on what you're using for the module, so it's sort of hard to answer. You're right though that echo is probably not the right choice. There should be some way to open up a program on the remote host and write to the programs STDIN. On the commandline, it would be something like this: cat outfile.txt | ssh user at host 'cat > outfile.txt' How are you reading the file in the first place? I expect it might be somewhat similar. Bill is right, though, that you need to be careful about writing partial files and so on. If you are constrained to this method, using a temporary file then moving it into place over the target filename is usually a safe method. j On Mon, 16 Oct 2006, Asa Martin wrote: > Hi everyone, > > Long-time lurker, infrequent poster, but I have this really annoying quoting > question. I'm writing a remote SSH script (but not using Net::SSH so any > solution can't utilize any special Net::SSH stuff). I log into a remote > system using ssh, read a file from the remote system into memory, parse > through it line by line, and on certain lines make substitutions. Then I > need to write the new file to the system. I am trying to send the changed > stuff to the new file using the echo command, but it's not working very > well. > > For example: > > for my $line (@array_of_lines) > if ($line =~ /com2sec\s+.*$stuff_to_match/) { > $line =~ s/$stuff_to_match/$new_stuff/; > } > $ssh->send('echo "$line"'); # this expands stuff I don't want it to! > } > > $stuff_to_match and $new_stuff contain special characters, like quotes, $, > @, etc. that I don't want expanded in the regular expression. And $line > contains tabs, quotations, special characters, including # signs and $ > signs, etc. I'll want the white space and quotes to come across correctly, > but any variable names that might be in $line I don't want expanded. > > Any help would be appreciated. > > Thanks, > > Asa > > P.S. The remote system is a Linux-type box (F5 Load Balancer) so I have the > full set of Linux tools available if something better than echo would work. > The problem is that I have only that one send() routine of some unknown SSH > module. > From tim at consultix-inc.com Mon Oct 16 21:05:53 2006 From: tim at consultix-inc.com (Tim Maher) Date: Mon, 16 Oct 2006 21:05:53 -0700 Subject: SPUG: Quoting Question In-Reply-To: References: Message-ID: <20061017040553.GA1740@jumpy.consultix-inc.com> On Mon, Oct 16, 2006 at 05:04:47PM -0700, Asa Martin wrote: > The echo line should be: > > $ssh->send("echo \"$line\" >> $new_file"); > > That's the line that isn't working right. Letting the shell see double-quotes around $line is just asking for trouble, if you want it to remain unmolested. The customary approach would be: system "echo '$line'"; or, in your case: $ssh->send("echo '$line' >> '$new_file'"); To understand the issues involved, check out http://TeachMeUnix.com/quoting.html -Tim P.S. I'm teaching a class on Shell Programming from 12/11-13 in Seattle. *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 11/6: Minimal Perl 11/8-10: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From jerry.gay at gmail.com Tue Oct 17 14:00:57 2006 From: jerry.gay at gmail.com (jerry gay) Date: Tue, 17 Oct 2006 14:00:57 -0700 Subject: SPUG: Meeting Announcement -- 17 October 2006 Message-ID: <1d9a3f400610171400p472763fej7498239276824b1f@mail.gmail.com> October 2006 Seattle Perl Users Group (SPUG) Meeting ==================================================== Topic: Harvest Perl Speaker: you! Meeting Date: Tuesday, 17 October 2006 Meeting Time: 6:30 - 8:30 p.m. Location: Whitepages.com offices, downtown Seattle Cost: Admission is free and open to the public Info: http://seattleperl.org/ ==================================================== Please join us Tuesday evening on 17 October 2006 at the regular monthly meeting of the Seattle Perl Users Group. It's fall and the harvest moon is waning. let's take some time to talk about what we've harvested from Perl this season. Come with examples of modules you've used, code you've written, or concepts you've come to understand, and what fruits your labors have bared. Thank you to our hosts at Whitepages.com for giving us a great place to hold our meetings and presentations, to the SPUG-Workers list for making speaker arrangements, to all the SPUG members that show up at meetings or participate on the list to make the group worthwhile in the first place, and all the JAPHs out there for just being. Meeting Location ================ Whitepages.com is located on the 16th floor of the Rainier Square Tower (1301 5th Avenue, Seattle) which is across from the 5th Avenue Theater. See the directions[1] for a quick primer on how to reach us from various locations across Puget Sound. There are plenty of locations to park in the area, including on the street. If you're looking for off-street parking, you can park in the Rainier Square garage which has an entrance on Union St. After 6PM, the building management restricts access to most floors. Our host is trying to take care of this, but if unsuccessful, they will station someone on the 1st floor near the elevator bank and 5th Avenue entrance to let people in. Worst case scenario, give our host a call on his cell phone[2] and he'll run down to let you in. Our hosts are providing a generous assortment of free sodas, fruit drinks, teas, and coffee, and also have some snacks. You definitely won't dehydrate here. We look forward to seeing you! [1] - http://www.whitepagesinc.com/locations/ [2] - 201.220.3139 From tim at consultix-inc.com Wed Oct 18 11:27:44 2006 From: tim at consultix-inc.com (Tim Maher) Date: Wed, 18 Oct 2006 11:27:44 -0700 Subject: SPUG: Current tutorial/reference on Signals? Message-ID: <20061018182744.GA27468@jumpy.consultix-inc.com> SPUGsters, Every once in a while I have a need to make use of Perl signals again in my work, and it's always a frustrating experience, due to the historical differences between Perl versions themselves, and also differences in how they can behave on Sys-V vs. BSD platforms--among other complications. Of course, given recent changes in the way Perl's signaling system works, all the standard documentation on signals seems to be out of date to various degrees (the 2000 Camel; the 2001 Network Programming with Perl, man perlipc, etc.), as are all the on-line tutorials I've seen. So it's hard to predict whether a "legacy" program or an example from one of these classic tomes will actually work properly on one platform consisting of a given Perl version and an OS, let alone on more varied platforms. Using Sys::SigAction for setting all signal handlers and timeouts would seem to have the potential for making these tools both reliable and portable, but I've glanced through the module's code and I haven't seen much going on in there, so I wonder how intelligent this module really is. I'm left wondering whether the "state of the art" in Perl signal handling might still be one that would lead to messy rules such as: "Always use Sys::SigAction's set_sig_handler() to assign a handler, but only use the SA_RESTART option with Perl versions W->X on UNIX or versions Y->Z on Linux, unless you might be interrupting system call N, in which case leave out the SA_RESTART altogether, and just cross your fingers". But maybe I'm just being paranoid 8-{ Can somebody offer some guidelines, or "Best Practices", or actual documentation, on how to use Perl signals reliably and portably with the 5.8.* versions of Perl? TIA, -Tim *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | UPCOMING CLASSES; 11/6: Minimal Perl 11/8-10: Intermediate Perl | | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | | See MinimalPerl.com for details, free chapters, and ordering | *-------------------------------------------------------------------* From tim at consultix-inc.com Wed Oct 18 20:58:56 2006 From: tim at consultix-inc.com (Tim Maher) Date: Wed, 18 Oct 2006 20:58:56 -0700 Subject: SPUG: Signals: Best Practices? In-Reply-To: <20061018182744.GA27468@jumpy.consultix-inc.com> References: <20061018182744.GA27468@jumpy.consultix-inc.com> Message-ID: <20061019035856.GA30800@jumpy.consultix-inc.com> Clarifying the subject, and focusing more, in the hope of sparking some discussion. -Tim On Wed, Oct 18, 2006 at 11:27:44AM -0700, Tim Maher wrote: > SPUGsters, > > Using Sys::SigAction for setting all signal handlers and timeouts > would seem to have the potential for making these tools more reliable > and portable, but .. I wonder how intelligent this module > really is. ... > > Can somebody offer some guidelines, or "Best Practices", or actual > documentation, on how to use Perl signals reliably and portably with > the 5.8.* versions of Perl? > > TIA, > -Tim > *-------------------------------------------------------------------* > | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | > | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | > *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* > | UPCOMING CLASSES; 11/6: Minimal Perl 11/8-10: Intermediate Perl | > | * Check out my new book: "Minimal Perl for UNIX/Linux People" * | > | See MinimalPerl.com for details, free chapters, and ordering | > *-------------------------------------------------------------------* > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ From jay at scherrer.com Sun Oct 22 23:20:48 2006 From: jay at scherrer.com (Jay Scherrer) Date: Sun, 22 Oct 2006 23:20:48 -0700 Subject: SPUG: Extensible Forms Description Language (XFDL) Message-ID: <453C5F40.5040402@scherrer.com> Has anyone on the list heard of an open sourced XFDL viewer / writer. Or has incorporated XFDL into one their applications? Jay Scherrer From sachin_chat at coolgoose.com Mon Oct 23 00:41:23 2006 From: sachin_chat at coolgoose.com (Sachin Chaturvedi) Date: Mon, 23 Oct 2006 13:31:23 +0550 Subject: SPUG: create a array which is XOR of two arrays Message-ID: <1161586883.3238674825@as03.cooltoad.com> i have two arrays @array1 = { t1, t2 , t3 } @array2 = ( t1 , t2 , t5, t7, t8} i want to create a new array which has all elements of array2 such that they are not in array1. i mean my final array should be @final = {t5,t7,t8} From krahnj at telus.net Mon Oct 23 00:40:40 2006 From: krahnj at telus.net (John W. Krahn) Date: Mon, 23 Oct 2006 00:40:40 -0700 Subject: SPUG: create a array which is XOR of two arrays In-Reply-To: <1161586883.3238674825@as03.cooltoad.com> References: <1161586883.3238674825@as03.cooltoad.com> Message-ID: <453C71F8.7000505@telus.net> Sachin Chaturvedi wrote: > i have two arrays > @array1 = { t1, t2 , t3 } > @array2 = ( t1 , t2 , t5, t7, t8} > i want to create a new array which has all elements of array2 such that they > are not in array1. > i mean my final array should be > @final = {t5,t7,t8} $ perl -le' my @array1 = qw{ t1 t2 t3 }; my @array2 = qw( t1 t2 t5 t7 t8 ); my @final = do { my %temp = map { $_, 1 } @array1; grep !$temp{ $_ }++, @array2; }; print "@final"; ' t5 t7 t8 John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From ua at pobox.com Mon Oct 23 14:34:49 2006 From: ua at pobox.com (Joshua Keroes) Date: Mon, 23 Oct 2006 14:34:49 -0700 Subject: SPUG: create a array which is XOR of two arrays Message-ID: On 10/23/06 12:41 AM, "Sachin Chaturvedi" wrote: > i have two arrays { t1, t2 , t3 }, { t1 , t2 , t5, t7, t8} > > i want to create a new array which has all elements of array2 such that they > are not in array1, e.g. {t5,t7,t8} #!/usr/bin/perl -l use strict; use warnings; use Set::Scalar; my $s = Set::Scalar->new( qw[t1 t2 t3] ); my $t = Set::Scalar->new( qw[t1 t2 t5 t7 t8] ); # Take symmetric_difference()/xor/% of both sets # print "$s xor $t = " . ($s % $t); # ...but I don't think you want a true xor, because t3 is present in the results. # # If you want all elements in $t that are not in $s, try: # print "$t intersect $s xor $t = " . ($t * $s % $t); __END__ Output: (t1 t2 t3) xor (t1 t2 t5 t7 t8) = (t3 t5 t7 t8) (t1 t2 t5 t7 t8) intersect (t1 t2 t3) xor (t1 t2 t5 t7 t8) = (t5 t7 t8) From chris_cantrall at yahoo.com Mon Oct 23 14:51:50 2006 From: chris_cantrall at yahoo.com (Chris Cantrall) Date: Mon, 23 Oct 2006 14:51:50 -0700 (PDT) Subject: SPUG: create a array which is XOR of two arrays Message-ID: <20061023215150.30783.qmail@web58310.mail.re3.yahoo.com> Quoting the FAQ: How do I compute the difference of two arrays? How do I compute the intersection of two arrays? Use a hash. Here's code to do both and more. It assumes that each element is unique in a given array: @union = @intersection = @difference = (); %count = (); foreach $element (@array1, @array2) { $count{$element}++ } foreach $element (keys %count) { push @union, $element; push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element; } Note that this is the symmetric difference, that is, all elements in either A or in B but not in both. Think of it as an xor operation. perlfaq4 http://perldoc.perl.org/perlfaq4.html#How-do-I-compute-the-difference-of-two-arrays%3f--How-do-I-compute-the-intersection-of-two-arrays%3f HTH. ----- Original Message ---- From: Sachin Chaturvedi To: spug-list at pm.org Sent: Monday, October 23, 2006 12:41:23 AM Subject: SPUG: create a array which is XOR of two arrays i have two arrays @array1 = { t1, t2 , t3 } @array2 = ( t1 , t2 , t5, t7, t8} i want to create a new array which has all elements of array2 such that they are not in array1. i mean my final array should be @final = {t5,t7,t8} _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From creede at penguinsinthenight.com Tue Oct 24 22:21:40 2006 From: creede at penguinsinthenight.com (Creede Lambard) Date: Tue, 24 Oct 2006 22:21:40 -0700 Subject: SPUG: create a array which is XOR of two arrays In-Reply-To: <1161586883.3238674825@as03.cooltoad.com> References: <1161586883.3238674825@as03.cooltoad.com> Message-ID: <453EF464.60708@penguinsinthenight.com> The quick and dirty version: #!/usr/bin/perl @array1 = ( t1, t2 , t3 ); @array2 = ( t1 , t2 , t5, t7, t8); my %hash = (); foreach $element (@array2) { $hash{$element} = 1; } foreach $element (@array1) { delete $hash{$element}; } @final = keys %hash; Someone is going to chew me out, and rightly so, for not using strict and -w. Sachin Chaturvedi wrote: > i have two arrays > @array1 = { t1, t2 , t3 } > @array2 = ( t1 , t2 , t5, t7, t8} > i want to create a new array which has all elements of array2 such that they > are not in array1. > i mean my final array should be > @final = {t5,t7,t8} > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From krahnj at telus.net Tue Oct 24 22:52:16 2006 From: krahnj at telus.net (John W. Krahn) Date: Tue, 24 Oct 2006 22:52:16 -0700 Subject: SPUG: create a array which is XOR of two arrays In-Reply-To: <453EF464.60708@penguinsinthenight.com> References: <1161586883.3238674825@as03.cooltoad.com> <453EF464.60708@penguinsinthenight.com> Message-ID: <453EFB90.5060605@telus.net> Creede Lambard wrote: > The quick and dirty version: > > #!/usr/bin/perl > > @array1 = ( t1, t2 , t3 ); > @array2 = ( t1 , t2 , t5, t7, t8); > > my %hash = (); > foreach $element (@array2) { $hash{$element} = 1; } > foreach $element (@array1) { delete $hash{$element}; } > > @final = keys %hash; > > Someone is going to chew me out, and rightly so, for not using strict > and -w. Or you could do it without the loops: my %hash; @hash{ @array2 } = (); delete @hash{ @array1 }; @final = keys %hash; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From creede at penguinsinthenight.com Tue Oct 24 23:41:42 2006 From: creede at penguinsinthenight.com (Creede Lambard) Date: Tue, 24 Oct 2006 23:41:42 -0700 Subject: SPUG: create a array which is XOR of two arrays In-Reply-To: <453EFB90.5060605@telus.net> References: <1161586883.3238674825@as03.cooltoad.com> <453EF464.60708@penguinsinthenight.com> <453EFB90.5060605@telus.net> Message-ID: <453F0726.8020407@penguinsinthenight.com> By golly, you learn something new every day if you're not careful. John W. Krahn wrote: > Creede Lambard wrote: > >> The quick and dirty version: >> >> #!/usr/bin/perl >> >> @array1 = ( t1, t2 , t3 ); >> @array2 = ( t1 , t2 , t5, t7, t8); >> >> my %hash = (); >> foreach $element (@array2) { $hash{$element} = 1; } >> foreach $element (@array1) { delete $hash{$element}; } >> >> @final = keys %hash; >> >> Someone is going to chew me out, and rightly so, for not using strict >> and -w. >> > > Or you could do it without the loops: > > my %hash; > @hash{ @array2 } = (); > delete @hash{ @array1 }; > > @final = keys %hash; > > > > John > From trey+spug at lopsa.org Wed Oct 25 09:27:15 2006 From: trey+spug at lopsa.org (Trey Harris) Date: Wed, 25 Oct 2006 09:27:15 -0700 (PDT) Subject: SPUG: create a array which is XOR of two arrays In-Reply-To: <453F0726.8020407@penguinsinthenight.com> References: <1161586883.3238674825@as03.cooltoad.com> <453EF464.60708@penguinsinthenight.com> <453EFB90.5060605@telus.net> <453F0726.8020407@penguinsinthenight.com> Message-ID: <20061025091806.W46238@bowser.eecs.harvard.edu> In a message dated Tue, 24 Oct 2006, Creede Lambard writes: > John W. Krahn wrote: >> Creede Lambard wrote: >> >>> The quick and dirty version: >>> >>> #!/usr/bin/perl >>> >>> @array1 = ( t1, t2 , t3 ); >>> @array2 = ( t1 , t2 , t5, t7, t8); >>> >>> my %hash = (); >>> foreach $element (@array2) { $hash{$element} = 1; } >>> foreach $element (@array1) { delete $hash{$element}; } >>> >>> @final = keys %hash; >>> >>> Someone is going to chew me out, and rightly so, for not using strict >>> and -w. >>> >> >> Or you could do it without the loops: >> >> my %hash; >> @hash{ @array2 } = (); >> delete @hash{ @array1 }; >> >> @final = keys %hash; Either way, it should be noted that you're not preserving the original order of @array2 if you use C. The OP's email did give the final list in order, but did not say whether that was coincidental. If you want ordering preserved though, my %hash; @hash{@array1} = (); my @final = grep { ! exists $hash{$_} } @array2; print "@final\n"; would work. Trey From MichaelRWolf at att.net Wed Oct 25 16:55:59 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Wed, 25 Oct 2006 17:55:59 -0600 Subject: SPUG: Quick/dirty CSV for input to Mac spreadsheet Message-ID: CPAN search for CSV is overwhelming. I just want to output some data (that contains commas) in a comma-separated format so that someone can import it into a Mac excel-look-alike. A quick suggestion? I don't need a detailed analysis. A quick gut reaction of "I've used this and it works" would be fine. Thanks, Michael -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From mcrawfor at u.washington.edu Wed Oct 25 17:05:21 2006 From: mcrawfor at u.washington.edu (Miles Crawford) Date: Wed, 25 Oct 2006 17:05:21 -0700 Subject: SPUG: Quick/dirty CSV for input to Mac spreadsheet In-Reply-To: <20061025235646.45E1F178BD@x6.develooper.com> References: <20061025235646.45E1F178BD@x6.develooper.com> Message-ID: <453FFBC1.1060807@u.washington.edu> I'm a big fan of Text::CSV_XS We use it to produce SPSS-compatible data. -miles Michael R. Wolf wrote: > CPAN search for CSV is overwhelming. I just want to output some data (that > contains commas) in a comma-separated format so that someone can import it > into a Mac excel-look-alike. > > A quick suggestion? I don't need a detailed analysis. A quick gut reaction > of "I've used this and it works" would be fine. > > Thanks, > Michael > From schuh at farmdale.com Wed Oct 25 17:28:04 2006 From: schuh at farmdale.com (Mike Schuh) Date: Wed, 25 Oct 2006 17:28:04 -0700 (PDT) Subject: SPUG: Quick/dirty CSV for input to Mac spreadsheet In-Reply-To: <453FFBC1.1060807@u.washington.edu> References: <20061025235646.45E1F178BD@x6.develooper.com> <453FFBC1.1060807@u.washington.edu> Message-ID: >Michael R. Wolf wrote: > >> CPAN search for CSV is overwhelming. I just want to output some data (that >> contains commas) in a comma-separated format so that someone can import it >> into a Mac excel-look-alike. On Wed, 25 Oct 2006, Miles Crawford wrote: >I'm a big fan of Text::CSV_XS > >We use it to produce SPSS-compatible data. Or just write Excel directly: Spreadsheet::WriteExcel http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.17/lib/Spreadsheet/WriteExcel.pm I've used it many times, including CGI scripts (running on HP-UX) that allow users to download "a database"). Yeah, you wanted CSV, OK ... -- Mike Schuh - Seattle, Washington USA http://www.farmdale.com From offby1 at blarg.net Thu Oct 26 14:49:04 2006 From: offby1 at blarg.net (Eric Hanchrow) Date: Thu, 26 Oct 2006 14:49:04 -0700 Subject: SPUG: Quick/dirty CSV for input to Mac spreadsheet In-Reply-To: <453FFBC1.1060807@u.washington.edu> (Miles Crawford's message of "Wed\, 25 Oct 2006 17\:05\:21 -0700") References: <453FFBC1.1060807@u.washington.edu> Message-ID: <877iymkasv.fsf@offby1.atm01.sea.blarg.net> >>>>> "Miles" == Miles Crawford writes: Miles> I'm a big fan of Text::CSV_XS Works for me, too -- I think that novels that leave out technology misrepresent life as badly as Victorians misrepresented life by leaving out sex. -- Kurt Vonnegut, Jr. From twists at gmail.com Thu Oct 26 20:37:46 2006 From: twists at gmail.com (Joshua ben Jore) Date: Thu, 26 Oct 2006 22:37:46 -0500 Subject: SPUG: Quick/dirty CSV for input to Mac spreadsheet In-Reply-To: <877iymkasv.fsf@offby1.atm01.sea.blarg.net> References: <453FFBC1.1060807@u.washington.edu> <877iymkasv.fsf@offby1.atm01.sea.blarg.net> Message-ID: On 10/26/06, Eric Hanchrow wrote: > >>>>> "Miles" == Miles Crawford writes: > > Miles> I'm a big fan of Text::CSV_XS Text::CSV_XS (maintained by jZed on perlmonks) has the additional benefit of being able to handle newlines embedded in your data. It rocks when you're exporting comment fields and similar multi-line data to CSV for a user to view in Excel or whatever. Josh (who is going to be newly in Seattle sometime in the next few days) From jlb at io.com Sat Oct 28 14:34:22 2006 From: jlb at io.com (Jon Burdge) Date: Sat, 28 Oct 2006 16:34:22 -0500 (CDT) Subject: SPUG: Mason and FCGI Message-ID: <20061028162205.M8454@eris.io.com> I'm trying to setup a Mason site on a host where I need to use FCGI. It's more or less working but I'm having a problem where arguments are persisting across multiple requests. (Like, user1 fills in a form and POSTs his response, user2 selects some random page and the contents of user1's POST is visible on that page in %ARGS.) My fcgi masonhandler is pretty simple, basically this: my $h = HTML::Mason::CGIHandler->new( ... ); my $req = FCGI::Request(); while ($req->Accept() >= 0) { my $env = $req->GetEnvironment(); my $request = $env->{REDIRECT_URL} || '/index.html'; $h->handle_comp($request); } This is more or less copied from an example I found on the web (I've only used Mason in a mod_perl environment before.) Is there something I need to do to reset the environment between requests? I've spent quite a bit of time with perldoc and Data::Dumper and have not made any real progress. Any tips would be welcome. Jon From ppcook at gmail.com Sun Oct 29 17:39:40 2006 From: ppcook at gmail.com (Paul Cook) Date: Sun, 29 Oct 2006 17:39:40 -0800 Subject: SPUG: September meeting question Message-ID: At the September meeting, I think it was Chromatic who mentioned a program for checking/critiquing style of perl programs. I can't find my notes. Anyone recall what that was? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061029/6631d339/attachment.html From jmates at sial.org Sun Oct 29 20:35:44 2006 From: jmates at sial.org (Jeremy Mates) Date: Sun, 29 Oct 2006 20:35:44 -0800 Subject: SPUG: September meeting question In-Reply-To: References: Message-ID: <20061030043544.GB4432@neamh.sial.org> * Paul Cook > At the September meeting, I think it was Chromatic who mentioned a > program for checking/critiquing style of perl programs. I can't find > my notes. Anyone recall what that was? Perl::Critic? http://search.cpan.org/~thaljef/Perl-Critic-0.2/lib/Perl/Critic.pm From twists at gmail.com Sun Oct 29 20:58:31 2006 From: twists at gmail.com (Joshua ben Jore) Date: Sun, 29 Oct 2006 22:58:31 -0600 Subject: SPUG: September meeting question In-Reply-To: <20061030043544.GB4432@neamh.sial.org> References: <20061030043544.GB4432@neamh.sial.org> Message-ID: On 10/29/06, Jeremy Mates wrote: > * Paul Cook > > At the September meeting, I think it was Chromatic who mentioned a > > program for checking/critiquing style of perl programs. I can't find > > my notes. Anyone recall what that was? > > Perl::Critic? Yes, that. There's also B::Lint. It's going to be dual-lifed anyday now. The version in beadperl works on threaded perls and supports plugins. It still doesn't have an extensive library of stuff to look for but it does cover some things that Perl::Critic can't. See also Test::Perl::Critic. Josh From ppcook at gmail.com Sun Oct 29 21:16:15 2006 From: ppcook at gmail.com (Paul Cook) Date: Sun, 29 Oct 2006 21:16:15 -0800 Subject: SPUG: September meeting question In-Reply-To: References: <07D1C280-73EB-4870-9C8B-21DAE87B68D6@concolor.org> Message-ID: I'm new to the list. Didn't notice that replies default back to the replier rather than the list. Thanks for the help! On 10/29/06, Paul Cook wrote: > > that was it > thanks! > > > On 10/29/06, Dan Sabath wrote: > > > > > > On Oct 29, 2006, at 5:39 PM, Paul Cook wrote: > > > > > At the September meeting, I think it was Chromatic who mentioned a > > > program for checking/critiquing style of perl programs. I can't > > > find my notes. Anyone recall what that was? > > > > > I'm pretty sure the one you are thinking of was Perl::Critic. > > Available on the CPAN. > > http://search.cpan.org/dist/Perl-Critic/ > > > > Dan > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061029/b55f3600/attachment.html