From josh at agliodbs.com Tue Jan 2 08:09:23 2007 From: josh at agliodbs.com (Josh Berkus) Date: Tue, 2 Jan 2007 08:09:23 -0800 Subject: [sf-perl] Regex for simple bbcode? Message-ID: <200701020809.23147.josh@agliodbs.com> Folks, Does anyone have a set of regexes to do simple bbcode-to-html conversion? One of the communities I belong to is stuck with shoddy BB software (IdealBB) which mis-processes bbcode, but we do have the ability to hack it. -- Josh Berkus PostgreSQL @ Sun San Francisco From david at fetter.org Tue Jan 2 08:27:27 2007 From: david at fetter.org (David Fetter) Date: Tue, 2 Jan 2007 08:27:27 -0800 Subject: [sf-perl] Regex for simple bbcode? In-Reply-To: <200701020809.23147.josh@agliodbs.com> References: <200701020809.23147.josh@agliodbs.com> Message-ID: <20070102162727.GD1996@fetter.org> On Tue, Jan 02, 2007 at 08:09:23AM -0800, Josh Berkus wrote: > Folks, > > Does anyone have a set of regexes to do simple bbcode-to-html conversion? One > of the communities I belong to is stuck with shoddy BB software (IdealBB) > which mis-processes bbcode, but we do have the ability to hack it. Did you find anything on CPAN that suits? Cheers, D -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From pmui at groundworkopensource.com Tue Jan 2 13:06:21 2007 From: pmui at groundworkopensource.com (Peter Mui) Date: Tue, 2 Jan 2007 13:06:21 -0800 Subject: [sf-perl] Monitoring SIG IV: Weds Jan 10 Message-ID: <64C121D2-0C76-4285-B3CB-FC7F63E5A065@groundworkopensource.com> (Hi, here's the announcement for January's Monitoring SIG. Please forward this along and invite your friends. We've got a really great meeting lined up for this month: see ya there! -Peter) ----------------------------------------------------- January '07 BayLISA Monitoring SIG: Ganglia to Nagios: Bridging the Gap Ganglia Project Lead Matt Massie will be on hand to share how he's seeing Ganglia being used and what new functionality he envisions. Peter Loh and Mayank Patel from GroundWork will show how to unify the best features of Nagios and Ganglia into a highly scalable IT monitoring solution. We'll finish with freeform Q&A where you can take advantage of the assembled wisdom to tackle your thorniest (or most basic) monitoring issues. (If you want to be sure to present your issue email me directly and I'll schedule it.) What: BayLISA Monitoring SIG IV: Ganglia to Nagios: Bridging the Gap Who: Anyone interested in IT monitoring issues and tools: newbies particularly welcome! When: Wednesday, January 10 2007, 7PM Where: GroundWork Open Source, 139 Townsend St., San Francisco How: 139 Townsend St. is very near AT&T Park. It is two blocks from the CalTrain Depot. Take the MUNI N trolley "inbound" to 2nd and King (ballpark stop) or take the 15 or 30 buses (among others) crosstown. Free evening street parking can usually be found. New Year's pizza, pop, and snacks will be provided by GroundWork. We'll open up the doors at 6:30 or so and start the formal part of the meeting promptly at 7PM. RSVP (not necessary, but helpful): Peter Mui, pmui at groundworkopensource.com, 415 992 4573 ----------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070102/e2d99a89/attachment.html From qw at sf.pm.org Thu Jan 4 14:30:32 2007 From: qw at sf.pm.org (Quinn Weaver) Date: Thu, 4 Jan 2007 14:30:32 -0800 Subject: [sf-perl] [job] PHP contract (full-time, ~3 months) Message-ID: <20070104223032.GA28248@fu.funkspiel.org> I just talked to a prospect. Aside from the work I'd be doing, he needs a good PHP contractor ASAP. This is not up my alley, so I thought I'd mail the list. The situation is this: he's part of a very young start-up (just completed series A). They make server management software. He has an intial version he's hacked up; now he needs to make it into a product for release to customers this quarter. Yes, it's insane. If you feel like taking on a major crash deadline and racking up lots of billable hours, this job is for you. So he wants to make quick changes to the PHP front-end. He needs someone who's up to speed with PHP, obviously. SOAP experience is a plus; the PHP front-end is speaking to a business logic layer (written in C++) that's all encapsulated in SOAP. SQL knowledge is also a plus; in a few cases the front-end does speak directly to the business logic layer's database, for performance reasons. I'm sure there's someone in here who has these skills. If you're interested, please mail him directly at engr-jobs at fastscale.com , including "UIE" in the Subject line. Just say "Quinn sent me." ;) He prefers resumes in PDF, but that's not a requirement. This combined job description has more details, but it's somewhat misleading; it's mostly for a separate job that I'm gunning for: http://sfbay.craigslist.org/sby/sof/255850378.html . Best regards, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From qw at sf.pm.org Sun Jan 14 17:53:24 2007 From: qw at sf.pm.org (Quinn Weaver) Date: Sun, 14 Jan 2007 17:53:24 -0800 Subject: [sf-perl] [job] Full-time Perl marketing analytics gig Message-ID: <20070115015323.GA25643@fu.funkspiel.org> I'm forwarding this at the request of the company offering the job. Please contact them directly if you're interested. PS: Coming soon: a dinner meeting (January 23). Details to follow. ----- Forwarded message from Joanna Samuels ----- Subject: aCerno, Senior Software Engineer role (OO Perl) Date: Wed, 10 Jan 2007 14:39:39 -0800 From: Joanna Samuels To: quinn at fairpath.com Hi Quinn, My name is Joanna Samuels and I am an Account Manager for aCerno, a marketing analytics company. aCerno is a wholly-owned subsidiary of I-Behavior, and helps companies target advertising and locate new online customers through the use of non-personally identifiable shopping and purchase behavior. aCerno is looking for a Senior Software Engineer, with a specialty in Perl and OO Perl. I am attaching the job description below. If anyone is interested in this position, please contact me at (415)982-5500 x 131 or via email at Joanna at gravitypeople.com. Thank you. Senior Software Engineer - San Francisco, CA Summary: aCerno (http://www.acerno.com) is looking for a highly motivated senior software engineer to join our team. You will experience the benefits of working at a start up - a small team of people with many years of direct marketing and Internet experience, a very focused mission, outstanding customers and as much responsibility as you demonstrate desire and capability to handle, without the funding risks typically encountered with start ups. This is a critical position - you will have responsibility for the design and development of a number of Internet-based applications required in our business. In particular, you will have the opportunity to work on UI-intensive customer-centered web applications and as well as applications that provide high performance, highly scalable, real time behavioral classification. Requirements: * 5+ years software development experience with Perl and 2+ years of OO Perl coding experience. * 1+ years of RDBMS experience in a Unix/Linux environment (schema design exp is ideal) * Good skills in object-oriented design and working with complex data structures * Prior experience building software applications that demonstrate a level of development versatility and creativity along with sensitivity to user interactions, workflow, and application performance (this is not just a scripting position) * Excellent verbal and written communication skills - demonstrating the ability to clearly and concisely communicate technical concepts, ideas and details to technical and non-technical individuals * BSCS/EE or equivalent * Travel - about 1 week per quarter. This position is based in San Francisco. Relocation and visa sponsorship are not available. Our compensation and benefits offerings are competitive and include medical and dental insurance, 401(K), and three weeks of paid vacation. More information about who we are and what we are doing will be provided during the interview process. Joanna Samuels Gravity V:(415)982-5500 ext.131 joanna at gravitypeople.com www.gravitypeople.com ----- End forwarded message ----- From david at fetter.org Mon Jan 15 12:14:31 2007 From: david at fetter.org (David Fetter) Date: Mon, 15 Jan 2007 12:14:31 -0800 Subject: [sf-perl] Internationalizing a Perl application Message-ID: <20070115201431.GE10489@fetter.org> Kind people, With DBI-Link's growing popularity world-wide, I'm getting more requests for translation of the docs and strings. This presents a huge bunch of opportunities for me to make mistakes, so I'm asking for the collective wisdom out there. * Where do I start? * What are some good techniques for dividing the work? * What am I going to stub my toes on no matter what I do? * What pains can I avoid, and how? Cheers, Dave. -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From matt at cloudfactory.org Mon Jan 15 12:54:05 2007 From: matt at cloudfactory.org (Matthew Lanier) Date: Mon, 15 Jan 2007 12:54:05 -0800 (PST) Subject: [sf-perl] Internationalizing a Perl application In-Reply-To: <20070115201431.GE10489@fetter.org> References: <20070115201431.GE10489@fetter.org> Message-ID: [ posted to sfpug only, i certainly can't post on the other pugs ] David- first, congrats on needing to internationalize DBI-Link. that's a good sign. As for the docs, have you run them through babbelfish or something of that ilk? if the results are sufficient, I question the need to translate them now, and to continue translating future revisions, as you could instruct folks to babbelfish it themselves. As for the strings (are you talking about error codes and such), can you make them constants and map the constants to descriptive error strings in the docs? good luck... m@ On Mon, 15 Jan 2007, David Fetter wrote: > Kind people, > > With DBI-Link's growing popularity world-wide, I'm getting more > requests for translation of the docs and strings. This presents a > huge bunch of opportunities for me to make mistakes, so I'm asking for > the collective wisdom out there. > > * Where do I start? > > * What are some good techniques for dividing the work? > > * What am I going to stub my toes on no matter what I do? > > * What pains can I avoid, and how? > > Cheers, > Dave. > -- Matthew D. P. K. Strelchun-Lanier matt at cloudfactory.org http://www.bearlywornpacifica.com From qw at sf.pm.org Mon Jan 15 15:06:51 2007 From: qw at sf.pm.org (Quinn Weaver) Date: Mon, 15 Jan 2007 15:06:51 -0800 Subject: [sf-perl] Internationalizing a Perl application In-Reply-To: References: <20070115201431.GE10489@fetter.org> Message-ID: <20070115230651.GB33954@fu.funkspiel.org> On Mon, Jan 15, 2007 at 12:54:05PM -0800, Matthew Lanier wrote: > > [ posted to sfpug only, i certainly can't post on the other pugs ] > > David- > > first, congrats on needing to internationalize DBI-Link. that's a good > sign. > > As for the docs, have you run them through babbelfish or something of that > ilk? if the results are sufficient, I question the need to translate them > now, and to continue translating future revisions, as you could instruct > folks to babbelfish it themselves. Bad idea. Babelfish can barely handle the most basic English, and technical writing will foul it up beyond belief. Babelfish is so bad that laughing at its incomprehensible translations has become a party game. :) > As for the strings (are you talking about error codes and such), can you > make them constants and map the constants to descriptive error strings in > the docs? Good idea. For error codes, there should be a localized human-readable explanation, but there should also be an invariant code. That way client code (if there's any kind of API or log) will work no matter what the locale. If you're writing a log, you should begin messages with a number (the constant Matt mentions). If people are writing client code against your API, it's a must to die with object-oriented exceptions, rather than strings. Perl Best Practices explains how to do this; see p. 287, OO Exceptions (in Chapter 13, Error Handling). I'm not sure exactly how this applies to DBI-Link--would people write "client" code against it?--but David can figure out that part. As to the rest... I have prepared a lengthy email with a bunch of advice, ubt I'm waiting to get subscribed to all the CC'ed lists so I can send it out all at once. Hold in there... Best regards, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From david at fetter.org Mon Jan 15 15:24:51 2007 From: david at fetter.org (David Fetter) Date: Mon, 15 Jan 2007 15:24:51 -0800 Subject: [sf-perl] Internationalizing a Perl application In-Reply-To: <20070115230651.GB33954@fu.funkspiel.org> References: <20070115201431.GE10489@fetter.org> <20070115230651.GB33954@fu.funkspiel.org> Message-ID: <20070115232451.GJ10489@fetter.org> On Mon, Jan 15, 2007 at 03:06:51PM -0800, Quinn Weaver wrote: > On Mon, Jan 15, 2007 at 12:54:05PM -0800, Matthew Lanier wrote: > > > > [ posted to sfpug only, i certainly can't post on the other pugs ] > > > > David- > > > > first, congrats on needing to internationalize DBI-Link. that's a > > good sign. > > > > As for the docs, have you run them through babbelfish or something > > of that ilk? if the results are sufficient, I question the need > > to translate them now, and to continue translating future > > revisions, as you could instruct folks to babbelfish it > > themselves. > > Bad idea. Babelfish can barely handle the most basic English, and > technical writing will foul it up beyond belief. Babelfish is so > bad that laughing at its incomprehensible translations has become a > party game. :) OK, I'll just use Babelfish for its entertainment value :) > > As for the strings (are you talking about error codes and such), > > can you make them constants and map the constants to descriptive > > error strings in the docs? > > Good idea. For error codes, there should be a localized > human-readable explanation, but there should also be an invariant > code. That way client code (if there's any kind of API or log) will > work no matter what the locale. I'm unclear as to the differences between locale and encoding, but I'm thinking that for a given PostgreSQL database where the software is installed, it should have sane defaults for error messages. > If you're writing a log, you should begin messages with a number > (the constant Matt mentions). OK, I'll see what I can do about this. I suspect SQL error codes may play a part. > If people are writing client code against your API, it's a must to > die with object-oriented exceptions, rather than strings. Perl Best > Practices explains how to do this; see p. 287, OO Exceptions (in > Chapter 13, Error Handling). > > I'm not sure exactly how this applies to DBI-Link--would people > write "client" code against it?--but David can figure out that part. Depends what you mean by "client" code. DBI-Link is a little like DBI, except that I can't really picture what "subclassing" it would mean. Generally, people use SQL with DBI-Link, and it's usually so transparent that they may not even know it's installed. > As to the rest... I have prepared a lengthy email with a bunch of > advice, ubt I'm waiting to get subscribed to all the CC'ed lists so > I can send it out all at once. Hold in there... Thanks :) (Cheers|Sant??|Salud|????????????), D -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From Peter.Loo at source.wolterskluwer.com Mon Jan 15 15:31:11 2007 From: Peter.Loo at source.wolterskluwer.com (Loo, Peter # PHX) Date: Mon, 15 Jan 2007 16:31:11 -0700 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ Message-ID: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> Hello, I am getting the following error when I hit the following record when trying to m// the field "[NO". my $field = substr($_, $offset, $length); elsif ($field =~ m/^[0-9]*\s+[0-9]$/ || $field =~ m/\W+/) { When I leave in the part "|| $field =~ m/\W+/)" the error goes away, but without this, I am getting an error. 0000080476714676AF544C3730FF17377E381D0A40C89E6F66CC177078B2A87BFA71BE03 9EMB3E31BEC6707E4E64C36955F9A980C0E F299A8CB68A3A3AB571225CAB9A85D0D4193401[NO20060704Y2006070510000003 Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ Your input will be greatly appreciated. Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070115/72895ada/attachment.html From david at fetter.org Mon Jan 15 15:53:01 2007 From: david at fetter.org (David Fetter) Date: Mon, 15 Jan 2007 15:53:01 -0800 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> Message-ID: <20070115235301.GK10489@fetter.org> On Mon, Jan 15, 2007 at 04:31:11PM -0700, Loo, Peter # PHX wrote: > > Hello, Hi > I am getting the following error when I hit the following record when trying > to m// the field "[NO". > > my $field = substr($_, $offset, $length); > > elsif ($field =~ m/^[0-9]*\s+[0-9]$/ || $field =~ m/\W+/) { ^^^^^^^^^^^^^^^^^^^ This is better written as $field =~ m( \A # Start \d* # 0 or more digits \s+ # some whitespace \d # a digit \z # End )mx > When I leave in the part "|| $field =~ m/\W+/)" the error goes away, but > without this, I am getting an error. It would help a lot if you sent a self-contained example that we could test :) Cheers, D (who just hates working too hard) -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From Peter.Loo at source.wolterskluwer.com Mon Jan 15 15:58:46 2007 From: Peter.Loo at source.wolterskluwer.com (Loo, Peter # PHX) Date: Mon, 15 Jan 2007 16:58:46 -0700 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <20070115235301.GK10489@fetter.org> Message-ID: <8E3D502A002DA04FADBDED4CB4D94D3A029AFCB1@phxmail02.phx.ndchealth.com> Here you go: while () { chomp(); my $str1 = substr($_, 0, $offset); my $str2 = substr($_, $offset+$length); my $field = substr($_, $offset, $length); if ($field =~ m/^\s+$/ || $field =~ m/^[0-9]+$/) { print OFH "$_\n"; next; } elsif ($field =~ m/^[0-9]+\s+$/ || $field =~ m/^\s+[0-9]+$/) { $field =~ s/\s+//g; $field = sprintf("%0${length}d", $field); } elsif ($field =~ m/^[0-9]+\s+[0-9]$/) { $field = ""; $field = sprintf("%${length}s", $field); } else { $field =~ s/$field//g; <============ THIS IS WHERE THE PROBLEM OCCURS. $field = sprintf("%${length}s", $field); } my $outStr = $str1 . $field . $str2; print OFH "$outStr\n"; #print "field now is: $field\n"; print "AFTER: $outStr\n\n"; } Peter -----Original Message----- From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org [mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or g] On Behalf Of David Fetter Sent: Monday, January 15, 2007 4:53 PM To: San Francisco Perl Mongers User Group Subject: Re: [sf-perl] Unmatched [ in regex;marked by <-- HERE in m/[ <-- HERE NO/ On Mon, Jan 15, 2007 at 04:31:11PM -0700, Loo, Peter # PHX wrote: > > Hello, Hi > I am getting the following error when I hit the following record when trying > to m// the field "[NO". > > my $field = substr($_, $offset, $length); > > elsif ($field =~ m/^[0-9]*\s+[0-9]$/ || $field =~ m/\W+/) { ^^^^^^^^^^^^^^^^^^^ This is better written as $field =~ m( \A # Start \d* # 0 or more digits \s+ # some whitespace \d # a digit \z # End )mx > When I leave in the part "|| $field =~ m/\W+/)" the error goes away, > but without this, I am getting an error. It would help a lot if you sent a self-contained example that we could test :) Cheers, D (who just hates working too hard) -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! _______________________________________________ SanFrancisco-pm mailing list SanFrancisco-pm at pm.org http://mail.pm.org/mailman/listinfo/sanfrancisco-pm This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message. From qw at sf.pm.org Mon Jan 15 16:14:37 2007 From: qw at sf.pm.org (Quinn Weaver) Date: Mon, 15 Jan 2007 16:14:37 -0800 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> Message-ID: <20070116001437.GB34456@fu.funkspiel.org> On Mon, Jan 15, 2007 at 04:31:11PM -0700, Loo, Peter # PHX wrote: > Hello, > > I am getting the following error when I hit the following record when > trying to m// the field "[NO". > [...] Hi, Peter, I can't replicate your problem using the code you posted. For me, it works with or without the "|| $field =~ m/\W+/)" part. (Without it, the regex doesn't match, but it doesn't die with a compilation error.) I suspect you may have a syntax error. Check your code carefully. It may be that you've accidentally chopped off the / that ends the regex, or something. The code should look like this: Variant 1: > elsif ($field =~ m/^[0-9]*\s+[0-9]$/ || $field =~ m/\W+/) { Variant 2: > elsif ($field =~ m/^[0-9]*\s+[0-9]$/) { If that doesn't help, please post more of the surrounding code, and we'll have another crack at it. Thanks, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From quinn at fairpath.com Mon Jan 15 16:22:20 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Mon, 15 Jan 2007 16:22:20 -0800 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A029AFCB1@phxmail02.phx.ndchealth.com> References: <20070115235301.GK10489@fetter.org> <8E3D502A002DA04FADBDED4CB4D94D3A029AFCB1@phxmail02.phx.ndchealth.com> Message-ID: <20070116002220.GC27659@tao.fairpath.com> On Mon, Jan 15, 2007 at 04:58:46PM -0700, Loo, Peter # PHX wrote: > > Here you go: This code doesn't work, because variables like $offset and $length are defined somewhere else. PS: Testing post from address quinn at fairpath.com... -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ From asary at liveops.com Mon Jan 15 16:27:23 2007 From: asary at liveops.com (Al Sary) Date: Mon, 15 Jan 2007 16:27:23 -0800 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <20070116001437.GB34456@fu.funkspiel.org> References: <8E3D502A002DA04FADBDED4CB4D94D3A029AFC8A@phxmail02.phx.ndchealth.com> <20070116001437.GB34456@fu.funkspiel.org> Message-ID: <45AC1BEB.4000909@liveops.com> Sorry if I'm missing some context, but the problem seems pretty clear: $ perl -e '$f=qq/[/; s/$f//' Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE / at -e line 1. A \Q should fix it: $ perl -e '$f=qq/[/; s/\Q$f//' In other words: > $field =~ s/$field//g; <============ THIS IS WHERE THE >PROBLEM OCCURS. > > $field =~ s/\Q$field//g; (disclaimer: I didn't try to understand what you are trying to do) Quinn Weaver wrote: >On Mon, Jan 15, 2007 at 04:31:11PM -0700, Loo, Peter # PHX wrote: > > >>Hello, >> >>I am getting the following error when I hit the following record when >>trying to m// the field "[NO". >> >> > > > >>[...] >> >> > >Hi, Peter, > >I can't replicate your problem using the code you posted. For me, it >works with or without the "|| $field =~ m/\W+/)" part. (Without >it, the regex doesn't match, but it doesn't die with a compilation >error.) > >I suspect you may have a syntax error. Check your code carefully. >It may be that you've accidentally chopped off the / that ends the >regex, or something. The code should look like this: > >Variant 1: > > > >>elsif ($field =~ m/^[0-9]*\s+[0-9]$/ || $field =~ m/\W+/) { >> >> > >Variant 2: > > > >>elsif ($field =~ m/^[0-9]*\s+[0-9]$/) { >> >> > >If that doesn't help, please post more of the surrounding code, and >we'll have another crack at it. > >Thanks, > >-- >qw (Quinn Weaver); #President, San Francisco Perl Mongers >=for information, visit http://sf.pm.org/weblog =cut >_______________________________________________ >SanFrancisco-pm mailing list >SanFrancisco-pm at pm.org >http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > > From Peter.Loo at source.wolterskluwer.com Mon Jan 15 16:28:03 2007 From: Peter.Loo at source.wolterskluwer.com (Loo, Peter # PHX) Date: Mon, 15 Jan 2007 17:28:03 -0700 Subject: [sf-perl] Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE NO/ In-Reply-To: <20070116002220.GC27659@tao.fairpath.com> Message-ID: <8E3D502A002DA04FADBDED4CB4D94D3A029AFCC7@phxmail02.phx.ndchealth.com> Here is the whole program. Notice that I have changed the code a bit per your recommendation. :D if ( $#ARGV < 3 ) { print "ERROR: Wrong number of arguments\n"; print "Example: $0 inputFile outputFile offset length\n"; print " $0\n"; print " ndm_parsed_dim_0010000003_0001016913_0000003660.3660\n"; print " ndm_parsed_dim_0010000003_0001016913_0000003660.3660.out\n"; print " 230\n"; print " 3\n"; exit(1); } my $inputFile = $ARGV[0]; my $outputFile = $ARGV[1]; my $offset = $ARGV[2] - 1; my $length = $ARGV[3]; unless (open(IFH, "$inputFile")) { print "ERROR: Unable to open $inputFile for reading.\n"; exit(1); } unless (open(OFH, "> $outputFile")) { print "ERROR: Unable to open $outputFile for writing.\n"; exit(1); } while () { chomp(); my $str1 = substr($_, 0, $offset); my $str2 = substr($_, $offset+$length); my $field = substr($_, $offset, $length); if ( $field =~ m(\A\s+\z)mx || $field =~ m(\A\d+\z)mx ) { print OFH "$_\n"; next; } elsif ( $field =~ m(\A\d+\s+\z)mx || $field =~ m(\A\s+\d+\z)mx ) { $field =~ s/\s+//g; $field = sprintf("%0${length}d", $field); } elsif ( $field =~ m(\A\d+\s+\d\z)mx ) { $field = ""; $field = sprintf("%${length}s", $field); } else { $field =~ s/$field//g; <=== THE FAILURE AREA... $field = sprintf("%${length}s", $field); } my $outStr = $str1 . $field . $str2; print OFH "$outStr\n"; } close(IFH); close(OFH); exit(0); Peter -----Original Message----- From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org [mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or g] On Behalf Of Quinn Weaver Sent: Monday, January 15, 2007 5:22 PM To: San Francisco Perl Mongers User Group Subject: Re: [sf-perl] Unmatched [ in regex;marked by <-- HERE in m/[ <-- HERE NO/ On Mon, Jan 15, 2007 at 04:58:46PM -0700, Loo, Peter # PHX wrote: > > Here you go: This code doesn't work, because variables like $offset and $length are defined somewhere else. PS: Testing post from address quinn at fairpath.com... -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ _______________________________________________ SanFrancisco-pm mailing list SanFrancisco-pm at pm.org http://mail.pm.org/mailman/listinfo/sanfrancisco-pm This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message. From quinn at fairpath.com Mon Jan 15 18:02:07 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Mon, 15 Jan 2007 18:02:07 -0800 Subject: [sf-perl] Internationalizing a Perl application Message-ID: <20070116020207.GB28294@tao.fairpath.com> On Mon, Jan 15, 2007 at 12:14:31PM -0800, David Fetter wrote: > Kind people, > > With DBI-Link's growing popularity world-wide, I'm getting more > requests for translation of the docs and strings. This presents a > huge bunch of opportunities for me to make mistakes, so I'm asking for > the collective wisdom out there. I have many individual clues. Hopefully they add up to something useful. First of all, you really have two tasks: I) translate the documentation, which basically just requires some human translators, and II) translate the strings in the program, which requires some human translators plus retrofitting DBI-Link with internationalization and localization (I18N / L10N) code. Don't worry; it's not painful. Now, some definitions. These all apply to task II. I'm giving them because you asked the difference between locale and encoding; forgive me if I'm repeating the obvious. A. locale: the "culture" in which your app is running--for instance Spanish, American English, or British English. Locales determine language, and sometimes things like number formatting (think 3,14 versus 3.14). Probably you just have to worry about language. There's an RFC that defines the familiar two-letter codes for locales, like es, en-US, and en-GB. See http://en.wikipedia.org/wiki/Locale . Your program finds out what locale it's running in by querying the operating environment somehow. You'll want to use some library like GNU gettext that will take care of these details for you. B. internationalization (a.k.a. I18N): the process of (re)writing your app so that it can support different locales. In common practice (e.g. with gettext), this means wrapping all your English strings with some function that will return the English in an English locale, and the appropriate translation in any other locale. Of course, this requires a database of translation strings, which brings us to... C. localization (a.k.a. L10N): the process of adding translations. First you internationalize it; then you add a database of translation strings for Italian, a database for Chinese, et cetera. There's a nice separation of concerns, so that you just add a new file for each new language; you don't have to change your actual code, and, in fact, you can accept localization databases (or "modules") from non-coders, which is just what you want to do. So much for I18N and L10N. Now on to encoding, a separate issue: D. encoding: how you represent a language on the level of bits and bytes. Familiar encodings are ASCII, UTF-8 (one of several Unicode encodings), and ISO-Latin-1. You don't need to know much about these, because you want to use UTF-8, a Unicode encoding. Trust me. E. Unicode: a standardized character set that encompasses all the written languages of the world (well, all the ones that someone's bothered defining standards for. There's space for many more. People are actively reserving that space and adding new languages, like Tibetan). Unicode has become _the_ standard encoding for written language. It's supported much more widely than anything else. F: UTF-8: the most popular way of encoding Unicode. One big advantage of UTF-8 is that it's a proper superset of ASCII. That means all ASCII strings are already UTF-8. (For languages like Chinese which have many characters, UTF-8 uses a special "escape" character followed by multibyte characters.) Encoding summary: use UTF-8 and don't worry about it. :) (You may need to alter your regexes slightly, but this is true for any encoding besides ASCII. I'll explain further later on.) Now, with these definitions out of the way, I'll take a stab at your other questions: > * Where do I start? 1. Probably the people who are requesting translations are the very people most able to provide them. They're contacting you in English to make the request, right? And they're native speakers of the target language? They're certainly motivated, and they probably have contacts among other DBI-Link users (e.g. at work) who are also native speakers. In other words, when people ask "Why aren't there docs in Portuguese?" you say, "Because you haven't written them yet." ;) 1a. If they're willing, send them the English localization module file, and have them translate it into their native language (written in UTF-8, of course). This is easy; it's just a bunch of strings. 1b. It may be harder to get them to commit to translating the documentation, but if they're willing, great! 1c. If they can't do it, ask them if they know someone who can. 2. There have been attempts to mount organized translation projects for (e.g.) the Linux HOWTOs. I don't know how successful these have been. You should try searching for "translation project" or "Linux translation project", or the like. > * What are some good techniques for dividing the work? 3. From a linguistic perspective, give translators full control. Your role is to accept and present/distribute what they produce. 3a. Temper this with instant peer review. Use a wiki or some other user-editable format so other native speakers can improve and clarify. 4. From a technical perspective, GNU gettext is popular among C programmers. As I wrote earlier, it lets you write and maintain a separate localization module for each language, without mucking with the code. This is a good model. If you have to use it, you're in pretty good shape. 4b. There is a Gettext module on CPAN that interfaces to GNU gettext. As a side note, it's written by James Briggs, who used to run Silicon Valley Perl Mongers (dormant since August). 4c. There may be something even better. Perl Monks is a good place to ask about what is really useful. > * What am I going to stub my toes on no matter what I do? 5. To get proper Unicode support, you must use Perl 5.8 or higher. However, I think DBI-Link already has this requirement--right? So maybe it's not an issue. > * What pains can I avoid, and how? 6. Use UTF-8! Picking an encoding used to be a big issue, but UTF-8's wide adoption solves that problem. 6a. That said, you'll have to learn how to handle Unicode properly in your Perl code, including your regexes. 6a(i). Advanced Perl Programming (Second Edition only) has a chapter on Unicode. I see this by looking up the Table of Contents in Safari. I haven't read that chapter, but you should check it out. 6a(ii). Perl Best Practices p. 248 says you should use Unicode character classes within regexes, using the \p{} syntax (because character classes like [A-Za-z] won't capture all Unicode). man perlunicode(1) for details. 7. Wherever possible, recruit native speakers of your target languages. If you use non-native translators, no matter how fluent they are, they will make mistakes. These can range from amusing (think of all those badly translated Japanese video games) to downright confusing. 7a. On the other hand, bad translation are better than no translations. If you can't find a native speaker, and someone else is volunteering, let them go for it. Again, always use a wiki (or similar) format so people can make corrections. OK, I hope all that helps. I know it's somewhat desultory. You can see there are big gaps in what I know, but I hope you can pick up on some of these leads. If they prove helpful, consider including me in the DBI-Link credits. Good luck, -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ President, San Francisco Perl Mongers http://sf.pm.org/ From david at fetter.org Wed Jan 17 12:38:08 2007 From: david at fetter.org (David Fetter) Date: Wed, 17 Jan 2007 12:38:08 -0800 Subject: [sf-perl] fwd: Internationalizing a Perl application In-Reply-To: <45ACE907.1090907@ngo.org.uk> References: <20070115201431.GE10489@fetter.org> <4c714a9c0701151219p56c90d56k33fc3c55497e12e7@mail.gmail.com> <45ACE907.1090907@ngo.org.uk> Message-ID: <20070117203808.GJ20683@fetter.org> Folks, I'd like to get this one in the archives. Thanks to Nik Clayton of London.pm for this, and to David Alban for asking London.pm about it :) Cheers, D On Tue, Jan 16, 2007 at 03:02:31PM +0000, Nik Clayton wrote: > >With DBI-Link's growing popularity world-wide, I'm getting more > >requests for translation of the docs and strings. This presents a > >huge bunch of opportunities for me to make mistakes, so I'm asking for > >the collective wisdom out there. > > > >* Where do I start? > > Ignoring the documentation aspect, and just dealing with your application's > output for the time being. > > You need to: > > a) Have a mechanism that, given a string-code, can return the correct > version of that string given the users preferred language choice. > > b) Have a mechanism to allow users to specify their preferred language. > > c) Have translations of your strings available. > > For (a) and (b) I recommend using Locale::Maketext::Simple, which does most > of the hard work for you. This supports keeping your translations in > separate files (en.po for English, fr.po for French, and so on), and, given > a string, finds the translation of that string. > > It handles most of the hard work concerning what to do with different > languages and how they behave with things like plurals. > > I do this in SVN::Web. Internally, any string that might be displayed to > the user is represented as "(short string)" -- I use brackets because it > makes it obvious in the user interface if an untranslated string is being > displayed. > > Then the proper representations of those strings (even the English ones) > are kept in separate files. Locale::Maketext::Simple provides loc_lang() > (to set the current language) and loc() (to look up a strings > representation in the language dictionary). So the code looks something > like: > > my $lang = get_users_preferred_language(); # 'en', 'fr', etc > > loc_lang($lang); # Set the preferred language > > print loc('(choose repos)'); > > If $lang is 'en' then it will look in the English dictionary, which has > this entry; > > msgid "(choose repos)" > msgstr "Please select a repository to browse:" > > fr.po has this in it. > > msgid "(choose repos)" > msgstr "Veuillez selectionner le depot parcourir :" > > Same message id, different message string. > > You can either use Locale::Maketext::Simple as is, or you can subclass it > if you need new functionality. I had to do that in SVN::Web, where I need > to be able to add new paths to language dictionaries at runtime. You can > see the resulting code in SVN::Web::I18N. > > So, broadly: > > 1. Get Locale::Maketext::Simple working > > 2. Use loc_lang() to set the current language > > 3. Replace code like > > print "This is a string"; > > with code like > > print loc("(this-is-a-string)"); > > and in en.po have > > msgid "(this-is-a-string)" > msgstr "This is a string" > > You don't have to use the same convention with braces that I have. > > You can do variable interpolation in to translated strings using %1, %2, %3 > placeholders. For example, given this entry in the .po file: > > msgid "(file not found: %1 %2)" > msgstr "File '%1' could not be found in directory '%2'" > > you'd write code like so: > > print loc('(file not found: %1 %2)', $file, $directory); > > Suppose you then want to change the output. The code stays the same, but > the msgstr becomes: > > msgstr "Directory %2 does not contain file %1" > > Your dictionary can also specify many alternatives depending on the value > of a parameter. For example, suppose you want to write: > > my $duration = a_long_process(); > print "Process took $duration seconds"; > > But you might be on really fast hardware, and it only took one second. > Typically you might solve that with: > > print "Process took $duration second" . $duration != 1 ? 's' : ''; > > With message dictionaries you can put that logic in the dictionary instead. > > print loc('(%1 second)'); # in the code > > msgid "(%1 second)" > msgstr "%quant(%1, second, seconds)" > > See SVN::Web::I18N for code, Locale::Maketext::TPJ13 for an article from > "The Perl Journal" which should help make some of this clear. > > Hope that helps, > > N -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From quinn at fairpath.com Wed Jan 17 13:38:32 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Wed, 17 Jan 2007 13:38:32 -0800 Subject: [sf-perl] Trustworthy laptop repair? Message-ID: <20070117213832.GA4687@tao.fairpath.com> Hi, all, Last night I hosed my Thinkpad by plugging it into a start-up's power socket. Apparently there was a spike or something, because my display filled up with garbage, and then the whole thing locked up. Now it doesn't boot reliably and, when it does, it locks up randomly* (especially if I move it). I guess that part of my circuitry is fried. Setting aside the legal issues for a moment, I need to get this fixed. Does anyone know of a good laptop repair joint in the Bay Area? I'm willing to travel to a place that's considerably clueful and reliable. Many thanks, Q * Note, this is not normal behavior; it's running Linux, not Windows. ;) -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ From quinn at fairpath.com Wed Jan 17 15:07:01 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Wed, 17 Jan 2007 15:07:01 -0800 Subject: [sf-perl] Trustworthy laptop repair? In-Reply-To: <20070117213832.GA4687@tao.fairpath.com> References: <20070117213832.GA4687@tao.fairpath.com> Message-ID: <20070117230701.GB5606@tao.fairpath.com> Update: it turns out that my laptop is still covered by IBM warranty (a surprise, since it's an older model I bought on eBay). I'm sending it in for repairs. I'll report back when all is done. -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ From fred at redhotpenguin.com Wed Jan 17 15:09:45 2007 From: fred at redhotpenguin.com (Fred Moyer) Date: Wed, 17 Jan 2007 15:09:45 -0800 (PST) Subject: [sf-perl] Trustworthy laptop repair? In-Reply-To: <20070117230701.GB5606@tao.fairpath.com> References: <20070117213832.GA4687@tao.fairpath.com> <20070117230701.GB5606@tao.fairpath.com> Message-ID: On Wed, 17 Jan 2007, Quinn Weaver wrote: > Update: it turns out that my laptop is still covered by IBM warranty (a > surprise, since it's an older model I bought on eBay). I'm sending it in for > repairs. I'll report back when all is done. One thing you might want to do is pickup an external case for a 2.5 inch drive, remove the drive from your laptop, install it in the case, and backup your data. I know of several people who have sent their laptops in for repairs, and as a treat they got a brand new hard drive (with windows installed!). From quinn at fairpath.com Wed Jan 17 15:26:31 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Wed, 17 Jan 2007 15:26:31 -0800 Subject: [sf-perl] [sfpug] Trustworthy laptop repair? In-Reply-To: References: <20070117213832.GA4687@tao.fairpath.com> <20070117230701.GB5606@tao.fairpath.com> Message-ID: <20070117232629.GA3854@tao.fairpath.com> On Wed, Jan 17, 2007 at 03:09:45PM -0800, Fred Moyer wrote: > On Wed, 17 Jan 2007, Quinn Weaver wrote: > > >Update: it turns out that my laptop is still covered by IBM warranty (a > >surprise, since it's an older model I bought on eBay). I'm sending it in for > >repairs. I'll report back when all is done. > > One thing you might want to do is pickup an external case for a 2.5 inch drive, > remove the drive from your laptop, install it in the case, and backup your > data. I know of several people who have sent their laptops in for repairs, and > as a treat they got a brand new hard drive (with windows installed!). Yeah, I was planning to do something like this (to IBM's credit, they warned me about this possibility). I suppose if I just dd from the hard drive to a file, and then dd back to the new hard drive, it'll work... yes? Then I won't have to reinstall Ubuntu, all its updates, non-free stuff like Flash, my /etc backups, and so on... Will this approach work? I plan to do some research on my own, but do you know of any caveats? Thanks for the tips. You guys are awesome. :) -- Quinn Weaver DBA Fairpath http://fairpath.com/quinn/contact/ From fred at redhotpenguin.com Wed Jan 17 15:45:07 2007 From: fred at redhotpenguin.com (Fred Moyer) Date: Wed, 17 Jan 2007 15:45:07 -0800 (PST) Subject: [sf-perl] [sfpug] Trustworthy laptop repair? In-Reply-To: <20070117232629.GA3854@tao.fairpath.com> References: <20070117213832.GA4687@tao.fairpath.com> <20070117230701.GB5606@tao.fairpath.com> <20070117232629.GA3854@tao.fairpath.com> Message-ID: On Wed, 17 Jan 2007, Quinn Weaver wrote: > On Wed, Jan 17, 2007 at 03:09:45PM -0800, Fred Moyer wrote: >> On Wed, 17 Jan 2007, Quinn Weaver wrote: >> data. I know of several people who have sent their laptops in for repairs, and >> as a treat they got a brand new hard drive (with windows installed!). > > Yeah, I was planning to do something like this (to IBM's credit, they > warned me about this possibility). > > I suppose if I just dd from the hard drive to a file, and then dd back to the > new hard drive, it'll work... yes? Then I won't have to reinstall Ubuntu, > all its updates, non-free stuff like Flash, my /etc backups, and so on... > > Will this approach work? I plan to do some research on my own, > but do you know of any caveats? Only thing I can think of is that there may be bad blocks on your drive as a result of the zappage, so the dd may not go as cleanly as expected. But then again, rsync would behave strangely also if the drive has physical oddities. Suggest also rsyncing the contents with checksumming enabled as plan b. From extasia at extasia.org Fri Jan 19 08:03:30 2007 From: extasia at extasia.org (David Alban) Date: Fri, 19 Jan 2007 08:03:30 -0800 Subject: [sf-perl] Browser front ends to perl back ends Message-ID: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Greetings, I'm a command line person. I use things like X Windows and screen so that I can get more command lines. The tools I have written over the years are command line tools. My users have been command line people. Now I'm in a situation where half my users are command line oriented, and half don't use it at all, and are not likely to start. I need to write tools that cause and/or foster building of java code and cause and/or foster the deployment of code and build artifacts from a source code repository to different environments (dev, qa, production equivalent, production). I plan to write command line perl tools. Command line perl tools that can be called from web front ends. That way the same set of tools can be used both by command line folks and by gui-only folks. I have no experience in developing browser-used thingamabobs. I've written html, sure, but only for basic web pages. No moving parts (well, O.K., one animated gif :-). My requirements for a front end are simple: * it has to be something which can run from a browser (say, IE or firefox) * it has to be able to call command line perl programs Nice-to-haves would be: * doesn't take too long to learn (my current plans don't include becoming a web developer). the front end is for internal use only, it doesn't have to have bells, whistles or sex appeal, it just needs to work well * should be as platform-independent as possible Is CGI the way to go for this? Is PHP? Is ? I realize that asking this on a perl list is bound to tip the scale in favor of CGI, but I wanted to ask anyway, figuring a significant number of folks might be able to give good advice on the subject. Thanks, David P.S. I'm not considering perl/tk because I want the tools to be operable from any web browser on the local network. Plus, most of the windows users won't have an X server running. -- Live in a world of your own, but always welcome visitors. From david at fetter.org Fri Jan 19 08:20:23 2007 From: david at fetter.org (David Fetter) Date: Fri, 19 Jan 2007 08:20:23 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Message-ID: <20070119162023.GO23996@fetter.org> On Fri, Jan 19, 2007 at 08:03:30AM -0800, David Alban wrote: > Greetings, > > I'm a command line person. I use things like X Windows and screen so > that I can get more command lines. The tools I have written over the > years are command line tools. My users have been command line people. > > Now I'm in a situation where half my users are command line oriented, > and half don't use it at all, and are not likely to start. I need to > write tools that cause and/or foster building of java code and cause > and/or foster the deployment of code and build artifacts from a source > code repository to different environments (dev, qa, production > equivalent, production). I plan to write command line perl tools. > Command line perl tools that can be called from web front ends. That > way the same set of tools can be used both by command line folks and > by gui-only folks. > > I have no experience in developing browser-used thingamabobs. I've > written html, sure, but only for basic web pages. No moving parts > (well, O.K., one animated gif :-). > > My requirements for a front end are simple: > > * it has to be something which can run from a browser (say, IE or firefox) > * it has to be able to call command line perl programs > > Nice-to-haves would be: > > * doesn't take too long to learn (my current plans don't include > becoming a web developer). the front end is for internal use only, it > doesn't have to have bells, whistles or sex appeal, it just needs to > work well > * should be as platform-independent as possible > > Is CGI the way to go for this? Is PHP? Is altogether>? I realize that asking this on a perl list is bound to > tip the scale in favor of CGI, You're more likely to get recommendations for FastCGI or mod_perl here. You can use CGI.pm and cousins in any case :) > but I wanted to ask anyway, figuring a significant number of folks > might be able to give good advice on the subject. > > Thanks, > David > > P.S. I'm not considering perl/tk because I want the tools to be > operable from any web browser on the local network. Plus, most of > the windows users won't have an X server running. I seem to recall that Tk can be made to run on Windows, but the last time I tried programming Tk in perl, I got scars on my frontal lobes. Cheers, D > -- > Live in a world of your own, but always welcome visitors. > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From asary at liveops.com Fri Jan 19 08:54:28 2007 From: asary at liveops.com (Al Sary) Date: Fri, 19 Jan 2007 08:54:28 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Message-ID: <45B0F7C4.7070704@liveops.com> Ideally you'd want to use mod_perl with a templating tool like HTML::Template, which is pretty simple. For anything more substantial, I'd look into HTML::Mason. David Alban wrote: >Greetings, > >I'm a command line person. I use things like X Windows and screen so >that I can get more command lines. The tools I have written over the >years are command line tools. My users have been command line people. > >Now I'm in a situation where half my users are command line oriented, >and half don't use it at all, and are not likely to start. I need to >write tools that cause and/or foster building of java code and cause >and/or foster the deployment of code and build artifacts from a source >code repository to different environments (dev, qa, production >equivalent, production). I plan to write command line perl tools. >Command line perl tools that can be called from web front ends. That >way the same set of tools can be used both by command line folks and >by gui-only folks. > >I have no experience in developing browser-used thingamabobs. I've >written html, sure, but only for basic web pages. No moving parts >(well, O.K., one animated gif :-). > >My requirements for a front end are simple: > > * it has to be something which can run from a browser (say, IE or firefox) > * it has to be able to call command line perl programs > >Nice-to-haves would be: > > * doesn't take too long to learn (my current plans don't include >becoming a web developer). the front end is for internal use only, it >doesn't have to have bells, whistles or sex appeal, it just needs to >work well > * should be as platform-independent as possible > >Is CGI the way to go for this? Is PHP? Is altogether>? I realize that asking this on a perl list is bound to >tip the scale in favor of CGI, but I wanted to ask anyway, figuring a >significant number of folks might be able to give good advice on the >subject. > >Thanks, >David > >P.S. I'm not considering perl/tk because I want the tools to be >operable from any web browser on the local network. Plus, most of the >windows users won't have an X server running. > > From friedman at highwire.stanford.edu Fri Jan 19 09:05:44 2007 From: friedman at highwire.stanford.edu (Michael Friedman) Date: Fri, 19 Jan 2007 09:05:44 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Message-ID: <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> I work in a similar environment -- the software developers like command-line tools, but the production staff (the ones who bring in the revenue!) are not so facile in Unix, so they need web-based tools. We've decided to use a 3-part model for developing our internal software: 1. Perl modules that do all the "real work". So, for a database update operation, we write a (or several) modules that take user input, do the updates, and produce text output. 2. Perl scripts that run on the command-line that wrap the modules. These scripts are *very* short and lightweight. They handle reading the parameters (Getopt::*), passing them to the modules, and doing minor reformatting of the output text. 3. Perl CGI scripts that run on the web server that wrap the modules. These are also very short and lightweight. They usually have two "modes": when called with no parameters (or only a couple of background ones) they return a form for the user to fill out; when you submit the form it goes back to the same CGI which then passes the parameters to the modules and does HTML formatting of the output text. By making modules for the text->HTML transformations, so that code is shared, and being pretty standard with the implementation, the CGI scripts are not any longer than the command-line scripts. In this model, you only write code to do the actual work once, in a module. Then you put two pretty much boilerplate front-ends on it for people to use. We had originally looked at using the command-line "fake out" that CGI.pm offers, so we'd just write the CGI script and let command-line users use it, but we decided that getting HTML text as output on the command-line was... sub-optimal. ;-) So we changed to the two-wrapper strategy. YMMV, but this approach has worked very well for us for the last 6 years. Good luck! -- Mike PS - If you are doing automated testing, you only need to test the modules, since the scripts and CGIs don't do anything. PPS - There are all sorts of tricks for writing modules faster and in more standard ways. I recommend reading _Perl Best Practices_ and implementing Damian's suggestions. If you do that, you'll have an even easier time of the development than we did. (We had to build all the infrastructure ourselves. Now you can just download it from CPAN.) For example, the outputting of text to either command-line or HTML would be very easy if you used a templating system. On Jan 19, 2007, at 8:03 AM, David Alban wrote: > Greetings, > > I'm a command line person. I use things like X Windows and screen so > that I can get more command lines. The tools I have written over the > years are command line tools. My users have been command line people. > > Now I'm in a situation where half my users are command line oriented, > and half don't use it at all, and are not likely to start. I need to > write tools that cause and/or foster building of java code and cause > and/or foster the deployment of code and build artifacts from a source > code repository to different environments (dev, qa, production > equivalent, production). I plan to write command line perl tools. > Command line perl tools that can be called from web front ends. That > way the same set of tools can be used both by command line folks and > by gui-only folks. > > I have no experience in developing browser-used thingamabobs. I've > written html, sure, but only for basic web pages. No moving parts > (well, O.K., one animated gif :-). > > My requirements for a front end are simple: > > * it has to be something which can run from a browser (say, IE or > firefox) > * it has to be able to call command line perl programs > > Nice-to-haves would be: > > * doesn't take too long to learn (my current plans don't include > becoming a web developer). the front end is for internal use only, it > doesn't have to have bells, whistles or sex appeal, it just needs to > work well > * should be as platform-independent as possible > > Is CGI the way to go for this? Is PHP? Is altogether>? I realize that asking this on a perl list is bound to > tip the scale in favor of CGI, but I wanted to ask anyway, figuring a > significant number of folks might be able to give good advice on the > subject. > > Thanks, > David > > P.S. I'm not considering perl/tk because I want the tools to be > operable from any web browser on the local network. Plus, most of the > windows users won't have an X server running. > -- > Live in a world of your own, but always welcome visitors. > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm --------------------------------------------------------------------- Michael Friedman HighWire Press Phone: 650-725-1974 Stanford University FAX: 270-721-8034 --------------------------------------------------------------------- From boss at gregerhaga.net Fri Jan 19 09:11:06 2007 From: boss at gregerhaga.net (Greger) Date: Fri, 19 Jan 2007 19:11:06 +0200 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> Message-ID: <20070119171037.M17135@gregerhaga.net> On Fri, 19 Jan 2007 09:05:44 -0800, Michael Friedman wrote > I work in a similar environment -- the software developers like > command-line tools, but the production staff (the ones who bring in > the revenue!) are not so facile in Unix, so they need web-based > tools. We've decided to use a 3-part model for developing our > internal software: > > 1. Perl modules that do all the "real work". So, for a database > update operation, we write a (or several) modules that take user > input, do the updates, and produce text output. > > 2. Perl scripts that run on the command-line that wrap the modules. > These scripts are *very* short and lightweight. They handle reading > the parameters (Getopt::*), passing them to the modules, and doing > minor reformatting of the output text. > > 3. Perl CGI scripts that run on the web server that wrap the > modules. These are also very short and lightweight. They usually > have two "modes": when called with no parameters (or only a couple > of background ones) they return a form for the user to fill out; > when you submit the form it goes back to the same CGI which then > passes the parameters to the modules and does HTML formatting of > the output text. > > By making modules for the text->HTML transformations, so that code > is shared, and being pretty standard with the implementation, the > CGI scripts are not any longer than the command-line scripts. > > In this model, you only write code to do the actual work once, in a > module. Then you put two pretty much boilerplate front-ends on it > for people to use. > > We had originally looked at using the command-line "fake out" that > CGI.pm offers, so we'd just write the CGI script and let command- > line users use it, but we decided that getting HTML text as output > on the command-line was... sub-optimal. ;-) So we changed to the > two-wrapper strategy. > > YMMV, but this approach has worked very well for us for the last 6 > years. > > Good luck! > -- Mike > > PS - If you are doing automated testing, you only need to test the > modules, since the scripts and CGIs don't do anything. > > PPS - There are all sorts of tricks for writing modules faster and > in more standard ways. I recommend reading _Perl Best Practices_ > and implementing Damian's suggestions. If you do that, you'll have > an even easier time of the development than we did. (We had to > build all the infrastructure ourselves. Now you can just download > it from CPAN.) For example, the outputting of text to either > command-line or HTML would be very easy if you used a templating system. > > On Jan 19, 2007, at 8:03 AM, David Alban wrote: > > > Greetings, > > > > I'm a command line person. I use things like X Windows and screen so > > that I can get more command lines. The tools I have written over the > > years are command line tools. My users have been command line people. > > > > Now I'm in a situation where half my users are command line oriented, > > and half don't use it at all, and are not likely to start. I need to > > write tools that cause and/or foster building of java code and cause > > and/or foster the deployment of code and build artifacts from a source > > code repository to different environments (dev, qa, production > > equivalent, production). I plan to write command line perl tools. > > Command line perl tools that can be called from web front ends. That > > way the same set of tools can be used both by command line folks and > > by gui-only folks. > > > > I have no experience in developing browser-used thingamabobs. I've > > written html, sure, but only for basic web pages. No moving parts > > (well, O.K., one animated gif :-). > > > > My requirements for a front end are simple: > > > > * it has to be something which can run from a browser (say, IE or > > firefox) > > * it has to be able to call command line perl programs > > > > Nice-to-haves would be: > > > > * doesn't take too long to learn (my current plans don't include > > becoming a web developer). the front end is for internal use only, it > > doesn't have to have bells, whistles or sex appeal, it just needs to > > work well > > * should be as platform-independent as possible > > > > Is CGI the way to go for this? Is PHP? Is > altogether>? I realize that asking this on a perl list is bound to > > tip the scale in favor of CGI, but I wanted to ask anyway, figuring a > > significant number of folks might be able to give good advice on the > > subject. > > > > Thanks, > > David > > > > P.S. I'm not considering perl/tk because I want the tools to be > > operable from any web browser on the local network. Plus, most of the > > windows users won't have an X server running. > > -- > > Live in a world of your own, but always welcome visitors. > > _______________________________________________ > > SanFrancisco-pm mailing list > > SanFrancisco-pm at pm.org > > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > > --------------------------------------------------------------------- > Michael Friedman HighWire Press > Phone: 650-725-1974 Stanford University > FAX: 270-721-8034 > --------------------------------------------------------------------- > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm very good advice. -- http://www.gregerhaga.net/ http://hack-space.biz/ From sphink at gmail.com Fri Jan 19 11:03:39 2007 From: sphink at gmail.com (Steve Fink) Date: Fri, 19 Jan 2007 11:03:39 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <20070119171037.M17135@gregerhaga.net> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> <20070119171037.M17135@gregerhaga.net> Message-ID: <7d7f2e8c0701191103l821ebecy6d6bccaac53f979a@mail.gmail.com> One minor note: for what you're doing, I wouldn't bother with mod_perl or FastCGI. You're either going to be invoking external processes for most of the work, or your processing is going to swamp the initialization. So they gain you (almost) nothing; CGI scripts are much more straightforward for what you're doing. (And in exchange for that almost nothing, you'll have to deal with weird state preservation issues that you're probably not accustomed to, coming from a command-line background.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070119/66354fa0/attachment-0001.html From rdm at cfcl.com Fri Jan 19 11:39:57 2007 From: rdm at cfcl.com (Rich Morin) Date: Fri, 19 Jan 2007 11:39:57 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Message-ID: If you're only going to be wrapping a few commands, you can get away with writing the wrappers by hand. If you're going to be doing dozens (or hundreds), a mechanized approach may become worthwhile. That is, figure out a way to describe the pages and their actions in a declarative manner, then write a generator (or interpreter) that creates the desired page for each URL. Vicki did something like this, 20 years ago, for the "Commando" feature of A/UX. I'm sure you know this, but it needs to be said: Creating gateways from web pages to commands is a really easy way to introduce security holes! So, be cautious. Run the commands with the minimum possible privilege. Check all user input carefully. Like that... -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From mtheo at amural.com Fri Jan 19 11:45:25 2007 From: mtheo at amural.com (Mark Theodoropoulos) Date: Fri, 19 Jan 2007 11:45:25 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <7d7f2e8c0701191103l821ebecy6d6bccaac53f979a@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> <20070119171037.M17135@gregerhaga.net> <7d7f2e8c0701191103l821ebecy6d6bccaac53f979a@mail.gmail.com> Message-ID: <45B11FD5.5020706@amural.com> Steve Fink writes: > One minor note: for what you're doing, I wouldn't bother with mod_perl > or FastCGI. You're either going to be invoking external processes for > most of the work, or your processing is going to swamp the > initialization. So they gain you (almost) nothing; CGI scripts are much > more straightforward for what you're doing. (And in exchange for that > almost nothing, you'll have to deal with weird state preservation issues > that you're probably not accustomed to, coming from a command-line > background.) A hearty second to this -- the state issues may be amusingly bizarre, but you probably have better ways to have fun. You'll be reloading the interpreter all the time, but so what? It doesn't sound as though you have to plan on getting slashdotted someday. And speaking of scarred frontal lobes, I don't mean to start a religious war -- PHP being very handy for all kinds of things, really, and I'm not being sarcastic, completely -- I suspect that by the time you get used to working in one big flat namespace the size of the Gobi Desert your temporals and parietals will be scarred too. Hmm, guess I'd better cut back on the battery acid and go back to caffeine. -- producer / classics without walls the anti-warhorse zone / www.amural.com kusf 90.3fm / san francisco From doom at kzsu.stanford.edu Fri Jan 19 13:50:20 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Fri, 19 Jan 2007 13:50:20 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> Message-ID: <200701192150.l0JLoK05017969@kzsu.stanford.edu> David Alban wrote: > Now I'm in a situation where half my users are command line oriented, > and half don't use it at all, and are not likely to start. > I need to write tools that cause and/or foster building of java code > and cause and/or foster the deployment of code and build artifacts > from a source code repository to different environments (dev, qa, > production equivalent, production). Hm. I'm wondering if something like that might exist already. I was thinking about the Mozilla tools (Bonsai, Tinderbox, etc). But I'm not sure they give you quite what you want. > I plan to write command line perl tools. > Command line perl tools that can be called from web front ends. If you're in the habit of always putting script functionality in a module, and just writing simple scripts that invoke the module, then you can write very efficient "mod_perl" code that just uses the modules directly. But on the other hand, since this is just intranet stuff, you can probably get away with doing simple CGI stuff and shelling out to run your perl scripts (backticks, "system", etc). Note: you want to watch your ass doing this, you're most like going to have security holes out the wazoo if it's possible for an unauthorized person to get access to the intranet pages. > I have no experience in developing browser-used thingamabobs. Look at Chapter 19 "CGI Programming" of the Perl Cookbook, and see if it makes sense. The docs for CGI.pm lead off with a decent example of a simple program. The Randal Schwartz book "Perls of Wisdom" has some okay CGI examples, which also use CGI.pm. (Note: CGI.pm arguably has bloat problems, but the latest version at least has a lot of "tags" so you only need to load the parts you care about). > * doesn't take too long to learn (my current plans don't include > becoming a web developer). All software development projects evolve until they become web development projects. When you start doing stuff like this, get used to checking the apache error log a lot, and realize that you can send debugging messages to the log, e.g. use Data::Dumper; print STDERR Dumper($my_data_ref); And what "stateless protocol" means is that your scripts all have a bad case of amnesia: if you want them to know something about what was happening, you have to make sure you pass the information to them somehow. When you click "submit" the form values get passed to the script, but it won't know anything from the time you clicked "submit" before that. Embedding HTML generation code inside of perl, is shall we say, "considered harmful" (that's a big part of what that "model-view- controller" jazz is about), but you have bigger problems at the moment, so you might as well live with using the CGI.pm shortcuts for now. (After you graduate to mod_perl, you should look into Mason and/or Template Toolkit.) > Is CGI the way to go for this? It's at least a way to go. If you're working in perl already, it makes sense to continue working with it, I would say. From doom at kzsu.stanford.edu Fri Jan 19 14:00:50 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Fri, 19 Jan 2007 14:00:50 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <45B11FD5.5020706@amural.com> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> <9EF0FE1D-15A1-4660-9397-113C356C3A35@highwire.stanford.edu> <20070119171037.M17135@gregerhaga.net> <7d7f2e8c0701191103l821ebecy6d6bccaac53f979a@mail.gmail.com> <45B11FD5.5020706@amural.com> Message-ID: <200701192200.l0JM0oEo018338@kzsu.stanford.edu> Mark Theodoropoulos wrote: > And speaking of scarred frontal lobes, I don't mean to start a religious war -- > PHP being very handy for all kinds of things, really, and I'm not being > sarcastic, completely -- I suspect that by the time you get used to working in > one big flat namespace the size of the Gobi Desert your temporals and parietals > will be scarred too. I was going to say something about that, but I decided to be nice for once. From doom at kzsu.stanford.edu Fri Jan 19 14:11:56 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Fri, 19 Jan 2007 14:11:56 -0800 Subject: [sf-perl] Browser front ends to perl back ends In-Reply-To: <200701192150.l0JLoK05017969@kzsu.stanford.edu> References: <4c714a9c0701190803q35216e4bu9a6ae01e300eabbf@mail.gmail.com> <200701192150.l0JLoK05017969@kzsu.stanford.edu> Message-ID: <200701192212.l0JMBugG018568@kzsu.stanford.edu> Joe Brenner wrote: > Look at Chapter 19 "CGI Programming" of the Perl Cookbook, and > see if it makes sense. > > The docs for CGI.pm lead off with a decent example of a simple > program. > > The Randal Schwartz book "Perls of Wisdom" has some okay CGI > examples, which also use CGI.pm. Oh, and the 2nd edition of the O'Reilly book "CGI Programming with Perl" looks like a big improvement over the original: http://www.oreilly.com/catalog/cgi2/chapter/ch08.html From qw at sf.pm.org Fri Jan 19 23:00:37 2007 From: qw at sf.pm.org (Quinn Weaver) Date: Fri, 19 Jan 2007 23:00:37 -0800 Subject: [sf-perl] Tuesday -> Wednesday Message-ID: <20070120070037.GB77958@fu.funkspiel.org> Hey, everyone, Sorry for the last-minute post. My laptop woes have thrown this week out of whack. If there are no objections, I'd like to propose that we merge once again with the Wednesday Beer and Scripting SIG, run by Rich at Wild Pepper. More languages and more people mean more ideas; cross-pollination is what Perl is all about. ***************** THAT'S RIGHT, WEDNESDAY. ***************** (That's January 24. Please excuse my shouting; too often people don't notice when we change dates.) Here are the details: http://www.cfcl.com/rdm/bass/ I'll be there; I hope to see y'all as well. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From nheller at silcon.com Sat Jan 20 11:29:58 2007 From: nheller at silcon.com (Neil Heller) Date: Sat, 20 Jan 2007 11:29:58 -0800 Subject: [sf-perl] [sfpug] Trustworthy laptop repair? In-Reply-To: Message-ID: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> I'm using Winderz and desire to launch an external executable using the "system" command. The problem comes in that one of the directories in the path to that executable has an embedded space in the name ("Program Files"). I've thought of two ways to do it. 1) Launch the program from a batch file that I can call from the Perl script. 2) Incrementally change the directory (chdir) using wild cards. These work but are kludgy (at least in my mind) Does anybody have a "slick" way to do this? Neil Heller nheller at silcon.com From friedman at highwire.stanford.edu Sat Jan 20 14:12:12 2007 From: friedman at highwire.stanford.edu (Michael Friedman) Date: Sat, 20 Jan 2007 14:12:12 -0800 Subject: [sf-perl] [sfpug] Trustworthy laptop repair? In-Reply-To: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> Message-ID: <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> Sometimes it pays to ask the seemingly obvious question... Did you try putting the path in quotes? How about escaping the space? "Program\ Files". Both of those work on unix derivatives (including Mac OS X) for files with spaces in the path or name. If those don't work, I assume CPAN has a solution for doing this on Windows. CPAN has everything. :-) -- Mike On Jan 20, 2007, at 11:29 AM, Neil Heller wrote: > > I'm using Winderz and desire to launch an external executable using > the > "system" command. The problem comes in that one of the directories > in the > path to that executable has an embedded space in the name ("Program > Files"). > I've thought of two ways to do it. > > 1) Launch the program from a batch file that I can call from the Perl > script. > 2) Incrementally change the directory (chdir) using wild cards. > > These work but are kludgy (at least in my mind) > Does anybody have a "slick" way to do this? > > Neil Heller > nheller at silcon.com > > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm --------------------------------------------------------------------- Michael Friedman HighWire Press Phone: 650-725-1974 Stanford University FAX: 270-721-8034 --------------------------------------------------------------------- From josh at agliodbs.com Sun Jan 21 09:49:44 2007 From: josh at agliodbs.com (Josh Berkus) Date: Sun, 21 Jan 2007 09:49:44 -0800 Subject: [sf-perl] [sfpug] Trustworthy laptop repair? In-Reply-To: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> Message-ID: <200701210949.44825.josh@agliodbs.com> Quinn, BTW, I don't have a recommendation for a *good* Thinkpad repair place (the one I used no longer does thinkpads) but I do have a warning about a bad one. I took a Thinkpad with a damaged touchpad to MicroGear downtown a couple years ago, and offered them an extra $150 to do "rush" work. They sat on the laptop for two days without even looking at it before I retrieved it and took it elsewhere. -- Josh Berkus PostgreSQL @ Sun San Francisco From quinn at fairpath.com Sun Jan 21 20:39:39 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Sun, 21 Jan 2007 20:39:39 -0800 Subject: [sf-perl] Windows Perl question In-Reply-To: <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> Message-ID: <20070122043939.GA97287@fu.funkspiel.org> On Sat, Jan 20, 2007 at 02:12:12PM -0800, Michael Friedman wrote: > Sometimes it pays to ask the seemingly obvious question... > Did you try putting the path in quotes? Exactly my thought. > How about escaping the space? "Program\ Files". In Windows, I believe, you'd have to do something like this: system qq{chdir "Program Files"}; # or system qq{chdir "$dir"}; --the reason being that the Windows command shell doesn't have single quotes the way bash (for instance) does. Caveat hacker: I don't have a Windows box, so I didn't test this. I'm just going from memory. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From rdm at cfcl.com Mon Jan 22 08:15:07 2007 From: rdm at cfcl.com (Rich Morin) Date: Mon, 22 Jan 2007 08:15:07 -0800 Subject: [sf-perl] Beer & Scripting SIG reminder (1/24) Message-ID: The Beer & Scripting SIG (http://www.cfcl.com/rdm/bass) will take place Wednesday evening, 1/24. Be there or be elsewhere! Note: The San Francisco Perl Mongers are rejoining BASS this month for their monthly meeting, so we may have a larger-than-usual crowd. Kewl! In case you were wondering, the discussions at BASS gatherings are not, erm, scripted. Rather, they reflect the interests of whatever scripters happen to show up that evening. One recent gathering focused on databases (especially PostgreSQL); other gatherings have discussed the vagaries of doing scripting for a living, which languages folks like (and why), etc. Sometimes, folks bring in books that they have recently read, software that they want to show off, etc. The informal nature of the gatherings allows this, as long as it doesn't conflict with important things like ordering and eating food! Also note that the calendar of Bay Area Scripting Events is available and open to submissions (all your BASE are belong to us :-). * webcal://cfcl.com/pub_dav/BA_Scripting_Groups.ics * http://cfcl.com/pub_dav/BA_Scripting_Groups.ics and that the list of local scripting groups is online at SF Bay Area Scripting Groups http://www.cfcl.com/rdm/bass/groups.php -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From rdm at cfcl.com Mon Jan 22 10:36:20 2007 From: rdm at cfcl.com (Rich Morin) Date: Mon, 22 Jan 2007 10:36:20 -0800 Subject: [sf-perl] Will code (or write) for food... Message-ID: I just finished a contract (CSS/JavaScript/Perl/PHP/TWiki; setting up a semi-custom TWiki for a corporate intranet), so I am once again looking about for new work. Please let me know if you have know of anything appropriate. I am particularly interested in the application and design of mechanized documentation tools, which can be effective in the generation and maintenance of detailed interface documentation, etc. I am also quite willing, however, to do writing, editing, course development, programming, etc. -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From nheller at silcon.com Mon Jan 22 10:49:26 2007 From: nheller at silcon.com (nheller at silcon.com) Date: Mon, 22 Jan 2007 10:49:26 -0800 (PST) Subject: [sf-perl] Windows Perl question In-Reply-To: <20070122043939.GA97287@fu.funkspiel.org> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> <20070122043939.GA97287@fu.funkspiel.org> Message-ID: <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> Here's a short example script. My system can't find the executable. I'm sure there must be an easy solution - but what? #!Perl -w use warnings; use strict; my $commLine = qw "\"\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe\""; system $commLine; my $foo = 1; Neil Heller > On Sat, Jan 20, 2007 at 02:12:12PM -0800, Michael Friedman wrote: > >> Sometimes it pays to ask the seemingly obvious question... >> Did you try putting the path in quotes? > > Exactly my thought. > >> How about escaping the space? "Program\ Files". > > In Windows, I believe, you'd have to do something like this: > > system qq{chdir "Program Files"}; > # or > system qq{chdir "$dir"}; > > --the reason being that the Windows command shell doesn't have single > quotes the way bash (for instance) does. > > Caveat hacker: I don't have a Windows box, so I didn't test this. I'm > just going from memory. > > -- > Quinn Weaver, independent contractor | President, San Francisco Perl > Mongers > http://fairpath.com/quinn/resume/ | http://sf.pm.org/ > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > From quinn at fairpath.com Mon Jan 22 11:12:58 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Mon, 22 Jan 2007 11:12:58 -0800 Subject: [sf-perl] Windows Perl question In-Reply-To: <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> <20070122043939.GA97287@fu.funkspiel.org> <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> Message-ID: <20070122191258.GA5145@fu.funkspiel.org> On Mon, Jan 22, 2007 at 10:49:26AM -0800, nheller at silcon.com wrote: > > Here's a short example script. My system can't find the executable. I'm > sure there must be an easy solution - but what? > > #!Perl -w > > use warnings; > use strict; > > my $commLine = qw "\"\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe\""; Could it be the lack of a drive letter that's messing you up? -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From sphink at gmail.com Mon Jan 22 11:22:58 2007 From: sphink at gmail.com (Steve Fink) Date: Mon, 22 Jan 2007 11:22:58 -0800 Subject: [sf-perl] Windows Perl question In-Reply-To: <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> <20070122043939.GA97287@fu.funkspiel.org> <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> Message-ID: <7d7f2e8c0701221122v12f8756s18d98401ac1d825f@mail.gmail.com> qw is for taking a set of tokens, separated by whitespace, and returning a list. You're assigning into a scalar, which makes no sense. In this case, it will give you the last value in the list, which is "Files\Rational\ClearCase...". I think you meant q instead of qw. my $commLine = q!"\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe"!; might do what you want. Although you might want to check if Windows will let you use forward slashes instead of backslashes; if so, you can use: my $commLine = q!"/Program Files/Rational/ClearCase/bin/clearexplorer.exe"!; Another option to avoid the problem of quoting is to prevent system from passing the command to the shell. If you had any command-line arguments, that would be easy, but since you don't, you can force it with the bizarre my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; system {$commLine} $commLine; This uses the first $commLine as the program to run, and the second to tell the OS what the name of the program that you're running is (in case you want to lie.) So this should also work: my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; system {$commLine} "clear explorer, dude"; Strangely, further arguments come after the second one. So if you were to pass in the value 12, this would become: my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; system {$commLine} "blahblah", "12"; or my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; system {$commLine} ("blahblah", "12"); Except in that case, you have a command line argument, so it's much easier: my @command = (q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!, "12"); system @command; On 1/22/07, nheller at silcon.com wrote: > > > Here's a short example script. My system can't find the executable. I'm > sure there must be an easy solution - but what? > > #!Perl -w > > use warnings; > use strict; > > my $commLine = qw "\"\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe\""; > > system $commLine; > > my $foo = 1; > > Neil Heller > > > > On Sat, Jan 20, 2007 at 02:12:12PM -0800, Michael Friedman wrote: > > > >> Sometimes it pays to ask the seemingly obvious question... > >> Did you try putting the path in quotes? > > > > Exactly my thought. > > > >> How about escaping the space? "Program\ Files". > > > > In Windows, I believe, you'd have to do something like this: > > > > system qq{chdir "Program Files"}; > > # or > > system qq{chdir "$dir"}; > > > > --the reason being that the Windows command shell doesn't have single > > quotes the way bash (for instance) does. > > > > Caveat hacker: I don't have a Windows box, so I didn't test this. I'm > > just going from memory. > > > > -- > > Quinn Weaver, independent contractor | President, San Francisco Perl > > Mongers > > http://fairpath.com/quinn/resume/ | http://sf.pm.org/ > > _______________________________________________ > > SanFrancisco-pm mailing list > > SanFrancisco-pm at pm.org > > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > > > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070122/bc518b34/attachment.html From steve at vargasmedia.com Mon Jan 22 11:33:09 2007 From: steve at vargasmedia.com (Vargas Media) Date: Mon, 22 Jan 2007 11:33:09 -0800 Subject: [sf-perl] opendir question..for search script Message-ID: <001201c73e5c$26a2b820$020fa8c0@steve1o9d2xm1d> Hi All, I have a quick question. I'm using "opendir" and trying to get my search.cgi script to search in my main www directory instead of my cgi-bin as the HTML pages found can't be accessed there. I did this as a tutorial from a book I have. Here are my Env Variables: http://www.autotection.com/cgi-bin/env_var.pl any help very appreciated. Thanks Steve ############search.cgi #!/usr/bin/perl &get_form_data(); $search_term = $FORM{'search'}; print "Content-type: text/html\n\n"; &search("."); sub get_form_data { # get the data read(STDIN, $buffer, $ENV{ 'CONTENT_LENGTH' } ); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($firstname, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $FORM{$firstname} = $value; } } print < Search

Results of your search: $search_term

EOF foreach $file (@found_set) { print "$Title{$file}\n"; print "
\n"; } if ((@found_set) != "") { print "

Above Are Matches for the Search Term: $search_term

\n"; } else { print "

Sorry, no files found under the search term: $search_term

\n"; } print < EOF exit; sub search { local ($dir) = @_; if($dir eq ".") { opendir(DIR, "."); $dir = ""; } else { opendir(DIR, $dir); $dir .= "/"; } foreach $file (sort readdir(DIR)) { next if($file eq "." || $file eq ".."); $file = $dir . $file; next if(($file !~ /.htm/) && (!(-d $file))); if(-d $file) { &search($file); next; } open(FILE, $file); $found_match = 0; $title = ""; while() { if(/$search_term/i) { $found_match = 1; } if(//) { chop; $title = $_; $title =~ s/<TITLE>//g; $title =~ s/<\/TITLE>//g; } } if($found_match) { push(@found_set, $file); if($title eq "") { $Title{$file} = $file; } else { $Title{$file} = $title; } } close(FILE); print "<P>\n"; } closedir(DIR); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070122/f11366ef/attachment-0001.html From nheller at silcon.com Mon Jan 22 12:29:55 2007 From: nheller at silcon.com (nheller at silcon.com) Date: Mon, 22 Jan 2007 12:29:55 -0800 (PST) Subject: [sf-perl] Windows Perl question In-Reply-To: <7d7f2e8c0701221122v12f8756s18d98401ac1d825f@mail.gmail.com> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> <20070122043939.GA97287@fu.funkspiel.org> <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> <7d7f2e8c0701221122v12f8756s18d98401ac1d825f@mail.gmail.com> Message-ID: <52253.208.253.246.248.1169497795.squirrel@webmail.silcon.com> Thank you very much. I made two changes: 1. Substituted forward slashes for double back-slashes. 2. Substituted "q" for "qw" It works well. One question though: am I correct in assumming "q" is scalar and "qw" is array? > qw is for taking a set of tokens, separated by whitespace, and returning a > list. You're assigning into a scalar, which makes no sense. In this case, > it > will give you the last value in the list, which is > "Files\Rational\ClearCase...". I think you meant q instead of qw. > > my $commLine = q!"\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe"!; > > might do what you want. Although you might want to check if Windows will > let > you use forward slashes instead of backslashes; if so, you can use: > > my $commLine = q!"/Program > Files/Rational/ClearCase/bin/clearexplorer.exe"!; > > Another option to avoid the problem of quoting is to prevent system from > passing the command to the shell. If you had any command-line arguments, > that would be easy, but since you don't, you can force it with the bizarre > > my $commLine = q!\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; > system {$commLine} $commLine; > > This uses the first $commLine as the program to run, and the second to > tell > the OS what the name of the program that you're running is (in case you > want > to lie.) So this should also work: > > my $commLine = q!\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; > system {$commLine} "clear explorer, dude"; > > Strangely, further arguments come after the second one. So if you were to > pass in the value 12, this would become: > > my $commLine = q!\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; > system {$commLine} "blahblah", "12"; > > or > > my $commLine = q!\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!; > system {$commLine} ("blahblah", "12"); > > Except in that case, you have a command line argument, so it's much > easier: > > my @command = (q!\\Program > Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!, "12"); > system @command; > > On 1/22/07, nheller at silcon.com <nheller at silcon.com> wrote: >> >> >> Here's a short example script. My system can't find the executable. >> I'm >> sure there must be an easy solution - but what? >> >> #!Perl -w >> >> use warnings; >> use strict; >> >> my $commLine = qw "\"\\Program >> Files\\Rational\\ClearCase\\bin\\clearexplorer.exe\""; >> >> system $commLine; >> >> my $foo = 1; >> >> Neil Heller >> >> >> > On Sat, Jan 20, 2007 at 02:12:12PM -0800, Michael Friedman wrote: >> > >> >> Sometimes it pays to ask the seemingly obvious question... >> >> Did you try putting the path in quotes? >> > >> > Exactly my thought. >> > >> >> How about escaping the space? "Program\ Files". >> > >> > In Windows, I believe, you'd have to do something like this: >> > >> > system qq{chdir "Program Files"}; >> > # or >> > system qq{chdir "$dir"}; >> > >> > --the reason being that the Windows command shell doesn't have single >> > quotes the way bash (for instance) does. >> > >> > Caveat hacker: I don't have a Windows box, so I didn't test this. >> I'm >> > just going from memory. >> > >> > -- >> > Quinn Weaver, independent contractor | President, San Francisco Perl >> > Mongers >> > http://fairpath.com/quinn/resume/ | http://sf.pm.org/ >> > _______________________________________________ >> > SanFrancisco-pm mailing list >> > SanFrancisco-pm at pm.org >> > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm >> > >> >> _______________________________________________ >> SanFrancisco-pm mailing list >> SanFrancisco-pm at pm.org >> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm >> > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > From sphink at gmail.com Mon Jan 22 13:53:43 2007 From: sphink at gmail.com (Steve Fink) Date: Mon, 22 Jan 2007 13:53:43 -0800 Subject: [sf-perl] Windows Perl question In-Reply-To: <52253.208.253.246.248.1169497795.squirrel@webmail.silcon.com> References: <000001c73cc9$6269c360$a6dcbc43@your0agqlnep7i> <2E390412-83E7-4365-B661-5B7DBA4ED3FA@highwire.stanford.edu> <20070122043939.GA97287@fu.funkspiel.org> <58547.208.253.246.248.1169491766.squirrel@webmail.silcon.com> <7d7f2e8c0701221122v12f8756s18d98401ac1d825f@mail.gmail.com> <52253.208.253.246.248.1169497795.squirrel@webmail.silcon.com> Message-ID: <7d7f2e8c0701221353g4ed6ec5csaf2f7f4ca6fc5f61@mail.gmail.com> On 1/22/07, nheller at silcon.com <nheller at silcon.com> wrote: > > It works well. > One question though: am I correct in assumming "q" is scalar and "qw" is > array? I hesitate to say yes, since the terms "scalar" and "array" are usually used to denote the context of an expression, and that is something being imposed from outside of the expression itself. Or, said another way, you could use either one in either context, although "qw" is pretty useless in scalar context. "q" is the same as a single quotation mark, just using a (probably) different character to delimit the string, so it can be used in either context. But it will always produce just a single (scalar) value. But if you don't want to dive into it that far, then the answer is yes. "q" produces a scalar; "qw" produces a list. q/a b c/ is the same as q[a b c] is the same as 'a b c' qq/a b c/ is the same as qq[a b c] is the same as "a b c" qw/a b c/ is the same as ('a', 'b', 'c') is the same as split(/\s+/, "a b c") -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070122/5fa6ff90/attachment.html From rdm at cfcl.com Mon Jan 22 17:55:27 2007 From: rdm at cfcl.com (Rich Morin) Date: Mon, 22 Jan 2007 17:55:27 -0800 Subject: [sf-perl] Will code (or write) for food... In-Reply-To: <p06230947c1dab2150a1e@[192.168.1.205]> References: <p06230947c1dab2150a1e@[192.168.1.205]> Message-ID: <p0623094fc1db1b53b514@[192.168.1.205]> At 10:36 AM -0800 1/22/07, Rich Morin wrote: > let me know if you have know of anything appropriate. ^^^^^^^^^ sigh... -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From quinn at fairpath.com Tue Jan 23 23:19:47 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Tue, 23 Jan 2007 23:19:47 -0800 Subject: [sf-perl] opendir question..for search script In-Reply-To: <001201c73e5c$26a2b820$020fa8c0@steve1o9d2xm1d> References: <001201c73e5c$26a2b820$020fa8c0@steve1o9d2xm1d> Message-ID: <20070124071947.GA16620@fu.funkspiel.org> On Mon, Jan 22, 2007 at 11:33:09AM -0800, Vargas Media wrote: > Hi All, > I have a quick question. > I'm using "opendir" and trying to get my search.cgi script to search in my main www directory instead of my cgi-bin > as the HTML pages found can't be accessed there. Not sure I see the problem. Why can't you just prefix the path you want to $dir ? This depends on Can you just prefix your www path to $dir before calling opendir? That's the quick-and-dirty fix. If it doesn't work, then you have to delve into your web server configuration (for security reasons, it may forbid your CGI script from seeing directories besides your cgi-bin). As a side note, I think you are using an outdated tutorial. It uses local instead of my variables--a very old, deprecated Perl practice--and it prints out HTML from Perl code. Nowadays most people write Web programs using templating systems like HTML::Mason. There are many to choose from; here's a good overview: http://www.perl.com/pub/a/2001/08/21/templating.html Another option is Catalyst, which is the Perl answer to Ruby on Rails. It effects an even cleaner separation of concerns among data storage, business logic, and (X)HTML presentation. > I did this as a tutorial from a book I have. > Here are my Env Variables: > http://www.autotection.com/cgi-bin/env_var.pl > any help very appreciated. > Thanks Steve > ############search.cgi > > #!/usr/bin/perl > &get_form_data(); > $search_term = $FORM{'search'}; > print "Content-type: text/html\n\n"; > &search("."); > > sub get_form_data > { > # get the data > read(STDIN, $buffer, $ENV{ 'CONTENT_LENGTH' } ); > > @pairs = split(/&/, $buffer); > foreach $pair (@pairs) > { > ($firstname, $value) = split(/=/, $pair); > > $value =~ tr/+/ /; > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $value =~ s/<!--(.|\n)*-->//g; > $FORM{$firstname} = $value; > } > } > > print <<EOF; > <HTML> > <HEAD> > <TITLE> > Search > > > > >

Results of your search: $search_term

> EOF > foreach $file (@found_set) > { > print "$Title{$file}\n"; > print "
\n"; > } > if ((@found_set) != "") { > print "

Above Are Matches for the Search Term: $search_term

\n"; > } else { > print "

Sorry, no files found under the search term: $search_term

\n"; > } > > print < > > EOF > exit; > sub search > { > local ($dir) = @_; > if($dir eq ".") > { > opendir(DIR, "."); > $dir = ""; > } > else > { > opendir(DIR, $dir); > $dir .= "/"; > } > foreach $file (sort readdir(DIR)) > { > next if($file eq "." || $file eq ".."); > $file = $dir . $file; > next if(($file !~ /.htm/) && (!(-d $file))); > > if(-d $file) > { > &search($file); > next; > } > open(FILE, $file); > $found_match = 0; > $title = ""; > while() > { > if(/$search_term/i) > { > $found_match = 1; > } > if(//) > { > chop; > $title = $_; > $title =~ s/<TITLE>//g; > $title =~ s/<\/TITLE>//g; > } > } > if($found_match) > { > push(@found_set, $file); > if($title eq "") > { > $Title{$file} = $file; > } > else > { > $Title{$file} = $title; > } > } > close(FILE); > print "<P>\n"; > } > closedir(DIR); > } > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From extasia at extasia.org Wed Jan 24 11:07:29 2007 From: extasia at extasia.org (David Alban) Date: Wed, 24 Jan 2007 11:07:29 -0800 Subject: [sf-perl] Creating an md5/pam encrypted password shadow entry Message-ID: <4c714a9c0701241107s7965e296o16587234e160160e@mail.gmail.com> Greetings, An existing tool at work (internal use only) uses a pseudo shadow file, in which each line is of the form: username:encrypted_password Example: someuser:grrbqIj6N2BJ. This file is used to authenticate users, and thus define for what they can use the tool. Just like a traditional unix login, the password supplied interactively by the user is encrypted with the salt from the pseudo shadow file and if there's a match, the user is authenticated. This is working well, and there's no need to change it. However, for a new set of tools I need to generate a new pseudo shadow file whose data cannot be reused from existing ones. There will be tens of users in the new file. If our linux machines used the traditional thirteen character /etc/shadow field for encrypted passwords, I could simply copy usernames and their associated password fields into the new pseudo shadow file. But our linux boxes use the pam/md5 version of the field. Example (modified to protect the guilty): $1$IloW7woM$XipC0z1z6dd4ms6AUd8LR. The field from which this particular example is derived is thirty four characters in length. If I could discover how to take a cleartext password string and generate the pam/md5 version of it that would go in a shadow file, then I really could seed the new shadow file from existing /etc/shadow files. Can someone point me to resources I might use to gain this knowledge. I'll continue searching cpan and web searching, but I figured someone might have done this before, and could point me in the right direction. Thanks, David -- Live in a world of your own, but always welcome visitors. From extasia at extasia.org Wed Jan 24 11:20:24 2007 From: extasia at extasia.org (David Alban) Date: Wed, 24 Jan 2007 11:20:24 -0800 Subject: [sf-perl] Creating an md5/pam encrypted password shadow entry In-Reply-To: <4c714a9c0701241107s7965e296o16587234e160160e@mail.gmail.com> References: <4c714a9c0701241107s7965e296o16587234e160160e@mail.gmail.com> Message-ID: <4c714a9c0701241120p45a4e975ydce8dee36858154c@mail.gmail.com> FYI, just found: http://www.virusexperts.com/xbi/programming/md5-crypt which suggests using Crypt::PasswdMD5. Will check it out. On 1/24/07, David Alban <extasia at extasia.org> wrote: > If I could discover how to take a cleartext > password string and generate the pam/md5 version of it that would go > in a shadow file, then I really could seed the new shadow file from > existing /etc/shadow files. > > Can someone point me to resources I might use to gain this knowledge. > I'll continue searching cpan and web searching, but I figured someone > might have done this before, and could point me in the right > direction. -- Live in a world of your own, but always welcome visitors. From quinn at fairpath.com Wed Jan 24 14:44:45 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Wed, 24 Jan 2007 14:44:45 -0800 Subject: [sf-perl] Reminder: BASS tonight Message-ID: <20070124224445.GA24752@fu.funkspiel.org> This is a just a reminder that the Beer and Scripting SIG is meeting tonight in San Francisco. Details and directions at http://www.cfcl.com/rdm/bass/ . See you there, -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From josh at agliodbs.com Wed Jan 24 15:15:46 2007 From: josh at agliodbs.com (Josh Berkus) Date: Wed, 24 Jan 2007 15:15:46 -0800 Subject: [sf-perl] Reminder: BASS tonight In-Reply-To: <20070124224445.GA24752@fu.funkspiel.org> Message-ID: <web-11265571@davinci.ethosmedia.com> Quinn, > This is a just a reminder that the Beer and Scripting SIG is meeting > tonight in San Francisco. Details and directions at > http://www.cfcl.com/rdm/bass/ . Is this at Wild Pepper? I'll be there. Josh Berkus PostgreSQL @ Sun San Francisco 415-752-2500 From josh at agliodbs.com Wed Jan 24 15:15:46 2007 From: josh at agliodbs.com (Josh Berkus) Date: Wed, 24 Jan 2007 15:15:46 -0800 Subject: [sf-perl] Reminder: BASS tonight In-Reply-To: <20070124224445.GA24752@fu.funkspiel.org> Message-ID: <web-11265571@davinci.ethosmedia.com> Quinn, > This is a just a reminder that the Beer and Scripting SIG is meeting > tonight in San Francisco. Details and directions at > http://www.cfcl.com/rdm/bass/ . Is this at Wild Pepper? I'll be there. Josh Berkus PostgreSQL @ Sun San Francisco 415-752-2500 From quinn at fairpath.com Wed Jan 24 16:04:03 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Wed, 24 Jan 2007 16:04:03 -0800 Subject: [sf-perl] Reminder: BASS tonight In-Reply-To: <web-11265571@davinci.ethosmedia.com> References: <20070124224445.GA24752@fu.funkspiel.org> <web-11265571@davinci.ethosmedia.com> Message-ID: <20070125000403.GA25043@fu.funkspiel.org> On Wed, Jan 24, 2007 at 03:15:46PM -0800, Josh Berkus wrote: > Quinn, > > > This is a just a reminder that the Beer and Scripting SIG is meeting > > tonight in San Francisco. Details and directions at > > http://www.cfcl.com/rdm/bass/ . > > Is this at Wild Pepper? I'll be there. Yes, Wild Pepper. That URL has the full details (further down the page). It's a couple of blocks from 24 St. and Mission BART. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From extasia at extasia.org Wed Jan 24 19:53:20 2007 From: extasia at extasia.org (David Alban) Date: Wed, 24 Jan 2007 19:53:20 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules Message-ID: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> Greetings, Assume I'm not allowed to modify the perl installation on a set of machines. Assume also that I have write access to the /usr/local/foo tree. I can populate it with anything I want. I wrote a module, say My::Module. I put it in /usr/local/foo like so: /usr/local/foo/lib/perl/My/Module.pm So programs that use it can do: #!/usr/bin/perl [...] use lib "/usr/local/foo/lib/perl"; use My::Module; Then today I installed Crypt::PasswdMD5 from cpan. I ran "perl Makefile.PL". I then edited the resulting make file so that it would install in /usr/local/foo rather than the default location. So now I have a program that does: use lib "/usr/local/foo/lib/perl"; use My::Module; use lib "/usr/local/reg/lib/perl5/site_perl/5.8.0"; use Crypt::PasswdMD5; Should I create the directory /usr/local/reg/lib/perl5/site_perl/5.8.0/My and move the homegrown Module.pm file there? Any other suggestions given 1) any modules I install from cpan will go in the /usr/local/foo tree, and 2) any home grown modules will also go in that tree, on how stuff should be laid out? Thanks, David -- Live in a world of your own, but always welcome visitors. From doom at kzsu.stanford.edu Thu Jan 25 01:16:33 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Thu, 25 Jan 2007 01:16:33 -0800 Subject: [sf-perl] Internationalizing a Perl application In-Reply-To: <20070116020207.GB28294@tao.fairpath.com> References: <20070116020207.GB28294@tao.fairpath.com> Message-ID: <200701250916.l0P9GXU4023793@kzsu.stanford.edu> Quinn Weaver <quinn at fairpath.com> wrote: > David Fetter wrote: > > * What pains can I avoid, and how? Don't use built-up strings. Programmers like to do clever things like write a generic message where nouns are filled in like a game of madlibs: Could not find the ____ named _____, please try a different one. Then they hand that off to be localized, even though it's effectively impossible to do it (e.g. in many languages different nouns have different "gender", which changes the appropriate determiner to use in place of "the"). Other potential gotchas: The order of words can change in translation. Plurals don't just get an "s" tacked on the end. You can cover your self on almost all of these problems if you code all messages in complete sentences. In the above example you want to have a separate "Could not find" string for each noun, even if it seems really redundant to do it that way in English. It's probably okay to have a string you're going to substitute a number into ("Found ___ matches."), but you should keep in mind you'll want separate strings for the singular and plural case. Complete sentences also help provide a little context for the linguists, who can easily have trouble figuring out how a string is used by the software (if you just see the string "file", how do you know if that's a noun or a verb?). There are other potential headaches that hopefully you won't be stung by. For one thing, strings can expand a lot in translation (english is a pretty tight language). Even if you're using an automatic layout manager, that can still be a problem (differential expansion rates can invert a ratio: the designer expected one line would always be shorter than another, but... ). Another good one is when you need to choose keyboard shortcuts that use letters in the command names. Some languages work a smaller set of letters harder than English does, making it impossible to choose an unambiguous set of shortcuts for a given menu. One of my all time favorite problems was running into a synonym shortage in the target language: The English app had commands to "search", "find", "seek", "browse"... and there were only two available similar words we could use in translation. That then messed up the context sensitive help (which could no longer figure out which search/find/seek/browse thingie we were talking about). (I used to do this stuff for a living, in case you couldn't tell, though that was a long time ago... we had only barely heard of UTF8 in those days.) From doom at kzsu.stanford.edu Thu Jan 25 01:23:02 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Thu, 25 Jan 2007 01:23:02 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules In-Reply-To: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> References: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> Message-ID: <200701250923.l0P9N2SU023884@kzsu.stanford.edu> David Alban <extasia at extasia.org> wrote: > Then today I installed Crypt::PasswdMD5 from cpan. I ran "perl > Makefile.PL". I then edited the resulting make file so that it would > install in /usr/local/foo rather than the default location. So now I > have a program that does: > > use lib "/usr/local/foo/lib/perl"; > use My::Module; > > use lib "/usr/local/reg/lib/perl5/site_perl/5.8.0"; > use Crypt::PasswdMD5; Do you know about the PERL5LIB environment variable? If you put a few of your commonly used /usr/local paths in your PERL5LIB, you can stop adding them to all to your scripts with "use lib". From garth.webb at gmail.com Thu Jan 25 09:36:37 2007 From: garth.webb at gmail.com (Garth Webb) Date: Thu, 25 Jan 2007 09:36:37 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules In-Reply-To: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> References: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> Message-ID: <c0d982e10701250936n6277ce7dlab387db31d85381c@mail.gmail.com> On 1/24/07, David Alban <extasia at extasia.org> wrote: > > Greetings, > > Assume I'm not allowed to modify the perl installation on a set of > machines. [snip] Then today I installed Crypt::PasswdMD5 from cpan. I ran "perl > Makefile.PL". I then edited the resulting make file so that it would > install in /usr/local/foo rather than the default location. You should do this instead: perl Makefile.PL PREFIX=/usr/local/foo Garth -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070125/b90e921f/attachment.html From quinn at fairpath.com Thu Jan 25 11:33:13 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Thu, 25 Jan 2007 11:33:13 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules In-Reply-To: <200701250923.l0P9N2SU023884@kzsu.stanford.edu> References: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> <200701250923.l0P9N2SU023884@kzsu.stanford.edu> Message-ID: <20070125193313.GA33310@fu.funkspiel.org> On Thu, Jan 25, 2007 at 01:23:02AM -0800, Joe Brenner wrote: > David Alban <extasia at extasia.org> wrote: > > use lib "/usr/local/reg/lib/perl5/site_perl/5.8.0"; > > use Crypt::PasswdMD5; > > Do you know about the PERL5LIB environment variable? If you put > a few of your commonly used /usr/local paths in your PERL5LIB, you can > stop adding them to all to your scripts with "use lib". Right. And in this case, you'd do export PERL5LIB=/usr/local/reg/lib/perl5 # bash syntax ... then Perl automatically searches under there for site_perl, site_perl/5.8.0, and all those other weirdly named subdirs that Perl uses to install things. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From david at fetter.org Thu Jan 25 12:17:38 2007 From: david at fetter.org (David Fetter) Date: Thu, 25 Jan 2007 12:17:38 -0800 Subject: [sf-perl] [oak perl] Internationalizing a Perl application In-Reply-To: <200701250916.l0P9GXU4023793@kzsu.stanford.edu> References: <20070116020207.GB28294@tao.fairpath.com> <200701250916.l0P9GXU4023793@kzsu.stanford.edu> Message-ID: <20070125201738.GD26502@fetter.org> On Thu, Jan 25, 2007 at 01:16:33AM -0800, Joe Brenner wrote: > Quinn Weaver <quinn at fairpath.com> wrote: > > > David Fetter wrote: > > > > * What pains can I avoid, and how? > > Don't use built-up strings. Programmers like to do clever things like > write a generic message where nouns are filled in like a game of > madlibs: [many good suggestions elided] Thanks, Joe :) Cheers, D -- David Fetter <david at fetter.org> http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From Jeff.Thalhammer at barclaysglobal.com Fri Jan 26 06:54:40 2007 From: Jeff.Thalhammer at barclaysglobal.com (Thalhammer, Jeffrey BGI SF) Date: Fri, 26 Jan 2007 06:54:40 -0800 Subject: [sf-perl] Module Announcement: Perl-Critic-1.01 Message-ID: <3A2096A63456DC469D46178CA9F8309F01497F82@calnte2k035.insidelive.net> After more than 18 months of development, Perl-Critic <http://search.cpan.org/dist/Perl-Critic> has reached it's first major release! Version 1.01 is now available on a CPAN mirror near you. For those of you who aren't familiar with it, Perl-Critic <http://search.cpan.org/dist/Perl-Critic> is a highly flexible static source code analyzer (like lint, but for Perl code). It automatically detects potential bugs, awkward constructs and over-complicated code. Most of the rules are based on Damian Conway's highly acclaimed book "Perl Best Practices". No matter what your personal preferences are, Perl-Critic can help you and your team write more consistent, robust, and maintainable code. Numerous open-source projects and commercial development shops have adopted Perl-Critic as an integral part of their development process. So I invite all of you to give Perl-Critic a shot. If you want to see what it does without installing anything, try using the Perl-Critic web service at <http://perlcritic.com>. -Jeff -- This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed. From rdm at cfcl.com Fri Jan 26 07:56:42 2007 From: rdm at cfcl.com (Rich Morin) Date: Fri, 26 Jan 2007 07:56:42 -0800 Subject: [sf-perl] Fwd: [IP] Stanford EE CS Colloq] Computer Architecture is Back * 4:15PM, Wed Jan 31, 2007 in Gates B01 Message-ID: <p0623091bc1dfd4135591@[192.168.1.205]> Begin forwarded message: From: allison at stanford.edu Date: January 26, 2007 10:11:36 AM EST Subject: [EE CS Colloq] Computer Architecture is Back * 4:15PM, Wed Jan 31, 2007 in Gates B01 Reply-To: ee380 at shasta.stanford.edu Stanford EE Computer Systems Colloquium 4:15PM, Wednesday, Jan 31, 2007 HP Auditorium, Gates Computer Science Building B01 http://ee380.stanford.edu[1] Topic: Computer Architecture is Back The Berkeley View of the Parallel Computing Research Landscape Speaker: Dave Patterson EECS, UC Berkeley About the talk: The sequential processor era is now officially over, as the IT industry has bet its future on multiple processors per chip. The new trend is doubling the number of cores per chip every two years instead the regular doubling of uniprocessor performance. This shift toward increasing parallelism is not a triumphant stride forward based on breakthroughs in novel software and architectures for parallelism; instead, this plunge into parallelism is actually a retreat from even greater challenges that thwart efficient silicon implementation of traditional uniprocessor architectures. A diverse group of University of California at Berkeley researchers from many backgrounds -- circuit design, computer architecture, massively parallel computing, computer-aided design, embedded hardware and software, programming languages, compilers, scientific programming, and numerical analysis -- met for nearly two years to discuss parallelism from these many angles. This talk and a technical report are the result. (See view.eecs.berkeley.edu) We concluded that sneaking up on the problem of parallelism the way industry is planning is likely to fail, and we desperately need a new solution for parallel hardware and software. Here are some of our recommendations: * The overarching goal should be to make it easy to write programs that execute efficiently on highly parallel computing systems * The target should be 1000s of cores per chip, as these chips are built from processing elements that are the most efficient in MIPS (Million Instructions per Second) per watt, MIPS per area of silicon, and MIPS per development dollar. * Instead of traditional benchmarks, use 13 Dwarfs to design and evaluate parallel programming models and architectures. (A dwarf is an algorithmic method that captures a pattern of computation and communication.) * Autotuners should play a larger role than conventional compilers in translating parallel programs. * To maximize programmer productivity, future programming models must be more human-centric than the conventional focus on hardware or applications or formalisms. * Traditional operating systems will be deconstructed and operating system functionality will be orchestrated using libraries and virtual machines. * To explore the design space rapidly, use system emulators based on Field Programmable Gate Arrays that are highly scalable, low cost, and flexible. (see ramp.eecs.berkeley.edu) Now that the IT industry is urgently facing perhaps its greatest challenge in 50 years, and computer architecture is a necessary but not sufficient component to any solution, this talk declares that computer architecture is interesting once again. About the speaker: David A. Patterson has been Professor of Computer Science at the University of California, Berkeley since 1977, after receiving his all his degrees from UCLA. He is one of the pioneers of both RISC and RAID. He co-authored five books, including two on computer architecture with John Hennessy; the fourth edition of their graduate book was released in September. Past chair of the Computer Science Department at U.C. Berkeley and the Computing Research Association (CRA), he was elected President of the Association for Computing Machinery (ACM) for 2004 to 2006 and served on the Information Technology Advisory Committee for the U.S. President (PITAC) from 2003 to 2005. His work was recognized by education and research awards from ACM (Karlstrom Educator Award, Fellow) and IEEE (Von Neumann Medal, Mulligan Educator Medal, Johnson Information Storage Award, Fellow) and by election to the National Academy of Engineering. In 2005 he shared Japan's Computer & Communication award with Hennessy and was named to the Silicon Valley Engineering Hall of Fame. In 2006 he received the Distinguished Service Award from CRA and was elected to both the American Academy of Arts and Sciences and to the National Academy of Sciences. --- End Forward --- -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From quinn at fairpath.com Fri Jan 26 11:58:24 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Fri, 26 Jan 2007 11:58:24 -0800 Subject: [sf-perl] Module Announcement: Perl-Critic-1.01 In-Reply-To: <3A2096A63456DC469D46178CA9F8309F01497F82@calnte2k035.insidelive.net> References: <3A2096A63456DC469D46178CA9F8309F01497F82@calnte2k035.insidelive.net> Message-ID: <20070126195824.GA43078@fu.funkspiel.org> On Fri, Jan 26, 2007 at 06:54:40AM -0800, Thalhammer, Jeffrey BGI SF wrote: > After more than 18 months of development, Perl-Critic > <http://search.cpan.org/dist/Perl-Critic> has reached it's first major > release! Version 1.01 is now available on a CPAN mirror near you. Woohoo! Congratulations. Perl-Critic is awesome. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ From david at fetter.org Fri Jan 26 12:56:59 2007 From: david at fetter.org (David Fetter) Date: Fri, 26 Jan 2007 12:56:59 -0800 Subject: [sf-perl] Module Announcement: Perl-Critic-1.01 In-Reply-To: <3A2096A63456DC469D46178CA9F8309F01497F82@calnte2k035.insidelive.net> References: <3A2096A63456DC469D46178CA9F8309F01497F82@calnte2k035.insidelive.net> Message-ID: <20070126205659.GP26502@fetter.org> On Fri, Jan 26, 2007 at 06:54:40AM -0800, Thalhammer, Jeffrey BGI SF wrote: > After more than 18 months of development, Perl-Critic > <http://search.cpan.org/dist/Perl-Critic> has reached it's first major > release! Version 1.01 is now available on a CPAN mirror near you. Kudos!!! Cheers, D (trying to figure out how best to apply this to PL/Perl[U]) > > For those of you who aren't familiar with it, Perl-Critic > <http://search.cpan.org/dist/Perl-Critic> is a highly flexible static > source code analyzer (like lint, but for Perl code). It automatically > detects potential bugs, awkward constructs and over-complicated code. > Most of the rules are based on Damian Conway's highly acclaimed book > "Perl Best Practices". > > No matter what your personal preferences are, Perl-Critic can help you > and your team write more consistent, robust, and maintainable code. > Numerous open-source projects and commercial development shops have > adopted Perl-Critic as an integral part of their development process. > > So I invite all of you to give Perl-Critic a shot. If you want to see > what it does without installing anything, try using the Perl-Critic web > service at <http://perlcritic.com>. > > -Jeff > > -- > > This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed. > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm -- David Fetter <david at fetter.org> http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From extasia at extasia.org Mon Jan 29 18:01:50 2007 From: extasia at extasia.org (David Alban) Date: Mon, 29 Jan 2007 18:01:50 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules In-Reply-To: <20070125193313.GA33310@fu.funkspiel.org> References: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> <200701250923.l0P9N2SU023884@kzsu.stanford.edu> <20070125193313.GA33310@fu.funkspiel.org> Message-ID: <4c714a9c0701291801h2d0ba3aemba3ed6e91529a699@mail.gmail.com> (Assume I'm not allowed to update the "live" perl installation, so I'm installing modules in the /usr/local/reg tree.) I have: $ find /usr/local/reg/lib/perl5 -type f /usr/local/reg/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Crypt/PasswdMD5/.packlist /usr/local/reg/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/perllocal.pod /usr/local/reg/lib/perl5/site_perl/5.8.0/Crypt/PasswdMD5.pm /usr/local/reg/lib/perl5/Log/Transcript.pm Crypt::PasswdMD5 is from CPAN. I took Garth's suggestion and did: $ perl Makefile.PL PREFIX=/usr/local/reg and the files were installed as shown above. Log::Transcript is the module I wrote. Ideally, I'd like to have users be able to include a single "use ..." statement in the code.[1] I'd like it to be: use lib "/usr/local/reg/lib/perl5"; # or /usr/local/reg/lib/perl if I make the latter a symlink to the former Not two: use lib "/usr/local/reg/lib/perl5"; use lib "/usr/local/reg/lib/perl5/site_perl"; Based on Quinn's suggestion, I thought the former might allow a program to pick up both Log::Transcript (or, home-grown modules) and Crypt::PasswdMD5 (or, cpan installed modules). But it doesn't pick up the site_perl tree: $ unset PERL5LIB; perl -I/usr/local/reg/lib/perl5 -MCrypt::PasswdMD5 -e 1 Can't locate Crypt/PasswdMD5.pm in @INC (@INC contains: /usr/local/reg/lib/perl5/5.8.0/i386-linux-thread-multi /usr/local/reg/lib/perl5/5.8.0 /usr/local/reg/lib/perl5 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .). BEGIN failed--compilation aborted. It's a little clearer here: $ unset PERL5LIB; perl -I/usr/local/reg/lib/perl5 -e 'print join "\n", @INC' /usr/local/reg/lib/perl5/5.8.0/i386-linux-thread-multi /usr/local/reg/lib/perl5/5.8.0 /usr/local/reg/lib/perl5 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 Am I missing something that I can use to get a single: use lib "/usr/local/reg/lib/perl5"; statement to work (i.e., to include the site_perl tree, too)? Thanks, David [1] There's no hope of getting them to set PERL5LIB in their environment On 1/25/07, Quinn Weaver <quinn at fairpath.com> wrote: > Right. And in this case, you'd do > > export PERL5LIB=/usr/local/reg/lib/perl5 # bash syntax > > ... then Perl automatically searches under there for site_perl, > site_perl/5.8.0, and all those other weirdly named subdirs that > Perl uses to install things. -- Live in a world of your own, but always welcome visitors. From extasia at extasia.org Mon Jan 29 19:41:42 2007 From: extasia at extasia.org (David Alban) Date: Mon, 29 Jan 2007 19:41:42 -0800 Subject: [sf-perl] Net::Domain and system() Message-ID: <4c714a9c0701291941m4e4bbe49ib1dd2f638e36fbab@mail.gmail.com> Greetings, A program I wrote uses a module I wrote. The program uses system(). I saw: Ambiguous call resolved as CORE::system(), qualify as such or use & at ... line .... wtf? I distilled it down to a simple example running on a machine with uname output: Linux myhost 2.4.21-47.0.1.ELsmp #1 SMP Fri Oct 13 17:56:20 EDT 2006 i686 i686 i386 GNU/Linux and perl version: This is perl, v5.8.0 built for i386-linux-thread-multi (with 1 registered patch, see perl -V for more detail) We also have: $ locate Domain | grep Net /usr/share/man/man3/Net::Domain.3pm.gz /usr/lib/perl5/5.8.0/Net/Domain.pm The program is: 1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 use lib "/home/dalban/tmp"; 7 8 use Foo::Bar; 9 10 # system "echo foo"; 11 # CORE::system "echo foo"; If line 10 is uncommented and line 11 is commented, I get: Ambiguous call resolved as CORE::system(), qualify as such or use & at junk line 10. foo If line 10 is commented and line 11 is uncommented, it works fine: foo Here is Foo/Bar.pm: 1 package Foo::Bar; 2 3 use strict; 4 use warnings; 5 6 use Net::Domain; 7 8 get_hostname(); 9 10 #----------------------------------------------------------------------- 11 sub get_hostname { 12 return Net::Domain::hostfqdn(); 13 } # get_hostname 14 15 #----------------------------------------------------------------------- 16 17 1; The module and program are silly, but they reproduce the error I'm seeing with the stuff I'm developing. If I comment Bar.pm line 8 and run junk (the program calling it), I don't get the error about resolving system(). If I substitute Net::Domain::hostname() or Net::Domain::hostdomain on Bar.pm line 12, I get the error also. What am I missing? Why does it seem like using the functions in Net::Domain causes perl to be confused about calls to system()? Thanks, David -- Live in a world of your own, but always welcome visitors. From moseley at hank.org Mon Jan 29 20:13:26 2007 From: moseley at hank.org (Bill Moseley) Date: Mon, 29 Jan 2007 20:13:26 -0800 Subject: [sf-perl] /usr/local/foo/ for cpan and locally grown modules In-Reply-To: <4c714a9c0701291801h2d0ba3aemba3ed6e91529a699@mail.gmail.com> References: <4c714a9c0701241953n510935dfub98888e94af90d9e@mail.gmail.com> <200701250923.l0P9N2SU023884@kzsu.stanford.edu> <20070125193313.GA33310@fu.funkspiel.org> <4c714a9c0701291801h2d0ba3aemba3ed6e91529a699@mail.gmail.com> Message-ID: <20070130041325.GA7968@hank.org> On Mon, Jan 29, 2007 at 06:01:50PM -0800, David Alban wrote: > $ find /usr/local/reg/lib/perl5 -type f > /usr/local/reg/lib/perl5/site_perl/5.8.0/Crypt/PasswdMD5.pm > /usr/local/reg/lib/perl5/Log/Transcript.pm [...] > Ideally, I'd like to have users be able to include a single "use ..." > statement in the code.[1] I'd like it to be: > > use lib "/usr/local/reg/lib/perl5"; > # or /usr/local/reg/lib/perl if I make the latter a symlink to > the former > > Not two: > > use lib "/usr/local/reg/lib/perl5"; > use lib "/usr/local/reg/lib/perl5/site_perl"; Is site_perl included automatically? $ mkdir -p $HOME/local/foo/lib/perl5/site_perl $ PERL5LIB=$HOME/local/foo/lib/perl5 strace -e trace=stat64 perl -MLog::Transfer -e 1 2>&1 | perl -lne 'm!([^"]+/foo/[^"]+)! && print $1' /home/moseley/local/foo/lib/perl5/5.8.8/i486-linux-gnu-thread-multi /home/moseley/local/foo/lib/perl5/5.8.8 /home/moseley/local/foo/lib/perl5/i486-linux-gnu-thread-multi /home/moseley/local/foo/lib/perl5/5.8.7 /home/moseley/local/foo/lib/perl5/5.8.6 /home/moseley/local/foo/lib/perl5/5.8.4 /home/moseley/local/foo/lib/perl5/5.8.3 /home/moseley/local/foo/lib/perl5/5.8.2 /home/moseley/local/foo/lib/perl5/5.8.1 /home/moseley/local/foo/lib/perl5/5.8.0 /home/moseley/local/foo/lib/perl5/Log/Transfer.pmc /home/moseley/local/foo/lib/perl5/Log/Transfer.pm -- Bill Moseley moseley at hank.org From moseley at hank.org Mon Jan 29 20:24:09 2007 From: moseley at hank.org (Bill Moseley) Date: Mon, 29 Jan 2007 20:24:09 -0800 Subject: [sf-perl] Net::Domain and system() In-Reply-To: <4c714a9c0701291941m4e4bbe49ib1dd2f638e36fbab@mail.gmail.com> References: <4c714a9c0701291941m4e4bbe49ib1dd2f638e36fbab@mail.gmail.com> Message-ID: <20070130042408.GB7968@hank.org> On Mon, Jan 29, 2007 at 07:41:42PM -0800, David Alban wrote: > Ambiguous call resolved as CORE::system(), qualify as such or use > & at ... line .... How about system()? > I distilled it down to a simple example running on a machine with uname output: I can't repeat, but... > This is perl, v5.8.0 built for i386-linux-thread-multi Isn't 5.8.0 from about 2002? Maybe that's the problem? > Here is Foo/Bar.pm: > > 1 package Foo::Bar; > 2 > 3 use strict; > 4 use warnings; > 5 > 6 use Net::Domain; > 7 > 8 get_hostname(); Why are you calling get_hostname() there? Is this your example that fails? moseley at bumby:~$ cat t.pl #!/usr/bin/perl use strict; use warnings; use lib '.'; use Bar; system "echo foo"; moseley at bumby:~$ cat Bar.pm package Bar; use strict; use warnings; use Net::Domain; get_hostname(); sub get_hostname { return Net::Domain::hostfqdn(); } 1; moseley at bumby:~$ perl t.pl foo -- Bill Moseley moseley at hank.org From extasia at extasia.org Mon Jan 29 20:38:57 2007 From: extasia at extasia.org (David Alban) Date: Mon, 29 Jan 2007 20:38:57 -0800 Subject: [sf-perl] Net::Domain and system() In-Reply-To: <20070130042408.GB7968@hank.org> References: <4c714a9c0701291941m4e4bbe49ib1dd2f638e36fbab@mail.gmail.com> <20070130042408.GB7968@hank.org> Message-ID: <4c714a9c0701292038x5193a177hf6d91e3b8d678fa2@mail.gmail.com> On 1/29/07, Bill Moseley <moseley at hank.org> wrote: > Isn't 5.8.0 from about 2002? Maybe that's the problem? Quite possibly. The code experiencing the problem is at work. At home I fail, as you did, to reproduce the problem on mac os x running perl 5.8.6. O.K. I'll just tell folks at work that they have to use: CORE::system ...; when they use my module, if they don't want the error. Thanks. P.S. system( ... ); didn't solve the problem on the work machine. Only adding CORE:: did. -- Live in a world of your own, but always welcome visitors.