From lembark at wrkhors.com Wed Mar 1 14:45:04 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Wed, 01 Mar 2006 17:45:04 -0500 Subject: [Chicago-talk] Why do I need "use" In-Reply-To: <200602272031.48502.me@heyjay.com> References: <200602272031.48502.me@heyjay.com> Message-ID: <0BB78E8058AB75E26CA61667@[192.168.1.9]> -- Jay Strauss > Hi, > > there was a message on the DBI user list, where the guy wanted to know > how to solve: > > Can't locate object method "connect" via package "DBI" (perhaps you > forgot to load "DBI"?) at... > > My question is: Why do you have to use "use"? Perl is so forgiving in > many cases, and you can load modules at runtime. Why doesn't Perl just > automatically load modules it discovers in the source? DBI will load the DBD modules for you, but Perl has to have seen the constructor for DBI once in order for you to call: DBI->connect( ... ); You don't really have to "use" DBI: you could require it but most people are used to using modules and having the deed done early is helpful. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Wed Mar 1 14:47:35 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Wed, 01 Mar 2006 17:47:35 -0500 Subject: [Chicago-talk] Why do I need "use" In-Reply-To: <2715accf0602271849r356ec65bkeb558dca369323b2@mail.gmail.com> References: <200602272031.48502.me@heyjay.com> <2715accf0602271849r356ec65bkeb558dca369323b2@mail.gmail.com> Message-ID: -- brian d foy > On 2/27/06, Jay Strauss wrote: > >> My question is: Why do you have to use "use"? Perl is so forgiving in >> many cases, and you can load modules at runtime. Why doesn't Perl just >> automatically load modules it discovers in the source? > > There is Class:Autouse if you want that sort of behavior. Otherwise, > Larry's answer to these sorts of things has been "Because." :) You can also delay the use with: Object::Trampoline::Use->connect( 'DBI', ... ) which delays everything until one of the DBI object's methods is really called. Problem there is that if DBI is going to fail for any reason you won't find it out until fairly late in the code (vs. at the start with use). -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Sun Mar 5 11:46:33 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Sun, 05 Mar 2006 14:46:33 -0500 Subject: [Chicago-talk] Papers for YAPC 2006? Message-ID: <4C5B4A52F650AD6DF4B5DB88@[192.168.1.2]> I worked on a bioinformatics project at IIT, was going to try and get the data together for something showing how Perl was used. Can't find anything on submissions in the YAPC website (http://www.yapcchicago.org/). Any pointers appreciated. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Sun Mar 5 11:47:36 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Sun, 05 Mar 2006 14:47:36 -0500 Subject: [Chicago-talk] Found it... Message-ID: <0062169EF9E9074262F5BDDE@[192.168.1.2]> Original page was truncated... -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From shijialeee at yahoo.com Sun Mar 5 21:22:21 2006 From: shijialeee at yahoo.com (James.Q.L) Date: Sun, 5 Mar 2006 21:22:21 -0800 (PST) Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. Message-ID: <20060306052221.32023.qmail@web50403.mail.yahoo.com> hi, i am reading many html files locally using WWW::Mechanize and URI. the html files have no extention. however, WWW::Mechanize can't seem to recognize the file as html. the followign code spits out the html source file instead of text only. a file with ht[m|ml] extention works fine. anyway i can get around it without renaming all the files (not that it is a big deal though, but i am wondering..) use strict; use warnings; use URI::file; use WWW::Mechanize; my $m = WWW::Mechanize->new(); $m->get(URI::file->new('/home/pub/html/test/151683_10')); print $m->content(format => 'text'); TIA, Qiang __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From Andy_Bach at wiwb.uscourts.gov Mon Mar 6 08:50:22 2006 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Mon, 6 Mar 2006 10:50:22 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <20060306052221.32023.qmail@web50403.mail.yahoo.com> Message-ID: Do you have a content-type: text/html field in the header of the file? I imagine that's what tells Mech to treat things as html, otherwise the default is probably "text/plain". a Andy Bach, Sys. Mangler Internet: andy_bach at wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 If you just try long enough and hard enough, you can always manage to boot yourself in the posterior. -- A. J. Liebling From whjackson at gmail.com Mon Mar 6 21:36:54 2006 From: whjackson at gmail.com (Whitney Jackson) Date: Mon, 06 Mar 2006 23:36:54 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <20060306052221.32023.qmail@web50403.mail.yahoo.com> References: <20060306052221.32023.qmail@web50403.mail.yahoo.com> Message-ID: <1141709814.3986.34.camel@pc1015> On Sun, 2006-03-05 at 21:22 -0800, James.Q.L wrote: > hi, > > i am reading many html files locally using WWW::Mechanize and URI. > the html files have no extention. however, WWW::Mechanize can't seem to recognize the file as > html. > the followign code spits out the html source file instead of text only. > a file with ht[m|ml] extention works fine. anyway i can get around it without renaming all the > files (not that it is a big deal though, but i am wondering..) > > use strict; > use warnings; > use URI::file; > use WWW::Mechanize; > > my $m = WWW::Mechanize->new(); > $m->get(URI::file->new('/home/pub/html/test/151683_10')); > print $m->content(format => 'text'); > > TIA, > > Qiang > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk This works if you don't mind being a little evil: my $m = WWW::Mechanize->new(); $m->get(URI::file->new('/home/pub/html/test/151683_10')); $m->{ct} = 'text/html'; # <-- the evil part print $m->content(format => 'text'); It would be nice if the ct method could take an argument that lets you set the content type. Or even better if you could change the default to whatever you want. I once had to use WWW::Mechanize against a strange web server that refused to define 'Content-Type' and it was a real pain. Whitney From andy at petdance.com Mon Mar 6 21:44:12 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 6 Mar 2006 23:44:12 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <1141709814.3986.34.camel@pc1015> References: <20060306052221.32023.qmail@web50403.mail.yahoo.com> <1141709814.3986.34.camel@pc1015> Message-ID: <560CA26C-28D3-4209-8680-9BD5D101B6F2@petdance.com> > my $m = WWW::Mechanize->new(); > $m->get(URI::file->new('/home/pub/html/test/151683_10')); > $m->{ct} = 'text/html'; # <-- the evil part > print $m->content(format => 'text'); It's evil, and it also will break if the internal representation of {ct} ever changes. > It would be nice if the ct method could take an argument that lets you > set the content type. Or even better if you could change the > default to > whatever you want. That might just happen. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Mon Mar 6 22:02:46 2006 From: andy at petdance.com (Andy Lester) Date: Tue, 7 Mar 2006 00:02:46 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <1141709814.3986.34.camel@pc1015> References: <20060306052221.32023.qmail@web50403.mail.yahoo.com> <1141709814.3986.34.camel@pc1015> Message-ID: <1B676440-8EC9-4729-87DA-B8920E4E1BAA@petdance.com> > > It would be nice if the ct method could take an argument that lets you > set the content type. Or even better if you could change the > default to > whatever you want. I once had to use WWW::Mechanize against a strange > web server that refused to define 'Content-Type' and it was a real > pain. Hey, while poking, I realized you could do this: $mech->update_html( $mech->content ); It'll set your content type. xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From whjackson at gmail.com Mon Mar 6 22:41:42 2006 From: whjackson at gmail.com (Whitney Jackson) Date: Tue, 07 Mar 2006 00:41:42 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <1B676440-8EC9-4729-87DA-B8920E4E1BAA@petdance.com> References: <20060306052221.32023.qmail@web50403.mail.yahoo.com> <1141709814.3986.34.camel@pc1015> <1B676440-8EC9-4729-87DA-B8920E4E1BAA@petdance.com> Message-ID: <1141713702.3986.38.camel@pc1015> > > > > It would be nice if the ct method could take an argument that lets you > > set the content type. Or even better if you could change the > > default to > > whatever you want. I once had to use WWW::Mechanize against a strange > > web server that refused to define 'Content-Type' and it was a real > > pain. > > Hey, while poking, I realized you could do this: > > $mech->update_html( $mech->content ); > > It'll set your content type. > > xoxo, > Andy > Ahh...much less evil :) Thanks! Whitney From andy at petdance.com Tue Mar 7 06:45:34 2006 From: andy at petdance.com (Andy Lester) Date: Tue, 7 Mar 2006 08:45:34 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <1141713702.3986.38.camel@pc1015> References: <20060306052221.32023.qmail@web50403.mail.yahoo.com> <1141709814.3986.34.camel@pc1015> <1B676440-8EC9-4729-87DA-B8920E4E1BAA@petdance.com> <1141713702.3986.38.camel@pc1015> Message-ID: > > Ahh...much less evil :) Thanks! Would you do me a favor, please? Write up a problem & solution describing what you were trying to do and why that I can add to the FAQ? -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From shijialeee at yahoo.com Tue Mar 7 18:53:27 2006 From: shijialeee at yahoo.com (James.Q.L) Date: Tue, 7 Mar 2006 18:53:27 -0800 (PST) Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <1B676440-8EC9-4729-87DA-B8920E4E1BAA@petdance.com> Message-ID: <20060308025327.80670.qmail@web50412.mail.yahoo.com> --- Andy Lester wrote: > > > > It would be nice if the ct method could take an argument that lets you > > set the content type. Or even better if you could change the > > default to > > whatever you want. I once had to use WWW::Mechanize against a strange > > web server that refused to define 'Content-Type' and it was a real > > pain. > > Hey, while poking, I realized you could do this: > > $mech->update_html( $mech->content ); > > It'll set your content type. I tried with that but no luck. it still spit out the html source instead of the plain text. > > xoxo, > Andy > Qiang __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From andy at petdance.com Tue Mar 7 21:45:57 2006 From: andy at petdance.com (Andy Lester) Date: Tue, 7 Mar 2006 23:45:57 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <20060308025327.80670.qmail@web50412.mail.yahoo.com> References: <20060308025327.80670.qmail@web50412.mail.yahoo.com> Message-ID: <0C64695D-DFAA-46FC-AB17-FB138E88759D@petdance.com> >> >> $mech->update_html( $mech->content ); >> >> It'll set your content type. > > I tried with that but no luck. it still spit out the html source > instead of the plain text. Of course. Mech doesn't render HTML. xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From brian.d.foy at gmail.com Wed Mar 8 06:26:53 2006 From: brian.d.foy at gmail.com (brian d foy) Date: Wed, 8 Mar 2006 08:26:53 -0600 Subject: [Chicago-talk] WWW::Mechanize can't recognize a html file with no file extention. In-Reply-To: <0C64695D-DFAA-46FC-AB17-FB138E88759D@petdance.com> References: <20060308025327.80670.qmail@web50412.mail.yahoo.com> <0C64695D-DFAA-46FC-AB17-FB138E88759D@petdance.com> Message-ID: <2715accf0603080626v2ee261bbqacf83eea839fe1c7@mail.gmail.com> On 3/7/06, Andy Lester wrote: > Of course. Mech doesn't render HTML. Its docs say that it does: $mech->content( format => "text" ) Returns a text-only version of the page, with all HTML markup stripped. This feature requires HTML::TreeBuilder to be installed, or a fatal error will be thrown. -- brian d foy http://www.pair.com/~comdog/ From richard at rushlogistics.com Wed Mar 8 09:57:41 2006 From: richard at rushlogistics.com (Richard Reina) Date: Wed, 8 Mar 2006 09:57:41 -0800 (PST) Subject: [Chicago-talk] accessing NIS password Message-ID: <20060308175741.58601.qmail@web404.biz.mail.mud.yahoo.com> I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry against the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060308/80db0666/attachment.html From Darren.Young at ChicagoGSB.edu Wed Mar 8 10:31:51 2006 From: Darren.Young at ChicagoGSB.edu (Young, Darren) Date: Wed, 8 Mar 2006 12:31:51 -0600 Subject: [Chicago-talk] accessing NIS password Message-ID: <490F3E9EEF01B04598860AAB71777B4E2BF8F1@GSBEX.gsb.uchicago.edu> Use the getpw* (getpwnam) functions to return the user's password entry, if your name service switch is configured correctly it'll return the entry regardless of location. You MUST have the encrypted first to perform the comparision. This is also assuming you're password is in crypt format and not something else (MD5, etc). If it is crypt, take the first 2 characters to get the salt then re-crypt() the plain from the user with that salt. Once that's done just string compare the 2, if they match, the password was correct, else, it was wrong. >>> my $username = 'foo'; my $plainfromuser = 'hispass'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); $currentsalt = substr($passwd,0,2); my $tpass = crypt($plainfromuser, $currentsalt); if ( $tpass eq $passwd ) { print "good\n"; } else { print "bad\n"; } Just tried that on my NIS enabled Solaris 8 system and it worked. I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry against the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. From richard at rushlogistics.com Thu Mar 9 07:59:53 2006 From: richard at rushlogistics.com (Richard Reina) Date: Thu, 9 Mar 2006 07:59:53 -0800 (PST) Subject: [Chicago-talk] accessing NIS password In-Reply-To: <490F3E9EEF01B04598860AAB71777B4E2BF8F1@GSBEX.gsb.uchicago.edu> Message-ID: <20060309155953.551.qmail@web402.biz.mail.mud.yahoo.com> Darren, Thank you very much for the reply. Unfortunately, for me I am running linux which appears to use MD5 and a complicated salt that has me stumped. So far I've tried: #MD5 salt my @chars = ('a'..'z','A'..'Z','0..9','.'); for (1..8) { $MD5salt .= $chars[int(rand(scalar(@chars)))]; } my $tpass = crypt($plainfromuser, '$1$' . $MD5salt); unix_MD5_crypt($plainfromuser, '$1$' . $MD5salt) also gives me the same result (string) while $tpass does match $passwd in length (number of characters) the string is vastly different and as a result does not match. Any additional help would be greatly appreciated. Thanks, again for the help thus far. "Young, Darren" wrote: Use the getpw* (getpwnam) functions to return the user's password entry, if your name service switch is configured correctly it'll return the entry regardless of location. You MUST have the encrypted first to perform the comparision. This is also assuming you're password is in crypt format and not something else (MD5, etc). If it is crypt, take the first 2 characters to get the salt then re-crypt() the plain from the user with that salt. Once that's done just string compare the 2, if they match, the password was correct, else, it was wrong. >>> my $username = 'foo'; my $plainfromuser = 'hispass'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); $currentsalt = substr($passwd,0,2); my $tpass = crypt($plainfromuser, $currentsalt); if ( $tpass eq $passwd ) { print "good\n"; } else { print "bad\n"; } Just tried that on my NIS enabled Solaris 8 system and it worked. I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry against the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060309/555e8c0e/attachment.html From andy at petdance.com Thu Mar 9 16:01:34 2006 From: andy at petdance.com (Andy Lester) Date: Thu, 9 Mar 2006 18:01:34 -0600 Subject: [Chicago-talk] Job opening in Lake Bluff Message-ID: In case anyone missed this: http://jobs.perl.org/job/3801 Open Source Software Engineer, Lake Bluff, IL | 75-120k o The ideal candidate will be fluent in Ruby as well as proficient with Ruby on Rails. Given that these are new technologies, extensive experience developing web applications in Object-Oriented Perl, Python, or Java can be substituted as long as a strong desire to work in Ruby exists. o Experience in JavaScript and CSS is desirable as well as AJAX. o A deep understanding of relational databases and SQL is a must. o Experience with MySQL, PostgreSql is a big plus. o Experience with Linux/Unix is a must. o A degree in Computer Science, Engineering or relevant experience -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From richard at rushlogistics.com Fri Mar 10 06:06:27 2006 From: richard at rushlogistics.com (Richard Reina) Date: Fri, 10 Mar 2006 06:06:27 -0800 (PST) Subject: [Chicago-talk] accessing NIS password In-Reply-To: <490F3E9EEF01B04598860AAB71777B4E2BF8F1@GSBEX.gsb.uchicago.edu> Message-ID: <20060310140627.82938.qmail@web403.biz.mail.mud.yahoo.com> Dear Darren, I still stumped and under increasing pressure to get this figured out. I know it's not a lot of money, but for a $100 would it be worth your while to help me out. Richard "Young, Darren" wrote: Use the getpw* (getpwnam) functions to return the user's password entry, if your name service switch is configured correctly it'll return the entry regardless of location. You MUST have the encrypted first to perform the comparision. This is also assuming you're password is in crypt format and not something else (MD5, etc). If it is crypt, take the first 2 characters to get the salt then re-crypt() the plain from the user with that salt. Once that's done just string compare the 2, if they match, the password was correct, else, it was wrong. >>> my $username = 'foo'; my $plainfromuser = 'hispass'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); $currentsalt = substr($passwd,0,2); my $tpass = crypt($plainfromuser, $currentsalt); if ( $tpass eq $passwd ) { print "good\n"; } else { print "bad\n"; } Just tried that on my NIS enabled Solaris 8 system and it worked. I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry against the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060310/693d187c/attachment.html From jbalint at gmail.com Fri Mar 10 16:59:29 2006 From: jbalint at gmail.com (Jess Balint) Date: Fri, 10 Mar 2006 19:59:29 -0500 Subject: [Chicago-talk] accessing NIS password In-Reply-To: <20060310140627.82938.qmail@web403.biz.mail.mud.yahoo.com> Message-ID: <441220f4.6c053b16.375e.01d3@mx.gmail.com> I would say, first, make sure the hashed password is returned and not 'x' (shadow). Then, check out this page: http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/?ca=dgr-lnxwL inuxCrypt Should have enough details. Jess Balint _____ From: chicago-talk-bounces+jbalint=gmail.com at pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com at pm.org] On Behalf Of Richard Reina Sent: Friday, March 10, 2006 9:06 AM To: Chicago.pm chatter Subject: Re: [Chicago-talk] accessing NIS password Dear Darren, I still stumped and under increasing pressure to get this figured out. I know it's not a lot of money, but for a $100 would it be worth your while to help me out. Richard "Young, Darren" wrote: Use the getpw* (getpwnam) functions to return the user's password entry, if your name service switch is configured correctly it'll return the entry regardless of location. You MUST have the encrypted first to perform the comparision. This is also assuming you're password is in crypt format and not something else (MD5, etc). If it is crypt, take the first 2 characters to get the salt then re-crypt() the plain from the user with that salt. Once that's done just string compare the 2, if they match, the password was correct, else, it was wrong. >>> my $username = 'foo'; my $plainfromuser = 'hispass'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); $currentsalt = substr($passwd,0,2); my $tpass = crypt($plainfromuser, $currentsalt); if ( $tpass eq $passwd ) { print "good\n"; } else { print "bad\n"; } Just tried that on my NIS enabled Solaris 8 system and it worked. I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry ag ainst the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060311/845a7ac8/attachment.html From richard at rushlogistics.com Sat Mar 11 10:12:51 2006 From: richard at rushlogistics.com (Richard Reina) Date: Sat, 11 Mar 2006 10:12:51 -0800 (PST) Subject: [Chicago-talk] accessing NIS password In-Reply-To: <441220f4.6c053b16.375e.01d3@mx.gmail.com> Message-ID: <20060311181251.32583.qmail@web413.biz.mail.mud.yahoo.com> Jess, Thank you for the reply. Do you think I should be writing this in java instead of perl? Can it not be done in perl? Unfortunately, I know no java, but if that's what it's going to take I guess I'll have to look into it. Jess Balint wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } I would say, first, make sure the hashed password is returned and not ?x? (shadow). Then, check out this page: http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/?ca=dgr-lnxwLinuxCrypt Should have enough details. Jess Balint --------------------------------- From: chicago-talk-bounces+jbalint=gmail.com at pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com at pm.org] On Behalf Of Richard Reina Sent: Friday, March 10, 2006 9:06 AM To: Chicago.pm chatter Subject: Re: [Chicago-talk] accessing NIS password Dear Darren, I still stumped and under increasing pressure to get this figured out. I know it's not a lot of money, but for a $100 would it be worth your while to help me out. Richard "Young, Darren" wrote: Use the getpw* (getpwnam) functions to return the user's password entry, if your name service switch is configured correctly it'll return the entry regardless of location. You MUST have the encrypted first to perform the comparision. This is also assuming you're password is in crypt format and not something else (MD5, etc). If it is crypt, take the first 2 characters to get the salt then re-crypt() the plain from the user with that salt. Once that's done just string compare the 2, if they match, the password was correct, else, it was wrong. >>> my $username = 'foo'; my $plainfromuser = 'hispass'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); $currentsalt = substr($passwd,0,2); my $tpass = crypt($plainfromuser, $currentsalt); if ( $tpass eq $passwd ) { print "good\n"; } else { print "bad\n"; } Just tried that on my NIS enabled Solaris 8 system and it worked. I am trying to write a script that prompts a user ( that is already logged in ) for his password when he runs certain perl applications. I am able to write the part that prompts the user for the password with "no echo" however I have no idea how to compare the entry to his password especially since we use NIS and thus the passwords are not on the local machine but on the server ( on the same LAN). Can anyone provide any help on how I would compare the entry ag ainst the NIS password? Thanks in advance, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060311/44d4f425/attachment.html From lembark at wrkhors.com Sun Mar 12 13:16:25 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Sun, 12 Mar 2006 16:16:25 -0500 Subject: [Chicago-talk] Note on Shadow password files Message-ID: <46630CFABB86596B283963AB@[192.168.1.2]> Shadow files don't always use MD5, Blowfish is also common. The check is to look at one of the encrypted passwords for "$1$" or "$2a". Passwords starting with $2a$ are encrypted with the Blowfish hash function which can be handled via: Crypt::Blowfish Perl Blowfish encryption module Crypt-Blowfish-2.10 - 02 Dec 2005 - Dave Paris Crypt::Blowfish_PP Blowfish encryption algorithm implemented purely in Perl Crypt-Blowfish_PP-1.12 - 02 Jan 2001 - Matthew Byng-Maddick If they begin with $1$ then they are MD5 and are probably best handled via: Crypt::PasswdMD5 Provides interoperable MD5-based crypt() functions Crypt-PasswdMD5-1.3 - 17 Feb 2004 - Luis Mu?oz These are the most likely solutions today. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From richard at rushlogistics.com Mon Mar 13 07:19:28 2006 From: richard at rushlogistics.com (Richard Reina) Date: Mon, 13 Mar 2006 07:19:28 -0800 (PST) Subject: [Chicago-talk] accessing NIS password In-Reply-To: <50C3C089E7A86EB8EDBC83C4@[192.168.1.2]> Message-ID: <20060313151928.72806.qmail@web403.biz.mail.mud.yahoo.com> Dear Steve, Thank you very much for the reply. The articles returned in your search highlight some of the differences between crypt, MD5 and blowfish encryption, chiefly which versions of *nix use which and how to encrypt a raw password. I have incorporated those encryption schemes into the script below and while the results are very interesting none of them match the linux password returned by getpwnam() for the given user -- which is not the x shadow. #!/usr/bin/perl5 -w my $username = 'gerald'; my $plainfromuser = 'swhaga'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); # crypt salt $currentsalt = substr($passwd,0,2); # 8 random chars my $key = "justakey"; my $cpass = crypt($plainfromuser, $currentsalt); use Crypt::PasswdMD5; my $xpass = unix_md5_crypt($plainfromuser, '$1$', $currentsalt); my $ypass = crypt($plainfromuser, '$1$' . $key); use Digest::MD5 qw(md5_base64); my $zpass = $currentsalt . md5_base64("$currentsalt/$plainfromuser/$key"); print "passwd " . $passwd . "\n"; print "Crypt pass " . $cpass . "\n"; print "MD5 Crypt pass " . $xpass . "\n"; print "Crypt pass MD5 salt " . $ypass . "\n"; print "MD5_base64 pass " . $zpass . "\n"; ****************************************************** results ****************************************************** passwd $1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1 Crypt pass $1ayHHS8s0NWw MD5 Crypt pass $1$$lCe7AyTRcjUyl7Fdn1T4g0 Crypt pass MD5 salt $1$justakey$uxo5dkFTrnz.u7gtyf/QQ. MD5_base64 pass $14RkT9PfSsSaSoWswj/JaDg As one can see none of the encyptions match the encypted password that I myself have set up for the bogus user "gerald" on our system. Any help would be greatly appreicated. Thank you for your attention. Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060313/650cc1a1/attachment.html From jbalint at gmail.com Tue Mar 14 06:28:06 2006 From: jbalint at gmail.com (Jess Balint) Date: Tue, 14 Mar 2006 09:28:06 -0500 Subject: [Chicago-talk] accessing NIS password In-Reply-To: <20060313151928.72806.qmail@web403.biz.mail.mud.yahoo.com> Message-ID: <4416d2f7.0215b643.6f31.fffffeb1@mx.gmail.com> Darren: Sorry about the previous email, I was only trying to give an example of the algorithm used to generate the encoded password, not suggesting you write it in Java. With the Crypt::PasswdMD5 module, it's very simple. You just had one thing missing. I trimmed the program down to give just what you needed, here it the example: my $plainfromuser = 'swhaga'; # from getpwd() $passwd = '$1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1'; use Crypt::PasswdMD5; my $md5salt = (split(/\$/, $passwd))[2]; # $1$ designates 'unix' md5 crypt # MD5 salt, should be the (up to) 8 chars in between $'s in the encoded passwd, # see Crypt::PasswdMD5 source code for details my $xpass = unix_md5_crypt($plainfromuser, $md5salt); print "MD5salt: $md5salt\n"; print "passwd " . $passwd . "\n"; print "MD5 Crypt pass " . $xpass . "\n"; Jess _____ From: chicago-talk-bounces+jbalint=gmail.com at pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com at pm.org] On Behalf Of Richard Reina Sent: Monday, March 13, 2006 10:19 AM To: lembark at wrkhors.com; chicago-talk at mail.pm.org Subject: Re: [Chicago-talk] accessing NIS password Dear Steve, Thank you very much for the reply. The articles returned in your search highlight some of the differences between crypt, MD5 and blowfish encryption, chiefly which versions of *nix use which and how to encrypt a raw password. I have incorporated those encryption schemes into the script below and while the results are very interesting none of them match the linux password returned by getpwnam() for the given user -- which is not the x shadow. #!/usr/bin/perl5 -w my $username = 'gerald'; my $plainfromuser = 'swhaga'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); # crypt salt $currentsalt = substr($passwd,0,2); # 8 random chars my $key = "justakey"; my $cpass = crypt($plainfromuser, $currentsalt); use Crypt::PasswdMD5; my $xpass = unix_md5_crypt($plainfromuser, '$1$', $currentsalt); my $ypass = crypt($plainfromuser, '$1$' . $key); use Digest::MD5 qw(md5_base64); my $zpass = $currentsalt . md5_base64("$currentsalt/$plainfromuser/$key"); print "passwd " . $passwd . "\n"; print "Crypt pass " . $cpass . "\n"; print "MD5 Crypt pass " . $xpass . "\n"; print "Crypt pass MD5 salt " . $ypass . "\n"; print "MD5_base64 pass " . $zpass . "\n"; ****************************************************** results ****************************************************** passwd $1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1 Crypt pass $1ayHHS8s0NWw MD5 Crypt pass $1$$lCe7AyTRcjUyl7Fdn1T4g0 Crypt pass MD5 salt $1$justakey$uxo5dkFTrnz.u7gtyf/QQ. MD5_base64 pass $14RkT9PfSsSaSoWswj/JaDg As one can see none of the encyptions match the encypted password that I myself have set up for the bogus user "gerald" on our system. Any help would be greatly appreicated. Thank you for your attention. Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060314/d9eaeeb0/attachment.html From richard at rushlogistics.com Tue Mar 14 06:30:48 2006 From: richard at rushlogistics.com (Richard Reina) Date: Tue, 14 Mar 2006 06:30:48 -0800 (PST) Subject: [Chicago-talk] accessing NIS password In-Reply-To: <4416d2f7.0215b643.6f31.fffffeb1@mx.gmail.com> Message-ID: <20060314143048.3746.qmail@web409.biz.mail.mud.yahoo.com> No problem. Thanks for the reply. Jess Balint wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Darren: Sorry about the previous email, I was only trying to give an example of the algorithm used to generate the encoded password, not suggesting you write it in Java. With the Crypt::PasswdMD5 module, it’s very simple. You just had one thing missing. I trimmed the program down to give just what you needed, here it the example: my $plainfromuser = 'swhaga'; # from getpwd() $passwd = '$1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1'; use Crypt::PasswdMD5; my $md5salt = (split(/\$/, $passwd))[2]; # $1$ designates 'unix' md5 crypt # MD5 salt, should be the (up to) 8 chars in between $'s in the encoded passwd, # see Crypt::PasswdMD5 source code for details my $xpass = unix_md5_crypt($plainfromuser, $md5salt); print "MD5salt: $md5salt\n"; print "passwd " . $passwd . "\n"; print "MD5 Crypt pass " . $xpass . "\n"; Jess --------------------------------- From: chicago-talk-bounces+jbalint=gmail.com at pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com at pm.org] On Behalf Of Richard Reina Sent: Monday, March 13, 2006 10:19 AM To: lembark at wrkhors.com; chicago-talk at mail.pm.org Subject: Re: [Chicago-talk] accessing NIS password Dear Steve, Thank you very much for the reply. The articles returned in your search highlight some of the differences between crypt, MD5 and blowfish encryption, chiefly which versions of *nix use which and how to encrypt a raw password. I have incorporated those encryption schemes into the script below and while the results are very interesting none of them match the linux password returned by getpwnam() for the given user -- which is not the x shadow. #!/usr/bin/perl5 -w my $username = 'gerald'; my $plainfromuser = 'swhaga'; my $currentsalt; my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwnam($username); # crypt salt $currentsalt = substr($passwd,0,2); # 8 random chars my $key = "justakey"; my $cpass = crypt($plainfromuser, $currentsalt); use Crypt::PasswdMD5; my $xpass = unix_md5_crypt($plainfromuser, '$1$', $currentsalt); my $ypass = crypt($plainfromuser, '$1$' . $key); use Digest::MD5 qw(md5_base64); my $zpass = $currentsalt . md5_base64("$currentsalt/$plainfromuser/$key"); print "passwd " . $passwd . "\n"; print "Crypt pass " . $cpass . "\n"; print "MD5 Crypt pass " . $xpass . "\n"; print "Crypt pass MD5 salt " . $ypass . "\n"; print "MD5_base64 pass " . $zpass . "\n"; ****************************************************** results ****************************************************** passwd $1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1 Crypt pass $1ayHHS8s0NWw MD5 Crypt pass $1$$lCe7AyTRcjUyl7Fdn1T4g0 Crypt pass MD5 salt $1$justakey$uxo5dkFTrnz.u7gtyf/QQ. MD5_base64 pass $14RkT9PfSsSaSoWswj/JaDg As one can see none of the encyptions match the encypted password that I myself have set up for the bogus user "gerald" on our system. Any help would be greatly appreicated. Thank you for your attention. Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060314/f311cd12/attachment-0001.html From jim at jimandkoka.com Tue Mar 14 09:32:04 2006 From: jim at jimandkoka.com (Jim Thomason) Date: Tue, 14 Mar 2006 11:32:04 -0600 Subject: [Chicago-talk] import as initialize? Message-ID: <5cfdfaf70603140932g2927671bw8f2dffb831dc6952@mail.gmail.com> Is there a community consensus on how import should be used? Personally, I really like the concept of using the thing as a class initialize method as such things exist in other languages. I've even been known to do it a few times. It's just so convenient to use it as a class initialization method. But, alas, I also know that it doesn't work very well to do that due to the simple fact that you can use a module with empty parens or require it and completely skip over that step of calling ->import automagically. Voila, your class is unitialized and things break spectacularly. So is there some other handy dandy way to do class initialization other than using this more-fragile-than-I'd like approach of import? Sure, I can always go into every single class and call an initialize method in it as my last step or first step or what have you, but that seems kludgy. In case it helps, the specific example I'm thinking of is something I did up in Basset::Object: our %imported = (); sub import { my $class = shift; my $conf = $class->conf; my $myconfig = $conf->{$class}; return if $imported{$class}++; foreach my $method (keys %$myconfig) { if ($class->can($method)) { $class->$method($myconfig->{$method}); } } } For each subclass loaded, it looks at the conf file and initializes all class methods to the values defined in the conf file. But the second somebody requires a module, it chokes. Most unpleasant. My options as I see them are: 1) require the users to bring in modules with use and no parens. This is the current approach that I'm not too keen on. 2) Explicitly call initialize (or something like that) in every single subclass. I want to avoid this. 3) Some magical third solution that you (yes you!) the reader can suggest. So what do you guys think? -Jim... From lembark at wrkhors.com Tue Mar 14 09:24:07 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Tue, 14 Mar 2006 12:24:07 -0500 Subject: [Chicago-talk] import as initialize? In-Reply-To: <5cfdfaf70603140932g2927671bw8f2dffb831dc6952@mail.gmail.com> References: <5cfdfaf70603140932g2927671bw8f2dffb831dc6952@mail.gmail.com> Message-ID: <4416FC37.7070100@wrkhors.com> Jim Thomason wrote: > Is there a community consensus on how import should be used? Never. > Personally, I really like the concept of using the thing as a class > initialize method as such things exist in other languages. I've even > been known to do it a few times. It's just so convenient to use it as > a class initialization method. > > But, alas, I also know that it doesn't work very well to do that due > to the simple fact that you can use a module with empty parens or > require it and completely skip over that step of calling ->import > automagically. Voila, your class is unitialized and things break > spectacularly. You are overloading the import method if you use it for package init. The thing is intended for exporting symbols, etc. If the module is used in multiple places you may end up re-init'ing it several times, which is usually not a good thing. > So is there some other handy dandy way to do class initialization > other than using this more-fragile-than-I'd like approach of import? Q: What is wrong with BEGIN (compile time) or INIT (runtime) blocks? -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From brian.d.foy at gmail.com Tue Mar 14 22:24:29 2006 From: brian.d.foy at gmail.com (brian d foy) Date: Wed, 15 Mar 2006 00:24:29 -0600 Subject: [Chicago-talk] "Benchmarking Perl" Message-ID: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> For those of you who didn't want to fight traffic, miss the new episode of "Veronica Mars", listen to me talk about Perl, or win a copy of Perl Best Practices, you can still get my slides from "Benchmarking Perl". http://www.pair.com/~comdog/Talks/benchmarking_perl.pdf -- brian d foy http://www.pair.com/~comdog/ From kent at c2group.net Wed Mar 15 18:11:08 2006 From: kent at c2group.net (Kent Cowgill) Date: Wed, 15 Mar 2006 20:11:08 -0600 Subject: [Chicago-talk] "Benchmarking Perl" In-Reply-To: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> References: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> Message-ID: <58853A5D-DD67-4DAE-A99C-E00A55944C6E@c2group.net> Hi. I'm new here. Nice to meet you all. I was hoping to see advance notice of these kinds of things by subscribing to this list. Was there any mention of this talk on the other one (chicago-announce)? -Kent Cowgill C2 Group, Inc. kent at c2group.net http://www.c2group.net 312.804.0160 On Mar 15, 2006, at 12:24 AM, brian d foy wrote: > For those of you who didn't want to fight traffic, miss the new > episode of "Veronica Mars", listen to me talk about Perl, or win a > copy of Perl Best Practices, you can still get my slides from > "Benchmarking Perl". > > http://www.pair.com/~comdog/Talks/benchmarking_perl.pdf > > > -- > brian d foy > http://www.pair.com/~comdog/ > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From andy at petdance.com Wed Mar 15 18:16:33 2006 From: andy at petdance.com (Andy Lester) Date: Wed, 15 Mar 2006 20:16:33 -0600 Subject: [Chicago-talk] "Benchmarking Perl" In-Reply-To: <58853A5D-DD67-4DAE-A99C-E00A55944C6E@c2group.net> References: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> <58853A5D-DD67-4DAE-A99C-E00A55944C6E@c2group.net> Message-ID: <68FA14AE-4D87-4651-838B-9FBC849B4F94@petdance.com> On Mar 15, 2006, at 8:11 PM, Kent Cowgill wrote: > Hi. I'm new here. Nice to meet you all. > > I was hoping to see advance notice of these kinds of things by > subscribing to this list. > > Was there any mention of this talk on the other one (chicago- > announce)? No, neither place, and for that I apologize. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From kent at c2group.net Wed Mar 15 18:41:43 2006 From: kent at c2group.net (Kent Cowgill) Date: Wed, 15 Mar 2006 20:41:43 -0600 Subject: [Chicago-talk] "Benchmarking Perl" In-Reply-To: <68FA14AE-4D87-4651-838B-9FBC849B4F94@petdance.com> References: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> <58853A5D-DD67-4DAE-A99C-E00A55944C6E@c2group.net> <68FA14AE-4D87-4651-838B-9FBC849B4F94@petdance.com> Message-ID: Ok, so in the normal course of events such things generally do get announced one way or another here (chicago-talk) or there (chicago- annonce). Good to know. Naturally my followup question is: will most things posted to chicago- announce make their way over here as well? -Kent Cowgill C2 Group, Inc. kent at c2group.net http://www.c2group.net 312.804.0160 On Mar 15, 2006, at 8:16 PM, Andy Lester wrote: > > On Mar 15, 2006, at 8:11 PM, Kent Cowgill wrote: > >> Hi. I'm new here. Nice to meet you all. >> >> I was hoping to see advance notice of these kinds of things by >> subscribing to this list. >> >> Was there any mention of this talk on the other one (chicago- >> announce)? > > No, neither place, and for that I apologize. > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From andy at petdance.com Wed Mar 15 20:57:39 2006 From: andy at petdance.com (Andy Lester) Date: Wed, 15 Mar 2006 22:57:39 -0600 Subject: [Chicago-talk] "Benchmarking Perl" In-Reply-To: References: <2715accf0603142224p77ee53c7q498f51a55132c621@mail.gmail.com> <58853A5D-DD67-4DAE-A99C-E00A55944C6E@c2group.net> <68FA14AE-4D87-4651-838B-9FBC849B4F94@petdance.com> Message-ID: <610BF6D0-CDD1-4D62-AD68-E29B4DC5570A@petdance.com> On Mar 15, 2006, at 8:41 PM, Kent Cowgill wrote: > Ok, so in the normal course of events such things generally do get > announced one way or another here (chicago-talk) or there (chicago- > annonce). Good to know. > > Naturally my followup question is: will most things posted to chicago- > announce make their way over here as well? That's the intent, but it doesn't hurt to subscribe to both. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jt at plainblack.com Thu Mar 16 13:34:26 2006 From: jt at plainblack.com (JT Smith) Date: Thu, 16 Mar 2006 15:34:26 -0600 Subject: [Chicago-talk] constants and base pragma Message-ID: I don't often use constants, but I found myself using them today and noticed something strange. I thought I'd ask if this was a bug in perl, or if I just didn't understand what's going on. Here's a made up example: package Dog; use strict; use base 'Exporter'; our @EXPORT = qw/BARK/; use constant BARK => 1000; sub new { bless {}, $_[0]; } 1; package Rover; use strict; use base 'Dog'; sub getBark { return BARK; } 1; perl -MRover -e 'print Rover->new->getBark."\n"'; I'd expect the above command to print "1000", but instead I get this: Bareword "BARK" not allowed while "strict subs" in use at Rover.pm line 7. Compilation failed in require. BEGIN failed--compilation aborted. If I do this in a non-OO manner everything works as expected. Is it not possible to export constants from a base class? Is there a better way? For the time being I just created some methods that return these static values. But it's not as clean as I'd like because I have to call: $dog->BARK instead of just BARK Thanks for your help. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com I reject your reality, and substitute my own. ~ Adam Savage From joshua.mcadams at gmail.com Thu Mar 16 13:48:39 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Thu, 16 Mar 2006 16:48:39 -0500 Subject: [Chicago-talk] constants and base pragma In-Reply-To: References: Message-ID: <49d805d70603161348v553d628t7d532363b246c0ac@mail.gmail.com> > If I do this in a non-OO manner everything works as expected. Is it not possible to > export constants from a base class? > Is there a better way? If you can live without constant and with Readonly, this might be better: package Dog; use strict; use base 'Exporter'; our @EXPORT = qw/BARK/; use Readonly; Readonly my $BARK => 1000; sub new { bless {}, $_[0]; } 1; package Rover; use strict; use base 'Dog'; sub getBark { return $BARK; } 1; From mongers at bsod.net Thu Mar 16 14:05:56 2006 From: mongers at bsod.net (Pete Krawczyk) Date: Thu, 16 Mar 2006 16:05:56 -0600 (CST) Subject: [Chicago-talk] constants and base pragma In-Reply-To: Message-ID: Subject: [Chicago-talk] constants and base pragma From: JT Smith Date: Thu, 16 Mar 2006 15:34:26 -0600 }If I do this in a non-OO manner everything works as expected. Is it not possible to }export constants from a base class? Is there a better way? You can't just use BARK in that context. Since you're inheriting, you need to call BARK as you would a subroutine. You could also use $self or $class instead of Rover, if you're assigning them. The following works for me: }package Rover; } }use strict; }use base 'Dog'; } }sub getBark { - return BARK; + return Rover->BARK; }} } }1; $ perl -MRover -e 'print Rover->new->getBark."\n"'; 1000 $ -Pete K -- Pete Krawczyk mongers at bsod dot net From lembark at wrkhors.com Thu Mar 16 14:41:07 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Thu, 16 Mar 2006 17:41:07 -0500 Subject: [Chicago-talk] constants and base pragma In-Reply-To: <49d805d70603161348v553d628t7d532363b246c0ac@mail.gmail.com> References: <49d805d70603161348v553d628t7d532363b246c0ac@mail.gmail.com> Message-ID: <4419E983.3070205@wrkhors.com> Joshua McAdams wrote: >> If I do this in a non-OO manner everything works as expected. Is it not possible to >> export constants from a base class? > >> Is there a better way? > > If you can live without constant and with Readonly, this might be better: You can also use NEXT::init to inherit configuration data: package Foo; use NEXT::init { your => 'hash', data => 'here', }; package Bar; use base qw( Foo ); use NEXT::init ( derived => 'hash', data => 'there', ); Bar->construct() will give you a hash of ( your => hash, data => there, derived => hash ) Simiarlly for arrays (stack or queue). Shove the constants into, say, a hash and use them there. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From me at heyjay.com Sat Mar 18 14:50:34 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 18 Mar 2006 16:50:34 -0600 Subject: [Chicago-talk] Piping a command into perl? Message-ID: <200603181650.34240.me@heyjay.com> How would I pipe a command into perl? for example: $ echo "Hello\n" | perl doesn't work. But I'd like to do something like that Thanks Jay From andy at petdance.com Sat Mar 18 14:55:19 2006 From: andy at petdance.com (Andy Lester) Date: Sat, 18 Mar 2006 16:55:19 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <200603181650.34240.me@heyjay.com> References: <200603181650.34240.me@heyjay.com> Message-ID: <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> On Mar 18, 2006, at 4:50 PM, Jay Strauss wrote: > How would I pipe a command into perl? > > for example: > > $ echo "Hello\n" | perl > > > doesn't work. But I'd like to do something like that What would you expect that to do? -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From me at heyjay.com Sat Mar 18 14:58:51 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 18 Mar 2006 16:58:51 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> References: <200603181650.34240.me@heyjay.com> <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> Message-ID: <200603181658.51952.me@heyjay.com> On Saturday 18 March 2006 4:55 pm, Andy Lester wrote: > On Mar 18, 2006, at 4:50 PM, Jay Strauss wrote: > > How would I pipe a command into perl? > > > > for example: > > > > $ echo "Hello\n" | perl > > > > > > doesn't work. But I'd like to do something like that > > What would you expect that to do? I'd like it to print Hello I know I can do similar with -e, but I'm calling perl from inside a bash script, and I have a bash variable with a bunch of perl code in it. so I'd like to do: $results=echo $bash_var | perl Jay From me at heyjay.com Sat Mar 18 15:03:56 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 18 Mar 2006 17:03:56 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> References: <200603181650.34240.me@heyjay.com> <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> Message-ID: <200603181703.56540.me@heyjay.com> Here is exactly what I'm doing: #!/bin/bash . tws.setup # this does a whole bunch of setup for the current shell perl -e ' my @a = <*.jar>; print join ":", grep { !/jtsclient|Guide/ } (map { s/\//./g; $_ } @a); ' # When you run this script it produces a line like below to STDOUT # # jcommon-1.0.0.jar:jfreechart-1.0.0.jar:jhall.jar:jts.jar:other.jar:rss.jar # What I have works, I just thought I'd put the perl into a heredoc and make it prettier Jay From don at drakeconsult.com Sat Mar 18 15:09:31 2006 From: don at drakeconsult.com (Don Drake) Date: Sat, 18 Mar 2006 17:09:31 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <200603181658.51952.me@heyjay.com> Message-ID: This will work... #!/usr/bin/perl while () { print $_; } -Don -----Original Message----- From: chicago-talk-bounces+don=drakeconsult.com at pm.org [mailto:chicago-talk-bounces+don=drakeconsult.com at pm.org] On Behalf Of Jay Strauss Sent: Saturday, March 18, 2006 4:59 PM To: Chicago.pm chatter Subject: Re: [Chicago-talk] Piping a command into perl? On Saturday 18 March 2006 4:55 pm, Andy Lester wrote: > On Mar 18, 2006, at 4:50 PM, Jay Strauss wrote: > > How would I pipe a command into perl? > > > > for example: > > > > $ echo "Hello\n" | perl > > > > > > doesn't work. But I'd like to do something like that > > What would you expect that to do? I'd like it to print Hello I know I can do similar with -e, but I'm calling perl from inside a bash script, and I have a bash variable with a bunch of perl code in it. so I'd like to do: $results=echo $bash_var | perl Jay _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk From merlyn at stonehenge.com Sat Mar 18 22:40:00 2006 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: 18 Mar 2006 22:40:00 -0800 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <200603181703.56540.me@heyjay.com> References: <200603181650.34240.me@heyjay.com> <464D3220-E039-47C1-B181-D26C3865219F@petdance.com> <200603181703.56540.me@heyjay.com> Message-ID: <86fylfvsxr.fsf@blue.stonehenge.com> >>>>> "Jay" == Jay Strauss writes: Jay> Here is exactly what I'm doing: Jay> #!/bin/bash Jay> . tws.setup # this does a whole bunch of setup for the current shell Jay> perl -e ' Jay> my @a = <*.jar>; Jay> print join ":", grep { !/jtsclient|Guide/ } (map { s/\//./g; $_ } @a); Jay> ' Jay> # When you run this script it produces a line like below to STDOUT Jay> # Jay> # jcommon-1.0.0.jar:jfreechart-1.0.0.jar:jhall.jar:jts.jar:other.jar:rss.jar Jay> # Jay> What I have works, I just thought I'd put the perl into a heredoc and Jay> make it prettier Then put it into a heredoc, and make it prettier: #!/bin/bash . tws.setup perl <<'END_OF_PERL_SCRIPT' my @a = <*.jar>; print join ":", grep { !/jtsclient|Guide/ } (map { s/\//./g; $_ } @a); END_OF_PERL_SCRIPT -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From me at heyjay.com Sun Mar 19 10:33:38 2006 From: me at heyjay.com (Jay Strauss) Date: Sun, 19 Mar 2006 12:33:38 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <86fylfvsxr.fsf@blue.stonehenge.com> References: <200603181650.34240.me@heyjay.com> <200603181703.56540.me@heyjay.com> <86fylfvsxr.fsf@blue.stonehenge.com> Message-ID: <200603191233.39027.me@heyjay.com> On Sunday 19 March 2006 12:40 am, Randal L. Schwartz wrote: > >>>>> "Jay" == Jay Strauss writes: > > Jay> Here is exactly what I'm doing: > Jay> #!/bin/bash > > Jay> . tws.setup # this does a whole bunch of setup for the current shell > > Jay> perl -e ' > Jay> my @a = <*.jar>; > Jay> print join ":", grep { !/jtsclient|Guide/ } (map { s/\//./g; $_ } > @a); Jay> ' > > Jay> # When you run this script it produces a line like below to STDOUT > Jay> # > Jay> # > jcommon-1.0.0.jar:jfreechart-1.0.0.jar:jhall.jar:jts.jar:other.jar:rss.jar > Jay> # > > > Jay> What I have works, I just thought I'd put the perl into a heredoc and > Jay> make it prettier > > Then put it into a heredoc, and make it prettier: > > #!/bin/bash > . tws.setup > perl <<'END_OF_PERL_SCRIPT' > my @a = <*.jar>; > print join ":", grep { !/jtsclient|Guide/ } (map { s/\//./g; $_ } > @a); END_OF_PERL_SCRIPT thanks Randal. I didn't realize I needed the single quotes around END_OF_PERL_SCRIPT. thanks again Jay From merlyn at stonehenge.com Sun Mar 19 10:42:46 2006 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: 19 Mar 2006 10:42:46 -0800 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <200603191233.39027.me@heyjay.com> References: <200603181650.34240.me@heyjay.com> <200603181703.56540.me@heyjay.com> <86fylfvsxr.fsf@blue.stonehenge.com> <200603191233.39027.me@heyjay.com> Message-ID: <86oe02uvh5.fsf@blue.stonehenge.com> >>>>> "Jay" == Jay Strauss writes: Jay> thanks Randal. I didn't realize I needed the single quotes around Jay> END_OF_PERL_SCRIPT. If you're using shell scripts, it'd be a good idea to review the shell docs from time to time. And apparently, you're still using shell scripts. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From lembark at wrkhors.com Sun Mar 19 19:25:06 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Sun, 19 Mar 2006 22:25:06 -0500 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <200603181650.34240.me@heyjay.com> References: <200603181650.34240.me@heyjay.com> Message-ID: -- Jay Strauss > How would I pipe a command into perl? > > for example: > > $ echo "Hello\n" | perl > > > doesn't work. But I'd like to do something like that Works so far as I can see, just may not be doing what you expect: take a look at the -n and -p command line switches. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com 1 888 359 3508 From me at heyjay.com Mon Mar 20 08:40:24 2006 From: me at heyjay.com (Jay Strauss) Date: Mon, 20 Mar 2006 10:40:24 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: <86oe02uvh5.fsf@blue.stonehenge.com> References: <200603181650.34240.me@heyjay.com> <200603191233.39027.me@heyjay.com> <86oe02uvh5.fsf@blue.stonehenge.com> Message-ID: <200603201040.24406.me@heyjay.com> On Sunday 19 March 2006 12:42 pm, Randal L. Schwartz wrote: > If you're using shell scripts, it'd be a good idea to review the shell > docs from time to time. And apparently, you're still using shell scripts. > :) Right :) From me at heyjay.com Mon Mar 20 08:41:34 2006 From: me at heyjay.com (Jay Strauss) Date: Mon, 20 Mar 2006 10:41:34 -0600 Subject: [Chicago-talk] Piping a command into perl? In-Reply-To: References: <200603181650.34240.me@heyjay.com> Message-ID: <200603201041.34926.me@heyjay.com> On Sunday 19 March 2006 9:25 pm, Steven Lembark wrote: > > Works so far as I can see, just may not be doing > what you expect: take a look at the -n and -p > command line switches. I'm doing it like Randal suggested. That's what I was looking for anyway. Thanks Jay From me at heyjay.com Sat Mar 25 13:06:51 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 25 Mar 2006 15:06:51 -0600 Subject: [Chicago-talk] How would I do this Message-ID: <200603251506.51801.me@heyjay.com> I'm trying to get Config::General to read my __DATA__ section. But I don't know how to make it read it. The docs say it can read a filehandle, but I don't know how to turn into $filehandle. I've been trying all different combinations like: my %config = ParseConfig(-ConfigFile => \DATA); my %config = ParseConfig(-ConfigFile => \); my %config = ParseConfig(-ConfigFile => DATA); But don't know how to do it. An example of how to do it would be tremendous Thanks Jay In: #!/usr/bin/perl use Config::General; my %config = ParseConfig(-ConfigFile => \DATA); use Data::Dumper; print Dumper(%config); __DATA__ somekey somevalue From jt at plainblack.com Sat Mar 25 13:25:22 2006 From: jt at plainblack.com (JT Smith) Date: Sat, 25 Mar 2006 15:25:22 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: <200603251506.51801.me@heyjay.com> References: <200603251506.51801.me@heyjay.com> Message-ID: I don't know, but I'd say it's expecting a reference from the FileHandle object. my $fh = FileHandle->new; $fh->open("< $file"); my %config = ParseConfig(-ConfigFile=>\$file); You may also be able to do it like this using a traditional file handle: my %config = ParseConfig(-ConfigFile=>\*FILE); On Sat, 25 Mar 2006 15:06:51 -0600 Jay Strauss wrote: > I'm trying to get Config::General to read my __DATA__ section. But I don't > know how to make it read it. The docs say it can read a filehandle, but I > don't know how to turn into $filehandle. I've been trying all > different combinations like: > > my %config = ParseConfig(-ConfigFile => \DATA); > my %config = ParseConfig(-ConfigFile => \); > my %config = ParseConfig(-ConfigFile => DATA); > > But don't know how to do it. > > An example of how to do it would be tremendous > Thanks > Jay > > In: > #!/usr/bin/perl > > use Config::General; > > my %config = ParseConfig(-ConfigFile => \DATA); > > use Data::Dumper; > print Dumper(%config); > > __DATA__ > > somekey somevalue > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com I reject your reality, and substitute my own. ~ Adam Savage From jt at plainblack.com Sat Mar 25 13:27:45 2006 From: jt at plainblack.com (JT Smith) Date: Sat, 25 Mar 2006 15:27:45 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: References: <200603251506.51801.me@heyjay.com> Message-ID: Ooops. Typo. I meant: my %config = ParseConfig(-ConfigFile=>\$fh); On Sat, 25 Mar 2006 15:25:22 -0600 JT Smith wrote: > I don't know, but I'd say it's expecting a reference from the FileHandle object. > > my $fh = FileHandle->new; > $fh->open("< $file"); > > my %config = ParseConfig(-ConfigFile=>\$file); > > You may also be able to do it like this using a traditional file handle: > > my %config = ParseConfig(-ConfigFile=>\*FILE); > > > > > On Sat, 25 Mar 2006 15:06:51 -0600 > Jay Strauss wrote: >> I'm trying to get Config::General to read my __DATA__ section. But I don't >> know how to make it read it. The docs say it can read a filehandle, but I >> don't know how to turn into $filehandle. I've been trying all >> different combinations like: >> >> my %config = ParseConfig(-ConfigFile => \DATA); >> my %config = ParseConfig(-ConfigFile => \); >> my %config = ParseConfig(-ConfigFile => DATA); >> >> But don't know how to do it. >> >> An example of how to do it would be tremendous >> Thanks >> Jay >> >> In: >> #!/usr/bin/perl >> >> use Config::General; >> >> my %config = ParseConfig(-ConfigFile => \DATA); >> >> use Data::Dumper; >> print Dumper(%config); >> >> __DATA__ >> >> somekey somevalue >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk > > > JT ~ Plain Black > ph: 703-286-2525 ext. 810 > fax: 312-264-5382 > http://www.plainblack.com > > I reject your reality, and substitute my own. ~ Adam Savage > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com I reject your reality, and substitute my own. ~ Adam Savage From me at heyjay.com Sat Mar 25 13:56:41 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 25 Mar 2006 15:56:41 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: References: <200603251506.51801.me@heyjay.com> Message-ID: <200603251556.41955.me@heyjay.com> On Saturday 25 March 2006 3:25 pm, JT Smith wrote: > I don't know, but I'd say it's expecting a reference from the FileHandle > object. It is but how do I get the __DATA__ into a filehandle? Thanks Jay From me at heyjay.com Sat Mar 25 14:01:51 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 25 Mar 2006 16:01:51 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: References: <200603251506.51801.me@heyjay.com> Message-ID: <200603251601.51287.me@heyjay.com> On Saturday 25 March 2006 3:25 pm, JT Smith wrote: > I don't know, but I'd say it's expecting a reference from the FileHandle > object. > > my $fh = FileHandle->new; > $fh->open("< $file"); > > my %config = ParseConfig(-ConfigFile=>\$file); > > You may also be able to do it like this using a traditional file handle: > > my %config = ParseConfig(-ConfigFile=>\*FILE); that worked, doing it like: my %config = ParseConfig(-ConfigFile=>\*DATA); __DATA__ key value Thanks Jay From jt at plainblack.com Sat Mar 25 14:04:05 2006 From: jt at plainblack.com (JT Smith) Date: Sat, 25 Mar 2006 16:04:05 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: <200603251556.41955.me@heyjay.com> References: <200603251506.51801.me@heyjay.com> <200603251556.41955.me@heyjay.com> Message-ID: That I don't know. Maybe you just open a file handle to the whole file and Data::General figures it out. Honestly though, I wouldn't use __DATA__ blocks for config. Instead, I'd use something like JSON or YAML for config files. It's taint safe, human readable, fast parsing, supports unlimited nesting and data structures. It's just good all the way around. On Sat, 25 Mar 2006 15:56:41 -0600 Jay Strauss wrote: > On Saturday 25 March 2006 3:25 pm, JT Smith wrote: >> I don't know, but I'd say it's expecting a reference from the FileHandle >> object. > > It is but how do I get the __DATA__ into a filehandle? > > Thanks > Jay > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com I reject your reality, and substitute my own. ~ Adam Savage From me at heyjay.com Sat Mar 25 14:34:54 2006 From: me at heyjay.com (Jay Strauss) Date: Sat, 25 Mar 2006 16:34:54 -0600 Subject: [Chicago-talk] How would I do this In-Reply-To: References: <200603251506.51801.me@heyjay.com> <200603251556.41955.me@heyjay.com> Message-ID: <200603251634.54643.me@heyjay.com> On Saturday 25 March 2006 4:04 pm, JT Smith wrote: > That I don't know. Maybe you just open a file handle to the whole file and > Data::General figures it out. Honestly though, I wouldn't use __DATA__ > blocks for config. Instead, I'd use something like JSON or YAML for config > files. It's taint safe, human readable, fast parsing, supports unlimited > nesting and data structures. It's just good all the way around. I'm using Config::General, it's pretty nice for config files. I just wanted to have a __DATA__ section and build an object that passes back the Config::General's parsing of the __DATA__ section. Jay From zrusilla at mac.com Sat Mar 25 20:21:09 2006 From: zrusilla at mac.com (zrusilla@mac.com) Date: Sat, 25 Mar 2006 20:21:09 -0800 Subject: [Chicago-talk] Who can scan the camel? Message-ID: <082a08b9265b99cc8d383eccaea0dc75@mac.com> We're working on YAPC t-shirt designs, for which we need The Camel. Anyone here got a good scanner, a Camel book and a few moments to scan and email me the cover? Thanks, Liz From don at drakeconsult.com Sat Mar 25 20:46:09 2006 From: don at drakeconsult.com (Don Drake) Date: Sat, 25 Mar 2006 22:46:09 -0600 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <082a08b9265b99cc8d383eccaea0dc75@mac.com> Message-ID: I have a scanner all ready to go, but just realized my Camel book is at the office. I have Perl Cookbook and Advanced Perl Programming here, no Camels. A quick Google search found this: ftp://ftp.ora.com/pub/graphics/book_covers/hi-res/0596000278.jpg -Don -- Donald Drake Drake Consulting http://www.drakeconsult.com/ http://www.MailLaunder.com/ 800-733-2143 -----Original Message----- From: chicago-talk-bounces+don=drakeconsult.com at pm.org [mailto:chicago-talk-bounces+don=drakeconsult.com at pm.org] On Behalf Of zrusilla at mac.com Sent: Saturday, March 25, 2006 10:21 PM To: Chicago.pm chatter Subject: [Chicago-talk] Who can scan the camel? We're working on YAPC t-shirt designs, for which we need The Camel. Anyone here got a good scanner, a Camel book and a few moments to scan and email me the cover? Thanks, Liz _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk From jim at jimandkoka.com Sat Mar 25 20:52:21 2006 From: jim at jimandkoka.com (Jim Thomason) Date: Sat, 25 Mar 2006 22:52:21 -0600 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <082a08b9265b99cc8d383eccaea0dc75@mac.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> Message-ID: <5cfdfaf70603252052j6c4eca20x2741b7fda22b05ca@mail.gmail.com> Not to be overly lawyer-ish or anything, but you guys have gotten O'Reilly's permission to use that camel image and put it on a shirt, right? Unless there's a real hurry (of course, also unless you're trying to fly under their radar), it might be worthwhile to email the O'Reilly folks and see if they have a useful hi-res copy of the camel image that they could send to you to use for the shirt. Probably gonna be better quality and easier to use than anything we could send. -Jim.... PS my scanner is in the other room, but my camel book is at the office, so I have no image to contribute regardless. On 3/25/06, zrusilla at mac.com wrote: > We're working on YAPC t-shirt designs, for which we need The Camel. > Anyone here got a good scanner, a Camel book and a few moments to scan > and email me the cover? > > Thanks, > > Liz > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From jt at plainblack.com Sat Mar 25 21:30:09 2006 From: jt at plainblack.com (JT Smith) Date: Sat, 25 Mar 2006 23:30:09 -0600 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <082a08b9265b99cc8d383eccaea0dc75@mac.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> Message-ID: If you can't get permission to use the O'Reilly camel, you are more than welcome to use the camel that we had commisioned for one of our t-shirt designs: http://www.plainblack.com/uploads/ZR/BQ/ZRBQZ1MFnQ_bqxKF-Wj8kg/juggling_gooey_black.jpg We have it in EPS form, so it would work good for whatever printing jobs you need. The rest of our stuff could be easily removed from this camel. We own the copyright 100% so no legal issues. Let me know. On Sat, 25 Mar 2006 20:21:09 -0800 zrusilla at mac.com wrote: > We're working on YAPC t-shirt designs, for which we need The Camel. > Anyone here got a good scanner, a Camel book and a few moments to scan > and email me the cover? > > Thanks, > > Liz > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com I reject your reality, and substitute my own. ~ Adam Savage From dha at panix.com Sun Mar 26 16:55:13 2006 From: dha at panix.com (David H. Adler) Date: Sun, 26 Mar 2006 19:55:13 -0500 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> Message-ID: <20060327005513.GC20729@panix.com> On Sat, Mar 25, 2006 at 11:30:09PM -0600, JT Smith wrote: > > We own the copyright 100% so no legal issues. This may not, in fact be the case. ORA owns the copyright on the image of a camel in association with perl, rather than on the image itself (although it might have that too). I know there's some information out there about accepted uses of the camel with perl (i.e. you can make $number of items with the logo without asking, etc.), but I can't seem to find it at the moment. If this isn't already dealt with, you should probably talk to the permissions people at O'Reilly. For all I know, there may be a standing YAPC permission. dha -- David H. Adler - - http://www.panix.com/~dha/ America leads the world in shocks. - Gil Scott-Heron From joshua.mcadams at gmail.com Sun Mar 26 17:01:29 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Sun, 26 Mar 2006 19:01:29 -0600 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <20060327005513.GC20729@panix.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> Message-ID: <49d805d70603261701p72f2c2b7wf9ce729bd28cff07@mail.gmail.com> It's 100 items that you can make without permission. We'll be making 500, so I sent a note to permissions at oreilly.com. No response yet, so I'll probably ping them again this week. On 3/26/06, David H. Adler wrote: > On Sat, Mar 25, 2006 at 11:30:09PM -0600, JT Smith wrote: > > > > We own the copyright 100% so no legal issues. > > This may not, in fact be the case. ORA owns the copyright on the image > of a camel in association with perl, rather than on the image itself > (although it might have that too). > > I know there's some information out there about accepted uses of the > camel with perl (i.e. you can make $number of items with the logo > without asking, etc.), but I can't seem to find it at the moment. > > If this isn't already dealt with, you should probably talk to the > permissions people at O'Reilly. For all I know, there may be a standing > YAPC permission. > > dha > > -- > David H. Adler - - http://www.panix.com/~dha/ > America leads the world in shocks. > - Gil Scott-Heron > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From dha at panix.com Sun Mar 26 17:02:40 2006 From: dha at panix.com (David H. Adler) Date: Sun, 26 Mar 2006 20:02:40 -0500 Subject: [Chicago-talk] Auto-Responding [was: Re: Who can scan the camel?] In-Reply-To: <20060327005513.GC20729@panix.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> Message-ID: <20060327010240.GE20729@panix.com> On Sun, Mar 26, 2006 at 07:55:13PM -0500, David H. Adler wrote: [Not relevant in this case] People - please set your autoresponders appropriately. I just got *two* "I'm out of the office" messages in response to my post. Thanks. dha -- David H. Adler - - http://www.panix.com/~dha/ I'd redesign my program to something less absurd. - Abigail, in comp.lang.perl.misc From dha at panix.com Sun Mar 26 17:04:01 2006 From: dha at panix.com (David H. Adler) Date: Sun, 26 Mar 2006 20:04:01 -0500 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <49d805d70603261701p72f2c2b7wf9ce729bd28cff07@mail.gmail.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> <49d805d70603261701p72f2c2b7wf9ce729bd28cff07@mail.gmail.com> Message-ID: <20060327010401.GF20729@panix.com> On Sun, Mar 26, 2006 at 07:01:29PM -0600, Joshua McAdams wrote: > It's 100 items that you can make without permission. We'll be making > 500, so I sent a note to permissions at oreilly.com. No response yet, so > I'll probably ping them again this week. I'm sure you won't have too much trouble. This certainly won't be the first time they've had to arrange this. :-) FWIW, you might check with previous YAPC organizers to see how this was dealt with in the past. dha -- David H. Adler - - http://www.panix.com/~dha/ It didn't bother me before there was a for modifier, and now that there is one, it still doesn't bother me. I'm just not very easy to bother. - Larry Wall From lembark at wrkhors.com Mon Mar 27 07:03:34 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Mon, 27 Mar 2006 10:03:34 -0500 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <20060327005513.GC20729@panix.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> Message-ID: <4427FEC6.4090802@wrkhors.com> > If this isn't already dealt with, you should probably talk to the > permissions people at O'Reilly. For all I know, there may be a standing > YAPC permission. Check w/ the Grand Poobahs as YAPC: if there is any agreement then they'll know about it and probably just where to go at ora.com in order to get the camel logo bin's. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From andy at petdance.com Mon Mar 27 07:15:06 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 27 Mar 2006 09:15:06 -0600 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <4427FEC6.4090802@wrkhors.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> <4427FEC6.4090802@wrkhors.com> Message-ID: On Mar 27, 2006, at 9:03 AM, Steven Lembark wrote: > >> If this isn't already dealt with, you should probably talk to the >> permissions people at O'Reilly. For all I know, there may be a >> standing >> YAPC permission. > > Check w/ the Grand Poobahs as YAPC: if there is > any agreement then they'll know about it and > probably just where to go at ora.com in order > to get the camel logo bin's. All of this copyright stuff has been discussed. Liz knows what she's doing. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From dha at panix.com Mon Mar 27 11:44:23 2006 From: dha at panix.com (David H. Adler) Date: Mon, 27 Mar 2006 14:44:23 -0500 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> <4427FEC6.4090802@wrkhors.com> Message-ID: <20060327194423.GA29247@panix.com> On Mon, Mar 27, 2006 at 09:15:06AM -0600, Andy Lester wrote: > > On Mar 27, 2006, at 9:03 AM, Steven Lembark wrote: > > > > >> If this isn't already dealt with, you should probably talk to the > >> permissions people at O'Reilly. For all I know, there may be a > >> standing > >> YAPC permission. > > > > Check w/ the Grand Poobahs as YAPC: if there is > > any agreement then they'll know about it and > > probably just where to go at ora.com in order > > to get the camel logo bin's. > > All of this copyright stuff has been discussed. Liz knows what she's > doing. That's all us horrid foreign meddlers need to hear. thanks. :-) dha -- David H. Adler - - http://www.panix.com/~dha/ [Insert Angus Prune Tune here] From zrusilla at mac.com Mon Mar 27 14:47:48 2006 From: zrusilla at mac.com (Elizabeth Cortell) Date: Mon, 27 Mar 2006 14:47:48 -0800 Subject: [Chicago-talk] Who can scan the camel? In-Reply-To: <20060327194423.GA29247@panix.com> References: <082a08b9265b99cc8d383eccaea0dc75@mac.com> <20060327005513.GC20729@panix.com> <4427FEC6.4090802@wrkhors.com> <20060327194423.GA29247@panix.com> Message-ID: <10005945.1143499668585.JavaMail.zrusilla@mac.com> The camel image is to prepare detailed artwork. We have a rough sketch which we are discussing with ORA. Now get to work on your YAPC paper submissions :-) Cheers Liz On Monday, March 27, 2006, at 11:44AM, David H. Adler wrote: >On Mon, Mar 27, 2006 at 09:15:06AM -0600, Andy Lester wrote: >> >> All of this copyright stuff has been discussed. Liz knows what she's >> doing. From joshua.mcadams at gmail.com Mon Mar 27 18:38:42 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Mon, 27 Mar 2006 20:38:42 -0600 Subject: [Chicago-talk] YAPC::NA Registration Is Open Message-ID: <49d805d70603271838v4b22de2eg16fdf44d4f2bd2c8@mail.gmail.com> Chicago.pm is proud to announce that registration is open for Yet Another Perl Conference North America (YAPC::NA) 2006. The primary conference will occur June 26th through 28th at the Illinois Institute of Technology in Chicago, Illinois. The conference will feature speakers from throughout the Perl community, as well as, keynote addresses from luminaries such as Larry Wall, the creator of Perl, and guest speakers from the broader dynamic languages and open source communities. The full three-day conference costs only $100, but early registrants can take advantage of a 15% discount and attend the conference for only $85. With such a low cost, YAPC is one of the most affordable and accessible technical conferences available today. In addition to the conference, three open courses will be offered on June 29th and 30th. These courses are taught by some of the most notable Perl instructors: brian d foy, Randall Schwartz, and Damian Conway. The courses will all run simultaneously during the two days after the conference. Conference attendance is not required when signing up for classes, but it is encouraged. Seats for the conference and for the open classes are limited, so be sure to register today and guarantee your spot at YAPC! Also, if you are planning on lodging and/or parking on-campus during the conference, or dining in the university cafeteria, you should include those items when registering. Registration details can be found at: http://www.yapcchicago.org/zencart From joshua.mcadams at gmail.com Tue Mar 28 08:25:30 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Tue, 28 Mar 2006 11:25:30 -0500 Subject: [Chicago-talk] YAPC Tour Guide Message-ID: <49d805d70603280825k60f74578i30ed8a2b2cf62b12@mail.gmail.com> Would anyone near IIT mind running around the area and noting where attractions, restaurants, grocery stores, convince stores, etc. are and possibly taking a picture of each? We need to try to put together a little guide of what is available in the neighborhood. Thanks, Josh From wiggins at danconia.org Wed Mar 29 10:49:52 2006 From: wiggins at danconia.org (Wiggins d'Anconia) Date: Wed, 29 Mar 2006 11:49:52 -0700 Subject: [Chicago-talk] YAPC::NA questions Message-ID: <442AD6D0.7080601@danconia.org> Couldn't find these online, though a pointer of where to look would be acceptable :-). 1. What is the deadline for early registration? 2. Is there at least a preliminary schedule (for anything that can be scheduled), and if not is there an anticipated start time. Basically to determine whether it would be necessary to fly in Sunday night, or if Monday morning is a possibility. Thanks, http://danconia.org p.s. At least one person mentioned they found it odd that YAPC would use a PHP based cart for registration. From richard at rushlogistics.com Thu Mar 30 06:34:31 2006 From: richard at rushlogistics.com (Richard Reina) Date: Thu, 30 Mar 2006 06:34:31 -0800 (PST) Subject: [Chicago-talk] regural expression question? Message-ID: <20060330143431.3367.qmail@web409.biz.mail.mud.yahoo.com> I have a little script that finds the line which contains a six digit number begining with 1 or greater. I know that $_ represents the line, however, I am having trouble figuring out how to save that number once it's found (without everything else in the line). #!/usr/bin/perl -w @ARGV = "/home/richard/test/out.txt"; while (<>) { if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ ) { print "Found\n" . $_ . "\n"; } } Any help would be greatly appreciated. Thanks, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060330/099fb14e/attachment.html From tigerpeng2001 at yahoo.com Thu Mar 30 06:43:00 2006 From: tigerpeng2001 at yahoo.com (tiger peng) Date: Thu, 30 Mar 2006 06:43:00 -0800 (PST) Subject: [Chicago-talk] regural expression question? In-Reply-To: <20060330143431.3367.qmail@web409.biz.mail.mud.yahoo.com> Message-ID: <20060330144300.78812.qmail@web54701.mail.yahoo.com> type command and read perldoc perlrequick --- Richard Reina wrote: > I have a little script that finds the line which > contains a six digit number begining with 1 or > greater. I know that $_ represents the line, > however, I am having trouble figuring out how to > save that number once it's found (without everything > else in the line). > > #!/usr/bin/perl -w > > @ARGV = "/home/richard/test/out.txt"; > while (<>) { > if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ > ) { > print "Found\n" . $_ . "\n"; > } > } > > Any help would be greatly appreciated. > > Thanks, > > Richard > > > A people that values its privileges above its > principles soon loses both. > -Dwight D. Eisenhower.> _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From joshua.mcadams at gmail.com Thu Mar 30 07:01:10 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Thu, 30 Mar 2006 10:01:10 -0500 Subject: [Chicago-talk] regural expression question? In-Reply-To: <20060330144300.78812.qmail@web54701.mail.yahoo.com> References: <20060330143431.3367.qmail@web409.biz.mail.mud.yahoo.com> <20060330144300.78812.qmail@web54701.mail.yahoo.com> Message-ID: <49d805d70603300701x797aec32l5053a43134eec975@mail.gmail.com> > > I have a little script that finds the line which > > contains a six digit number begining with 1 or > > greater. I know that $_ represents the line, > > however, I am having trouble figuring out how to > > save that number once it's found (without everything > > else in the line). > > > > #!/usr/bin/perl -w > > > > @ARGV = "/home/richard/test/out.txt"; > > while (<>) { > > if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ > > ) { > > print "Found\n" . $_ . "\n"; > > } > > } > > Put some parenthesis around the expression... if ( /\b([123456789][0-9][0-9][0-9][0-9][0-9])\b/ ) { print "Found\n" . $1 . "\n"; } I think that you could tighten up the expression a little too... if ( /\b([1-9]\d{5})\b/ ) { print "Found\n" . $1 . "\n"; } From richard at rushlogistics.com Thu Mar 30 07:07:53 2006 From: richard at rushlogistics.com (Richard Reina) Date: Thu, 30 Mar 2006 07:07:53 -0800 (PST) Subject: [Chicago-talk] regural expression question? In-Reply-To: <49d805d70603300701x797aec32l5053a43134eec975@mail.gmail.com> Message-ID: <20060330150753.26293.qmail@web406.biz.mail.mud.yahoo.com> Ahh, the magic parenthesis... Thanks Joshua. Joshua McAdams wrote: > > I have a little script that finds the line which > > contains a six digit number begining with 1 or > > greater. I know that $_ represents the line, > > however, I am having trouble figuring out how to > > save that number once it's found (without everything > > else in the line). > > > > #!/usr/bin/perl -w > > > > @ARGV = "/home/richard/test/out.txt"; > > while (<>) { > > if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ > > ) { > > print "Found\n" . $_ . "\n"; > > } > > } > > Put some parenthesis around the expression... if ( /\b([123456789][0-9][0-9][0-9][0-9][0-9])\b/ ) { print "Found\n" . $1 . "\n"; } I think that you could tighten up the expression a little too... if ( /\b([1-9]\d{5})\b/ ) { print "Found\n" . $1 . "\n"; } _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060330/fe3912d1/attachment.html From lembark at wrkhors.com Thu Mar 30 07:26:13 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Thu, 30 Mar 2006 10:26:13 -0500 Subject: [Chicago-talk] regural expression question? In-Reply-To: <20060330144300.78812.qmail@web54701.mail.yahoo.com> References: <20060330144300.78812.qmail@web54701.mail.yahoo.com> Message-ID: <442BF895.6080508@wrkhors.com> >> #!/usr/bin/perl -w >> >> @ARGV = "/home/richard/test/out.txt"; >> while (<>) { >> if ( /\b[123456789][0-9][0-9][0-9][0-9][0-9]\b/ >> ) { >> print "Found\n" . $_ . "\n"; >> } >> } Use parens and assign the result: my( $whole_number, $first_digit ) = m{ \b ( ( [1-9] ) \d+ ) \b }x; 1 2 2 1 or if( m{ \b ( ( [1-9] ) \d+ ) \b }x ) { my $whole_number = $1; my $first_digit = $2; } The capturing paren's store their result in the order of opening. In the example above, the whole set of digits is enclosed in the first set, the first digit in the second. That'll give you $1 and $2 if there is a match or return the two in that order. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From lembark at wrkhors.com Thu Mar 30 07:27:44 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Thu, 30 Mar 2006 10:27:44 -0500 Subject: [Chicago-talk] regural expression question? In-Reply-To: <20060330150753.26293.qmail@web406.biz.mail.mud.yahoo.com> References: <20060330150753.26293.qmail@web406.biz.mail.mud.yahoo.com> Message-ID: <442BF8F0.3070307@wrkhors.com> > Ahh, the magic parenthesis... Check out the Camel on regexen, or the Regex Pocket Manual from ORA. One of Randal's classes has a good intro to this (probably in the Learning Perl book, which makes for a good review). -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From dha at panix.com Thu Mar 30 10:41:55 2006 From: dha at panix.com (David H. Adler) Date: Thu, 30 Mar 2006 13:41:55 -0500 Subject: [Chicago-talk] A change of pace Message-ID: <20060330184155.GD28099@panix.com> In case anyone's interested, I thought I'd mention that my cubicle-mate is a playwright and has a play on in Chicago through the end of april. If you want to check it out, it's called Brain Children, and details can be found at http://www.chicagoreader.com/listings/static/listings.html#14 dha -- David H. Adler - - http://www.panix.com/~dha/ Got Perl? Got a Perl User Group? From richard at rushlogistics.com Fri Mar 31 12:36:20 2006 From: richard at rushlogistics.com (Richard Reina) Date: Fri, 31 Mar 2006 12:36:20 -0800 (PST) Subject: [Chicago-talk] scalar manipulation Message-ID: <20060331203620.7650.qmail@web404.biz.mail.mud.yahoo.com> Forgive me if this something I should know, but can someone tell me the simplest way to remove blank spaces from a scalar? I need to turn $a = "now is a good time for a beer"; to "nowisagoodtimeforabeer"; Any help would be greatly appreciated. Thanks, Richard A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060331/60f31564/attachment.html From andy at petdance.com Fri Mar 31 12:38:24 2006 From: andy at petdance.com (Andy Lester) Date: Fri, 31 Mar 2006 14:38:24 -0600 Subject: [Chicago-talk] scalar manipulation In-Reply-To: <20060331203620.7650.qmail@web404.biz.mail.mud.yahoo.com> References: <20060331203620.7650.qmail@web404.biz.mail.mud.yahoo.com> Message-ID: <75349626-1A16-4CFD-A996-B7E5C97AD8A3@petdance.com> On Mar 31, 2006, at 2:36 PM, Richard Reina wrote: > Forgive me if this something I should know, but can someone tell me > the simplest way to remove blank spaces from a scalar? > > I need to turn > > $a = "now is a good time for a beer"; > > to > > "nowisagoodtimeforabeer"; Regular expressions. $a =~ s/ //g; xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From lembark at wrkhors.com Fri Mar 31 12:38:56 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Fri, 31 Mar 2006 15:38:56 -0500 Subject: [Chicago-talk] scalar manipulation In-Reply-To: <20060331203620.7650.qmail@web404.biz.mail.mud.yahoo.com> References: <20060331203620.7650.qmail@web404.biz.mail.mud.yahoo.com> Message-ID: <442D9360.907@wrkhors.com> > I need to turn > > $a = "now is a good time for a beer"; > > to > > "nowisagoodtimeforabeer"; Depends on whether you want to modify the original variable or not. You can remove anything with a regex on the original: $phrase =~ s{ \s+ }{}gx; will modify $phrase in place. You can also use a regex on a copy or a join-and-split to make a new copy of the variable: ( my $nospace = $phrase ) =~ s{ \s+ }{}gx; or my $nospace = join '', split '', $phrase; will give you a separate variable without the spaces. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 From richard at rushlogistics.com Fri Mar 31 13:07:09 2006 From: richard at rushlogistics.com (Richard Reina) Date: Fri, 31 Mar 2006 13:07:09 -0800 (PST) Subject: [Chicago-talk] scalar manipulation In-Reply-To: <442D9360.907@wrkhors.com> Message-ID: <20060331210709.39506.qmail@web412.biz.mail.mud.yahoo.com> Thank you very much Andy and Steve for the instructive replies. Have a great weekend all. Richard Steven Lembark wrote: > I need to turn > > $a = "now is a good time for a beer"; > > to > > "nowisagoodtimeforabeer"; Depends on whether you want to modify the original variable or not. You can remove anything with a regex on the original: $phrase =~ s{ \s+ }{}gx; will modify $phrase in place. You can also use a regex on a copy or a join-and-split to make a new copy of the variable: ( my $nospace = $phrase ) =~ s{ \s+ }{}gx; or my $nospace = join '', split '', $phrase; will give you a separate variable without the spaces. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508 _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk A people that values its privileges above its principles soon loses both. -Dwight D. Eisenhower. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060331/880a5c1a/attachment.html From tigerpeng2001 at yahoo.com Fri Mar 31 15:12:37 2006 From: tigerpeng2001 at yahoo.com (tiger peng) Date: Fri, 31 Mar 2006 15:12:37 -0800 (PST) Subject: [Chicago-talk] scalar manipulation In-Reply-To: <20060331210709.39506.qmail@web412.biz.mail.mud.yahoo.com> Message-ID: <20060331231237.7880.qmail@web54705.mail.yahoo.com> Hi Perlists, I don't think it is good to mess up the "good time for beer" when it is Friday )-: I am wandering if Perl can turn beer to champagne, wine, brandy, or even vodka. Bottoms up! Have a great weendend, Ge --- Richard Reina wrote: > Thank you very much Andy and Steve for the > instructive replies. Have a great weekend all. > > Richard > > Steven Lembark wrote: > > I need to turn > > > > $a = "now is a good time for a beer"; > > > > to > > > > "nowisagoodtimeforabeer"; > > Depends on whether you want to modify the original > variable or not. You can remove anything with a > regex on the original: > > $phrase =~ s{ \s+ }{}gx; > > will modify $phrase in place. You can also use a > regex on a copy or a join-and-split to make a new > copy of the variable: > > ( my $nospace = $phrase ) =~ s{ \s+ }{}gx; > > or > > my $nospace = join '', split '', $phrase; > > will give you a separate variable without the > spaces. > > -- > Steven Lembark > 85-09 90th Street > Workhorse Computing > Woodhaven, NY 11421 > lembark at wrkhors.com > +1 888 359 3508 > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > A people that values its privileges above its > principles soon loses both. > -Dwight D. Eisenhower.> _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From lembark at wrkhors.com Fri Mar 31 15:19:45 2006 From: lembark at wrkhors.com (Steven Lembark) Date: Fri, 31 Mar 2006 18:19:45 -0500 Subject: [Chicago-talk] scalar manipulation In-Reply-To: <20060331231237.7880.qmail@web54705.mail.yahoo.com> References: <20060331231237.7880.qmail@web54705.mail.yahoo.com> Message-ID: <442DB911.5080302@wrkhors.com> tiger peng wrote: > Hi Perlists, > > I don't think it is good to mess up the "good time for > beer" when it is Friday )-: > > I am wandering if Perl can turn beer to champagne, > wine, brandy, or even vodka. Certianly: my $drink = shift || 'water'; s{ \b beer \b }{ $drink }ogx for @ARGV; print join "\n", @ARGV, ''; pick your drink :-) -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark at wrkhors.com +1 888 359 3508