From enobacon at gmail.com Wed Feb 3 16:27:20 2010 From: enobacon at gmail.com (Seven till Seven) Date: Wed, 3 Feb 2010 16:27:20 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. Message-ID: <201002031627.20762.enobacon@gmail.com> see http://pdx.pm.org/kwiki/ Wed. February 10th, 6:53pm at FreeGeek -- 1731 SE 10th Ave. Introduction to Parrot Virtual Machine speaker: Jonathan Leto Come learn the basic things you need to know about Parrot Virtual Machine to start hacking on 1) Parrot VM itself 2) Languages built on top of Parrot, High Level Languages (HLLs) 3) Projects and Libraries that use Parrot A short, down-to-earth introduction to the current state of Parrot will be followed by examples on how to hack on Parrot projects or how to start your own. As always, the meeting will be followed by social hour at the LuckyLab. -- http://pdx.pm.org From gorthx at gmail.com Fri Feb 5 07:21:06 2010 From: gorthx at gmail.com (gabrielle) Date: Fri, 5 Feb 2010 07:21:06 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <201002031627.20762.enobacon@gmail.com> References: <201002031627.20762.enobacon@gmail.com> Message-ID: <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> On Wed, Feb 3, 2010 at 4:27 PM, Seven till Seven wrote: > A short, down-to-earth introduction to the current state of Parrot will > be followed by examples on how to hack on Parrot projects or how to > start your own. Is there prep work we should do, if we in the studio audience want to follow along? gabrielle From jaleto at gmail.com Mon Feb 8 13:04:10 2010 From: jaleto at gmail.com (Jonathan Leto) Date: Mon, 8 Feb 2010 13:04:10 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> References: <201002031627.20762.enobacon@gmail.com> <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> Message-ID: <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> Howdy, Good question! Parrot 2.0.0 just came out, so installing that on your laptop when you come by would be useful. You can check if your package management system has it, but you can also download it directly from [0]. You can also checkout the latest svn with: svn co https://svn.parrot.org/parrot/trunk parrot or if you prefer git (you should), use my github mirror with git clone git at github.com:leto/parrot.git Reading "The Parrot Primer" [1] would also be a good idea. Duke [0] - ftp://ftp.parrot.org/pub/parrot/releases/stable/2.0.0/parrot-2.0.0.tar.gz [1] - http://docs.parrot.org/parrot/latest/html/docs/intro.pod.html On Fri, Feb 5, 2010 at 7:21 AM, gabrielle wrote: > On Wed, Feb 3, 2010 at 4:27 PM, Seven till Seven wrote: > >> A short, down-to-earth introduction to the current state of Parrot will >> be followed by examples on how to hack on Parrot projects or how to >> start your own. > > Is there prep work we should do, if we in the studio audience want to > follow along? > > gabrielle > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- Jonathan "Duke" Leto jonathan at leto.net http://leto.net From merlyn at stonehenge.com Mon Feb 8 13:11:21 2010 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon, 08 Feb 2010 13:11:21 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> (Jonathan Leto's message of "Mon, 8 Feb 2010 13:04:10 -0800") References: <201002031627.20762.enobacon@gmail.com> <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> Message-ID: <86d40f1lhi.fsf@blue.stonehenge.com> >>>>> "Jonathan" == Jonathan Leto writes: Jonathan> or if you prefer git (you should), use my github mirror with Jonathan> git clone git at github.com:leto/parrot.git Locohost.local:/Volumes/UFS/MIRROR % git clone git at github.com:leto/parrot.git Initialized empty Git repository in /Volumes/UFS/MIRROR/parrot/.git/ Warning: Permanently added the RSA host key for IP address '207.97.227.239' to the list of known hosts. ERROR: Permission to leto/parrot denied to RandalSchwartz. fatal: The remote end hung up unexpectedly I know, I'm specifically forbidden, eh? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion From merlyn at stonehenge.com Mon Feb 8 13:13:42 2010 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon, 08 Feb 2010 13:13:42 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <86d40f1lhi.fsf@blue.stonehenge.com> (Randal L. Schwartz's message of "Mon, 08 Feb 2010 13:11:21 -0800") References: <201002031627.20762.enobacon@gmail.com> <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> <86d40f1lhi.fsf@blue.stonehenge.com> Message-ID: <868wb31ldl.fsf@blue.stonehenge.com> >>>>> "Randal" == Randal L Schwartz writes: Jonathan> git clone git at github.com:leto/parrot.git Ahh, works better if you use git clone git://github.com/leto/parrot.git Note colon changed to dash. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion From jaleto at gmail.com Mon Feb 8 13:14:17 2010 From: jaleto at gmail.com (Jonathan Leto) Date: Mon, 8 Feb 2010 13:14:17 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <86d40f1lhi.fsf@blue.stonehenge.com> References: <201002031627.20762.enobacon@gmail.com> <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> <86d40f1lhi.fsf@blue.stonehenge.com> Message-ID: <9aaadf9c1002081314s1cb37c2fx46982fe6db5ce32f@mail.gmail.com> Howdy, OOPS! I gave out my private read-write github URL instead of the read-only one. Here is the correct command: git clone http://github.com/leto/parrot.git Thanks for catching that, Randal! Duke On Mon, Feb 8, 2010 at 1:11 PM, Randal L. Schwartz wrote: >>>>>> "Jonathan" == Jonathan Leto writes: > > Jonathan> or if you prefer git (you should), use my github mirror with > > Jonathan> git clone git at github.com:leto/parrot.git > > ? ?Locohost.local:/Volumes/UFS/MIRROR % git clone git at github.com:leto/parrot.git > ? ?Initialized empty Git repository in /Volumes/UFS/MIRROR/parrot/.git/ > ? ?Warning: Permanently added the RSA host key for IP address '207.97.227.239' to the list of known hosts. > ? ?ERROR: Permission to leto/parrot denied to RandalSchwartz. > ? ?fatal: The remote end hung up unexpectedly > > I know, I'm specifically forbidden, eh? > > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 > > Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. > See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion > -- Jonathan "Duke" Leto jonathan at leto.net http://leto.net From enobacon at gmail.com Wed Feb 10 08:38:38 2010 From: enobacon at gmail.com (Seven till Seven) Date: Wed, 10 Feb 2010 08:38:38 -0800 Subject: [Pdx-pm] meeting tonight: Introduction to Parrot Message-ID: <201002100838.39136.enobacon@gmail.com> see http://pdx.pm.org/kwiki/ Wed. February 10th, 6:53pm at FreeGeek -- 1731 SE 10th Ave. Introduction to Parrot Virtual Machine speaker: Jonathan Leto Come learn the basic things you need to know about Parrot Virtual Machine to start hacking on 1) Parrot VM itself 2) Languages built on top of Parrot, High Level Languages (HLLs) 3) Projects and Libraries that use Parrot A short, down-to-earth introduction to the current state of Parrot will be followed by examples on how to hack on Parrot projects or how to start your own. Having parrot installed on a laptop might be useful. ftp://ftp.parrot.org/pub/parrot/releases/stable/2.0.0/parrot-2.0.0.tar.gz You may also wish to read the Parrot Primer before the meeting. http://docs.parrot.org/parrot/latest/html/docs/intro.pod.html As always, the meeting will be followed by social hour at the LuckyLab. -- http://pdx.pm.org From ben.hengst at gmail.com Wed Feb 10 18:57:08 2010 From: ben.hengst at gmail.com (benh) Date: Wed, 10 Feb 2010 18:57:08 -0800 Subject: [Pdx-pm] Introduction to Parrot -- February meeting next Wed. In-Reply-To: <9aaadf9c1002081314s1cb37c2fx46982fe6db5ce32f@mail.gmail.com> References: <201002031627.20762.enobacon@gmail.com> <48bb92b1002050721v18eee88cs3c34ba1dff775ba9@mail.gmail.com> <9aaadf9c1002081304n5c823f0ck340b5d9db1c7955f@mail.gmail.com> <86d40f1lhi.fsf@blue.stonehenge.com> <9aaadf9c1002081314s1cb37c2fx46982fe6db5ce32f@mail.gmail.com> Message-ID: <85ddf48b1002101857r447e36c9le116b94f2e4a879c@mail.gmail.com> better to use: git://github.com/leto/parrot.git On Mon, Feb 8, 2010 at 13:14, Jonathan Leto wrote: > Howdy, > > OOPS! I gave out my private read-write github URL instead of the > read-only one. Here is the correct command: > > git clone http://github.com/leto/parrot.git > > Thanks for catching that, Randal! > > Duke > > > > On Mon, Feb 8, 2010 at 1:11 PM, Randal L. Schwartz > wrote: >>>>>>> "Jonathan" == Jonathan Leto writes: >> >> Jonathan> or if you prefer git (you should), use my github mirror with >> >> Jonathan> git clone git at github.com:leto/parrot.git >> >> ? ?Locohost.local:/Volumes/UFS/MIRROR % git clone git at github.com:leto/parrot.git >> ? ?Initialized empty Git repository in /Volumes/UFS/MIRROR/parrot/.git/ >> ? ?Warning: Permanently added the RSA host key for IP address '207.97.227.239' to the list of known hosts. >> ? ?ERROR: Permission to leto/parrot denied to RandalSchwartz. >> ? ?fatal: The remote end hung up unexpectedly >> >> I know, I'm specifically forbidden, eh? >> >> -- >> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 >> >> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. >> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion >> > > > > -- > Jonathan "Duke" Leto > jonathan at leto.net > http://leto.net > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- benh~ http://three.sentenc.es/ From merlyn at stonehenge.com Wed Feb 10 22:47:04 2010 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed, 10 Feb 2010 22:47:04 -0800 Subject: [Pdx-pm] Jonathan Leto's Parrot talk from today Message-ID: <86eikss1zr.fsf@blue.stonehenge.com> Video is at http://www.ustream.tv/recorded/4630503 . -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion From ben.hengst at gmail.com Thu Feb 11 11:30:11 2010 From: ben.hengst at gmail.com (benh) Date: Thu, 11 Feb 2010 11:30:11 -0800 Subject: [Pdx-pm] Jonathan Leto's Parrot talk from today In-Reply-To: <86eikss1zr.fsf@blue.stonehenge.com> References: <86eikss1zr.fsf@blue.stonehenge.com> Message-ID: <85ddf48b1002111130i2736e4ap1cda989588c8e97e@mail.gmail.com> Thanks Randal for the documentation. On Wed, Feb 10, 2010 at 22:47, Randal L. Schwartz wrote: > > Video is at http://www.ustream.tv/recorded/4630503 . > > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 > > Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. > See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- benh~ http://three.sentenc.es/ From kellert at ohsu.edu Thu Feb 11 12:22:00 2010 From: kellert at ohsu.edu (Tom Keller) Date: Thu, 11 Feb 2010 12:22:00 -0800 Subject: [Pdx-pm] bit wise comparison Message-ID: Greetings, A Bioperl list I'm on gave the following as a fast string comparison method: ################################# $in = 'ACCTCCTCCTCGAGTATGTG'; $tgt = 'TATCTTGCGCCGGAGATAAT'; $mask = pack("A*",$in)^pack("A*",$tgt); $matches = $mask =~ tr/"\x0"/"\x0"/; Impressive! Not often you see pack() let alone exclusive-or with a scalar context tr// thrown in for good measure! For those who don't follow what it is doing, here is my (possibly wrong) interpretation: The pack() is converting each of the two (equal length) strings into a byte set. A bit-wise exclusive-or (XOR) is performed between these two byte sets. This will create bytes of value zero (0) where they were the same, and non-zero where they were different. The tr// then counts how many of the bytes were zero (\x0 is ascii zero). ################################# I can't get it to work on my machine. Would someone be able to help me with this? For one thing, isn't ascii zero "x30" in hex? But even with that change, I get no return value for $matches in: my $matches = $mask =~ tr/"\x30"/"\x30"/; thanks, Tom Keller MMI DNA Services Core 4-2442 kellert at ohsu edu RJH (CROET/BasicScience) 6339b -------------- next part -------------- An HTML attachment was scrubbed... URL: From enobacon at gmail.com Thu Feb 11 13:35:31 2010 From: enobacon at gmail.com (Eric Wilhelm) Date: Thu, 11 Feb 2010 13:35:31 -0800 Subject: [Pdx-pm] bit wise comparison In-Reply-To: References: Message-ID: <201002111335.31063.enobacon@gmail.com> # from Tom Keller # on Thursday 11 February 2010 12:22: >$in = 'ACCTCCTCCTCGAGTATGTG'; >$tgt = 'TATCTTGCGCCGGAGATAAT'; >$mask = pack("A*",$in)^pack("A*",$tgt); >$matches = $mask =~ tr/"\x0"/"\x0"/; I get warnings from the quotes (") in the tr//. You *did* enable warnings, right? :-D An interesting, but slower trick would let you know where the matches are in a more straightforward way. $tgt =~ s/(.)/(?:($1)|.)/g; my @matches = $in =~ m/^$tgt/; But why pack() ASCII characters into "A*" ASCII characters? You should get a same and faster result with: my $mask = $in ^ $tgt; my $matches = $mask =~ tr/\x0//; --Eric -- "You can't win. You can't break even. You can't quit." --Ginsberg's Restatement of the Three Laws of Thermodynamics --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From scfrd1 at gmail.com Thu Feb 11 13:46:27 2010 From: scfrd1 at gmail.com (Steve Cayford) Date: Thu, 11 Feb 2010 15:46:27 -0600 Subject: [Pdx-pm] bit wise comparison In-Reply-To: References: Message-ID: <4B747AB3.7090107@gmail.com> As far as I can tell, the pack commands are superfluous. They're just saying take this string and pack it into a string. This works fine with the original strings... print scalar( ("ACCTCCTCCTCGAGTATGTG" ^ "TATCTTGCGCCGGAGATAAT") =~ tr/\x0/\x0/ ), "\n"; The tr/\x0/\x0/ is transliterating bytes that have zeroed out bits, not ASCII zeros. -Steve Tom Keller wrote: > Greetings, > A Bioperl list I'm on gave the following as a fast string comparison method: > > ################################# >> $in = 'ACCTCCTCCTCGAGTATGTG'; >> $tgt = 'TATCTTGCGCCGGAGATAAT'; >> $mask = pack("A*",$in)^pack("A*",$tgt); >> $matches = $mask =~ tr/"\x0"/"\x0"/; > > Impressive! Not often you see pack() let alone exclusive-or with a > scalar context tr// thrown in for good measure! > > For those who don't follow what it is doing, here is my (possibly > wrong) interpretation: The pack() is converting each of the two (equal > length) strings into a byte set. A bit-wise exclusive-or (XOR) is > performed between these two byte sets. This will create bytes of value > zero (0) where they were the same, and non-zero where they were > different. The tr// then counts how many of the bytes were zero (\x0 > is ascii zero). > ################################# > > I can't get it to work on my machine. Would someone be able to help me > with this? > > For one thing, isn't ascii zero "x30" in hex? But even with that change, > I get no return value for $matches in: > my $matches = $mask =~ tr/"\x30"/"\x30"/; > > thanks, > > Tom Keller > MMI DNA Services Core > > 4-2442 > kellert at ohsu edu > RJH (CROET/BasicScience) 6339b > > From ben.prew at gmail.com Thu Feb 11 16:10:03 2010 From: ben.prew at gmail.com (Ben Prew) Date: Thu, 11 Feb 2010 16:10:03 -0800 Subject: [Pdx-pm] bit wise comparison In-Reply-To: <4B747AB3.7090107@gmail.com> References: <4B747AB3.7090107@gmail.com> Message-ID: <24f4b2e81002111610o368b103cn8a7927d1ec45de03@mail.gmail.com> Here's the original thread, it looks like the author was having problems getting it working without the pack under Activestate 5.10 http://old.nabble.com/string-comparision-mismatches-and-matches-td27436645.html On Thu, Feb 11, 2010 at 1:46 PM, Steve Cayford wrote: > As far as I can tell, the pack commands are superfluous. They're just saying > take this string and pack it into a string. > > This works fine with the original strings... > > print scalar( > ? ?("ACCTCCTCCTCGAGTATGTG" ^ "TATCTTGCGCCGGAGATAAT") =~ tr/\x0/\x0/ > ?), "\n"; > > The tr/\x0/\x0/ is transliterating bytes that have zeroed out bits, not > ASCII zeros. > > -Steve > > Tom Keller wrote: >> >> Greetings, >> A Bioperl list I'm on gave the following as a fast string comparison >> method: >> >> ################################# >>> >>> $in = 'ACCTCCTCCTCGAGTATGTG'; >>> $tgt = 'TATCTTGCGCCGGAGATAAT'; >>> $mask = pack("A*",$in)^pack("A*",$tgt); >>> $matches = $mask =~ tr/"\x0"/"\x0"/; >> >> Impressive! Not often you see pack() let alone exclusive-or with a >> scalar context tr// thrown in for good measure! >> >> For those who don't follow what it is doing, here is my (possibly >> wrong) interpretation: The pack() is converting each of the two (equal >> length) strings into a byte set. A bit-wise exclusive-or (XOR) is >> performed between these two byte sets. This will create bytes of value >> zero (0) where they were the same, and non-zero where they were >> different. The tr// then counts how many of the bytes were zero (\x0 >> is ascii zero). >> ################################# >> >> I can't get it to work on my machine. Would someone be able to help me >> with this? >> >> For one thing, isn't ascii zero "x30" in hex? But even with that change, I >> get no return value for $matches in: >> my $matches = $mask =~ tr/"\x30"/"\x30"/; >> >> thanks, >> >> Tom Keller >> MMI DNA Services Core >> >> 4-2442 >> kellert at ohsu edu >> RJH (CROET/BasicScience) 6339b >> >> > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- --Ben From MichaelRWolf at att.net Thu Feb 11 18:39:59 2010 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 11 Feb 2010 18:39:59 -0800 Subject: [Pdx-pm] bit wise comparison In-Reply-To: <4B747AB3.7090107@gmail.com> References: <4B747AB3.7090107@gmail.com> Message-ID: <88B91730-8711-4DF7-9638-489DEAF7A11F@att.net> On Feb 11, 2010, at 1:46 PM, Steve Cayford wrote: > print scalar( > ("ACCTCCTCCTCGAGTATGTG" ^ "TATCTTGCGCCGGAGATAAT") =~ tr/\x0/\x0/ > ), "\n"; > > The tr/\x0/\x0/ is transliterating bytes that have zeroed out bits, > not ASCII zeros. perldoc perlop says: It returns the number of characters replaced or deleted. Since it's replacing something with itself, it's effectively counting those somethings (namely the NUL byte). As to \x0... Said another way, the original poster thought this code referred to '0', which *does* have a numeric value when passed through ord(). As Steve said ord('0') != 0. Notice that the NUL character (numeric value 0) is not printable, but the zero character is... perl -e 'printf "char: %s, decimal: %d, octal: 0%o, hex: 0x%x, binary: 0b%b\n", chr($_), ($_)x4 foreach (0, map {ord} "0" .. "9")' char: , decimal: 0, octal: 00, hex: 0x0, binary: 0b0 char: 0, decimal: 48, octal: 060, hex: 0x30, binary: 0b110000 char: 1, decimal: 49, octal: 061, hex: 0x31, binary: 0b110001 char: 2, decimal: 50, octal: 062, hex: 0x32, binary: 0b110010 char: 3, decimal: 51, octal: 063, hex: 0x33, binary: 0b110011 char: 4, decimal: 52, octal: 064, hex: 0x34, binary: 0b110100 char: 5, decimal: 53, octal: 065, hex: 0x35, binary: 0b110101 char: 6, decimal: 54, octal: 066, hex: 0x36, binary: 0b110110 char: 7, decimal: 55, octal: 067, hex: 0x37, binary: 0b110111 char: 8, decimal: 56, octal: 070, hex: 0x38, binary: 0b111000 char: 9, decimal: 57, octal: 071, hex: 0x39, binary: 0b111001 see also: ascii(7) on some unix-ish systems, copied below for incomplete systems (*nix and W32) -- best viewed at constant width font...; The octal set: 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel 010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si 020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb 030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us 040 sp 041 ! 042 " 043 # 044 $ 045 % 046 & 047 ' 050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 / 060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7 070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ? 100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W 130 X 131 Y 132 Z 133 [ 134 \ 135 ] 136 ^ 137 _ 140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w 170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 del The hexadecimal set: 00 nul 01 soh 02 stx 03 etx 04 eot 05 enq 06 ack 07 bel 08 bs 09 ht 0a nl 0b vt 0c np 0d cr 0e so 0f si 10 dle 11 dc1 12 dc2 13 dc3 14 dc4 15 nak 16 syn 17 etb 18 can 19 em 1a sub 1b esc 1c fs 1d gs 1e rs 1f us 20 sp 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3a : 3b ; 3c < 3d = 3e > 3f ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5a Z 5b [ 5c \ 5d ] 5e ^ 5f _ 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7a z 7b { 7c | 7d } 7e ~ 7f del The decimal set: 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From MichaelRWolf at att.net Thu Feb 11 18:49:24 2010 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 11 Feb 2010 18:49:24 -0800 Subject: [Pdx-pm] bit wise comparison In-Reply-To: <201002111335.31063.enobacon@gmail.com> References: <201002111335.31063.enobacon@gmail.com> Message-ID: <9A43F014-390A-4953-B25A-4DDEEA134FF5@att.net> On Feb 11, 2010, at 1:35 PM, Eric Wilhelm wrote: > # from Tom Keller > # on Thursday 11 February 2010 12:22: > >> $in = 'ACCTCCTCCTCGAGTATGTG'; >> $tgt = 'TATCTTGCGCCGGAGATAAT'; >> $mask = pack("A*",$in)^pack("A*",$tgt); >> $matches = $mask =~ tr/"\x0"/"\x0"/; > > I get warnings from the quotes (") in the tr//. You *did* enable > warnings, right? :-D tr's args are weird. As written, the first arg has 3 characters: double-quote, NUL, double- quote. So does the second arg. Effectively, it's setting up this mapping " => " \x0 => \x0 " => " Maybe it's more obvious if you see it this way, another 3-arg to 3-arg transliteration: tr/abc/ABC/ The original is best written as a 1-arg to 1-arg: tr/\x0/\x0/ or tr#\x0#\x0# or tr{\x0}{\x0} -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From jaleto at gmail.com Thu Feb 11 23:59:06 2010 From: jaleto at gmail.com (Jonathan Leto) Date: Thu, 11 Feb 2010 23:59:06 -0800 Subject: [Pdx-pm] Introduction to Parrot VM links Message-ID: <9aaadf9c1002112359r6cf79239gc3834dceb9cb5943@mail.gmail.com> Howdy, Here are various digital representations of my recent "Introduction to Parrot VM" talk: mp3 : http://ping.fm/B8WHy video : http://ping.fm/7rGS5 slides : http://ping.fm/Qz4QO Enjoy! -- Jonathan "Duke" Leto jonathan at leto.net http://leto.net From kellert at ohsu.edu Thu Feb 18 11:04:59 2010 From: kellert at ohsu.edu (Tom Keller) Date: Thu, 18 Feb 2010 11:04:59 -0800 Subject: [Pdx-pm] recursive IO::Dir Message-ID: Greetings, I need to be able to process files within a directory tree. I know there is a module IO::Dir::Recursive, but I have trouble wrapping my brain around recursion, so I wanted to give it a try just using IO::Dir. This seems to do the recursion correctly: #!/usr/bin/perl -w use strict; use IO::Dir; my $source = $ARGV[0]; my $count; process_dir($source); print "$count files in all.\n"; sub check { my ($dh,$path) = @_; ## dirhandle and path while (defined($_ = $dh->read)) { next if m/^\.+/; ## skip dot files if ( -f "$path/$_" ) { my $file = "$path/$_"; process_file($file); } elsif ( -d "$path/$_" ) { my $dir = "$path/$_"; process_dir($dir); } else { print "unknown thing\n"; } } undef $dh; } sub process_file { my $file = shift; $count++; } sub process_dir { my $path = shift; my $dh = IO::Dir->new($path); check($dh,$path); } ## ... I'm guessing there's a better way, so I'm asking for feedback. thanks, Tom kellert at ohsu.edu 503-494-2442 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at petdance.com Thu Feb 18 11:09:01 2010 From: andy at petdance.com (Andy Lester) Date: Thu, 18 Feb 2010 13:09:01 -0600 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: Message-ID: <01F342D3-2E7F-4782-9CFB-8EA0BA59C1A0@petdance.com> On Feb 18, 2010, at 1:04 PM, Tom Keller wrote: > I need to be able to process files within a directory tree. I know > there is a module IO::Dir::Recursive, but I have trouble wrapping my > brain around recursion, so I wanted to give it a try just using > IO::Dir. This seems to do the recursion correctly: > I'd like to suggest File::Next. # This is from memory use File::Next; my $files = File::Next::files( $directory ); while ( defined my $file = $files->next ) { process_file( $file ); } Butt simple, eh? xoxo, Andy -- Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance From enobacon at gmail.com Thu Feb 18 11:40:41 2010 From: enobacon at gmail.com (Eric Wilhelm) Date: Thu, 18 Feb 2010 11:40:41 -0800 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: Message-ID: <201002181140.41500.enobacon@gmail.com> # from Tom Keller # on Thursday 18 February 2010 11:04: >I need to be able to process files within a directory tree. This will give you all of the files and directories under $topdir: my @paths = File::Fu->dir($topdir)->find(sub{1}); If your matcher sub returns true, the file is returned. So for only the files: my @files = File::Fu->dir($topdir)->find(sub{$_->is_file}); The filenames returned are File::Fu::File objects relative to wherever $topdir is relative to (i.e. absolute if $topdir is absolute.) If you want an iterator instead of one big list, you can use the finder() method. my $iter = File::Fu->dir($topdir)->finder(sub{1}); while(defined(my $path = $iter->())) { $path or next; do_something_with($path); } http://search.cpan.org/~ewilhelm/File-Fu-v0.0.6/lib/File/Fu/Dir.pm#finder There is currently some better documentation for find(), finder(), and the knob in my svn trunk: http://svn.scratchcomputing.com/File-Fu/trunk/lib/File/Fu/Dir.pm --Eric -- Issues of control, repair, improvement, cost, or just plain understandability all come down strongly in favor of open source solutions to complex problems of any sort. --Robert G. Brown --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From shlomif at iglu.org.il Thu Feb 18 12:13:49 2010 From: shlomif at iglu.org.il (Shlomi Fish) Date: Thu, 18 Feb 2010 22:13:49 +0200 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: Message-ID: <201002182213.49442.shlomif@iglu.org.il> Hi Tom, On Thursday 18 Feb 2010 21:04:59 Tom Keller wrote: > Greetings, > I need to be able to process files within a directory tree. I know there is > a module IO::Dir::Recursive, but I have trouble wrapping my brain around > recursion, so I wanted to give it a try just using IO::Dir. This seems to > do the recursion correctly: > I would suggest using a directory traversal module such as File-Find-Object: http://www.shlomifish.org/open-source/projects/File-Find-Object/ It was created and developed as a better and saner alternative to the File::Find module which is distributed with perl 5, and there are other similar modules mentioned on its CPAN page: http://search.cpan.org/perldoc?File::Find::Object Also see all the links there. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ List of Portability Libraries - http://shlom.in/port-libs Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . From jaleto at gmail.com Thu Feb 18 12:20:47 2010 From: jaleto at gmail.com (Jonathan Leto) Date: Thu, 18 Feb 2010 12:20:47 -0800 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: Message-ID: <9aaadf9c1002181220v33d2a331gaab5f3eecc3bb0ec@mail.gmail.com> Howdy, As if you needed more possible solutions, there is File::Finder as well: http://search.cpan.org/dist/File-Finder/ Duke 2010/2/18 Tom Keller : > Greetings, > I need to be able to process files within a directory tree.?I know there is > a module IO::Dir::Recursive, but I have trouble wrapping my brain around > recursion, so I wanted to give it a try?just using IO::Dir. This seems to do > the recursion correctly: > #!/usr/bin/perl -w > use strict; > use IO::Dir; > my $source = $ARGV[0]; > my $count; > process_dir($source); > print "$count files in all.\n"; > sub check { > my ($dh,$path) = @_; ## dirhandle and path > while (defined($_ = $dh->read)) { > next if m/^\.+/; ## skip dot files > if ( -f "$path/$_" ) { > my $file = "$path/$_"; > process_file($file); > } elsif ( -d "$path/$_" ) { > my $dir = "$path/$_"; > process_dir($dir); > } else { print "unknown thing\n"; } > } > undef $dh; > } > sub process_file { > my $file = shift; > $count++; > } > sub process_dir { > my $path = shift; > my $dh = IO::Dir->new($path); > check($dh,$path); > } > ##?... I'm guessing there's a better way, so I'm asking for feedback. > thanks, > Tom > kellert at ohsu.edu > 503-494-2442 > > > > > > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- Jonathan "Duke" Leto jonathan at leto.net http://leto.net From tkil at scrye.com Thu Feb 18 12:41:42 2010 From: tkil at scrye.com (Tkil) Date: Thu, 18 Feb 2010 13:41:42 -0700 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: (Tom Keller's message of "Thu, 18 Feb 2010 11:04:59 -0800") References: Message-ID: >>>>> "Tom" == Tom Keller writes: Tom> I need to be able to process files within a directory tree. I Tom> know there is a module IO::Dir::Recursive, but I have trouble Tom> wrapping my brain around recursion, so I wanted to give it a try Tom> just using IO::Dir. I'm amused that you did end up with recursion anyway ("process_dir" calls "check" which can call "process_dir"). If you really want to avoid recursion, you want to do a breadth-first search and maintain a queue of directories to examine... but I'd advise against writing your own directory traversal code, regardless. One advantage to using good old File::Find is that it's available on every perl5 install for ... gah, 15+ years now? It also handles some things that could trip you up if you try to write it yourself, e.g., symlinks that create circular loops. Dead simple for what you want to do, too: | #!/usr/bin/perl | | use strict; | use warnings; | | use File::Find qw(); | | # the routine that looks at each file; for demonstration purposes, | # it'll just give the size. by default, File::Find::find changes into | # each directory as goes, and $_ is just the basename. to display the | # full name, we use the full-qualified variable $File::Find::name. | sub process_file | { | my ( $file ) = @_; | print "$File::Find::name: ", ( -s $file ), " bytes\n"; | } | | # assume that @ARGV holds the dirs we want to examine. | File::Find::find( sub { process_file $_ if -f $_ }, | @ARGV ); | | exit 0; Happy hacking, t. From erik at hollensbe.org Thu Feb 18 12:41:44 2010 From: erik at hollensbe.org (Erik Hollensbe) Date: Thu, 18 Feb 2010 15:41:44 -0500 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: Message-ID: <4B7DA608.3020303@hollensbe.org> Instead of plugging my own software, I'll mention File::Find because no one has yet. It should already be on your system. On 02/18/10 14:04, Tom Keller wrote: > Greetings, > I need to be able to process files within a directory tree. I know > there is a module IO::Dir::Recursive, but I have trouble wrapping my > brain around recursion, so I wanted to give it a try just using > IO::Dir. This seems to do the recursion correctly: > > #!/usr/bin/perl -w > use strict; > use IO::Dir; > > my $source = $ARGV[0]; > my $count; > > process_dir($source); > print "$count files in all.\n"; > > sub check { > my ($dh,$path) = @_; ## dirhandle and path > while (defined($_ = $dh->read)) { > next if m/^\.+/; ## skip dot files > if ( -f "$path/$_" ) { > my $file = "$path/$_"; > process_file($file); > } elsif ( -d "$path/$_" ) { > my $dir = "$path/$_"; > process_dir($dir); > } else { print "unknown thing\n"; } > } > undef $dh; > } > > sub process_file { > my $file = shift; > $count++; > } > > sub process_dir { > my $path = shift; > my $dh = IO::Dir->new($path); > check($dh,$path); > } > > ## ... I'm guessing there's a better way, so I'm asking for feedback. > > thanks, > > Tom > kellert at ohsu.edu > 503-494-2442 > > > > > > > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at petdance.com Thu Feb 18 12:47:10 2010 From: andy at petdance.com (Andy Lester) Date: Thu, 18 Feb 2010 14:47:10 -0600 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: <4B7DA608.3020303@hollensbe.org> References: <4B7DA608.3020303@hollensbe.org> Message-ID: On Feb 18, 2010, at 2:41 PM, Erik Hollensbe wrote: > Instead of plugging my own software, I'll mention File::Find because > no one has yet. It should already be on your system. No, go ahead, plug your software. What file digging module is yours? xoox, Andy -- Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance From erik at hollensbe.org Thu Feb 18 12:55:00 2010 From: erik at hollensbe.org (Erik Hollensbe) Date: Thu, 18 Feb 2010 15:55:00 -0500 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: References: <4B7DA608.3020303@hollensbe.org> Message-ID: <4B7DA924.8090806@hollensbe.org> On 02/18/10 15:47, Andy Lester wrote: > > On Feb 18, 2010, at 2:41 PM, Erik Hollensbe wrote: > >> Instead of plugging my own software, I'll mention File::Find because >> no one has yet. It should already be on your system. > > > No, go ahead, plug your software. What file digging module is yours? package My::FileDiggingModule; use strict; use warnings; use File::Find qw(find); sub find_a_directory { -d } sub gotta_catch_them_all { find(\&find_a_directory, @_); } q(how do you like them apples?); -Erik From kellert at ohsu.edu Thu Feb 18 13:09:05 2010 From: kellert at ohsu.edu (Tom Keller) Date: Thu, 18 Feb 2010 13:09:05 -0800 Subject: [Pdx-pm] recursive IO::Dir alternatives In-Reply-To: <201002181140.41500.enobacon@gmail.com> References: <201002181140.41500.enobacon@gmail.com> Message-ID: <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> Summary for modules to traverse a directory tree: 0. q(don't roll your own. ... I know that, just needed the exercise.) 1. File::Next 2. File::Fu 3. File::Find::Object 4. File::Finder 5. File::Find thanks, Tom kellert at ohsu.edu 503-494-2442 On Feb 18, 2010, at 11:40 AM, Eric Wilhelm wrote: # from Tom Keller # on Thursday 18 February 2010 11:04: I need to be able to process files within a directory tree. This will give you all of the files and directories under $topdir: my @paths = File::Fu->dir($topdir)->find(sub{1}); If your matcher sub returns true, the file is returned. So for only the files: my @files = File::Fu->dir($topdir)->find(sub{$_->is_file}); The filenames returned are File::Fu::File objects relative to wherever $topdir is relative to (i.e. absolute if $topdir is absolute.) If you want an iterator instead of one big list, you can use the finder() method. my $iter = File::Fu->dir($topdir)->finder(sub{1}); while(defined(my $path = $iter->())) { $path or next; do_something_with($path); } http://search.cpan.org/~ewilhelm/File-Fu-v0.0.6/lib/File/Fu/Dir.pm#finder There is currently some better documentation for find(), finder(), and the knob in my svn trunk: http://svn.scratchcomputing.com/File-Fu/trunk/lib/File/Fu/Dir.pm --Eric -- Issues of control, repair, improvement, cost, or just plain understandability all come down strongly in favor of open source solutions to complex problems of any sort. --Robert G. Brown --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- _______________________________________________ Pdx-pm-list mailing list Pdx-pm-list at pm.org http://mail.pm.org/mailman/listinfo/pdx-pm-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From merlyn at stonehenge.com Thu Feb 18 13:20:01 2010 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Thu, 18 Feb 2010 13:20:01 -0800 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: <9aaadf9c1002181220v33d2a331gaab5f3eecc3bb0ec@mail.gmail.com> (Jonathan Leto's message of "Thu, 18 Feb 2010 12:20:47 -0800") References: <9aaadf9c1002181220v33d2a331gaab5f3eecc3bb0ec@mail.gmail.com> Message-ID: <86vddu9r7i.fsf@blue.stonehenge.com> >>>>> "Jonathan" == Jonathan Leto writes: Jonathan> http://search.cpan.org/dist/File-Finder/ I also happen to be partial to that module. It works the way I think a module like this should work. Oh, yeah, no wonder. I wrote it. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion From jkeroes at gmail.com Thu Feb 18 13:24:01 2010 From: jkeroes at gmail.com (Joshua Keroes) Date: Thu, 18 Feb 2010 13:24:01 -0800 Subject: [Pdx-pm] recursive IO::Dir alternatives In-Reply-To: <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> References: <201002181140.41500.enobacon@gmail.com> <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> Message-ID: I've used File::Find::Rule with success. That said, I like File::Next's nice clean interface. Completely OT: zsh has a builtin globbing operator, **, that means "this directory and below". For example, find . -name "file*" -print would look like the following in zsh land: ls **/file* And any command works on the file lists, ls is just the tip of the iceberg. I <3 my new shell. 2010/2/18 Tom Keller > Summary for modules to traverse a directory tree: > 0. q(don't roll your own. ... I know that, just needed the exercise.) > 1. File::Next > 2. File::Fu > 3. File::Find::Object > 4. File::Finder > 5. File::Find > > thanks, > Tom > kellert at ohsu.edu > 503-494-2442 > > > > > > > > On Feb 18, 2010, at 11:40 AM, Eric Wilhelm wrote: > > # from Tom Keller > # on Thursday 18 February 2010 11:04: > > I need to be able to process files within a directory tree. > > > This will give you all of the files and directories under $topdir: > > my @paths = File::Fu->dir($topdir)->find(sub{1}); > > If your matcher sub returns true, the file is returned. So for only the > files: > > my @files = File::Fu->dir($topdir)->find(sub{$_->is_file}); > > The filenames returned are File::Fu::File objects relative to wherever > $topdir is relative to (i.e. absolute if $topdir is absolute.) > > If you want an iterator instead of one big list, you can use the > finder() method. > > my $iter = File::Fu->dir($topdir)->finder(sub{1}); > > while(defined(my $path = $iter->())) { > $path or next; > do_something_with($path); > } > > http://search.cpan.org/~ewilhelm/File-Fu-v0.0.6/lib/File/Fu/Dir.pm#finder > > There is currently some better documentation for find(), finder(), and > the knob in my svn trunk: > > http://svn.scratchcomputing.com/File-Fu/trunk/lib/File/Fu/Dir.pm > > --Eric > -- > Issues of control, repair, improvement, cost, or just plain > understandability all come down strongly in favor of open source > solutions to complex problems of any sort. > --Robert G. Brown > --------------------------------------------------- > http://scratchcomputing.com > --------------------------------------------------- > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at psdt.com Thu Feb 18 18:28:35 2010 From: peter at psdt.com (Peter Scott) Date: Thu, 18 Feb 2010 18:28:35 -0800 Subject: [Pdx-pm] recursive IO::Dir In-Reply-To: <4B7DA924.8090806@hollensbe.org> References: <4B7DA608.3020303@hollensbe.org> <4B7DA924.8090806@hollensbe.org> Message-ID: There's more than 17 ways to do it: $ perl -MIO::All -le '$io=io("."); print for $io->All' From bruce at drangle.com Fri Feb 19 09:57:26 2010 From: bruce at drangle.com (Bruce Keeler) Date: Fri, 19 Feb 2010 09:57:26 -0800 Subject: [Pdx-pm] recursive IO::Dir alternatives In-Reply-To: References: <201002181140.41500.enobacon@gmail.com> <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> Message-ID: <4B7ED106.40008@drangle.com> On 2/18/2010 1:24 PM, Joshua Keroes wrote: > I've used File::Find::Rule with success. That said, I like > File::Next's nice clean interface. > > Completely OT: zsh has a builtin globbing operator, **, that means > "this directory and below". For example, > > find . -name "file*" -print > > would look like the following in zsh land: > > ls **/file* > > And any command works on the file lists, ls is just the tip of the > iceberg. I <3 my new shell. > Welcome to the zsh fan club; I've been a member since '91! I've no idea why the world is all hung up on the vastly inferior bash. From ingy at ingy.net Fri Feb 19 13:04:40 2010 From: ingy at ingy.net (Ingy dot Net) Date: Fri, 19 Feb 2010 13:04:40 -0800 Subject: [Pdx-pm] recursive IO::Dir alternatives In-Reply-To: <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> References: <201002181140.41500.enobacon@gmail.com> <478E4793-3F9D-464D-A376-5C093CB910A1@ohsu.edu> Message-ID: <9eb4914f1002191304h7b8960f6rbf363feb806448a8@mail.gmail.com> IO::All works too. Here's some tasty idioms taken from the doc page: # Read all the files/directories in a directory: $io = io('my/directory/'); # Create new directory object @contents = $io->all; # Get all contents of dir @contents = @$io; # Directory as an array @contents = values %$io; # Directory as a hash push @contents, $subdir # One at a time while $subdir = $io->next; # Print the name and file type for all the contents above: print "$_ is a " . $_->type . "\n" # Each element of @contents for @contents; # is an IO::All object!! # Print first line of each file: print $_->getline # getline gets one line for io('dir')->all_files; # Files only # Print names of all files/dirs three directories deep: print "$_\n" for $io->all(3); # Pass in the depth. Default=1 # Print names of all files/dirs recursively: print "$_\n" for $io->all(0); # Zero means all the way down print "$_\n" for $io->All; # Capitalized shortcut print "$_\n" for $io->deep->all; # Another way 2010/2/18 Tom Keller > Summary for modules to traverse a directory tree: > 0. q(don't roll your own. ... I know that, just needed the exercise.) > 1. File::Next > 2. File::Fu > 3. File::Find::Object > 4. File::Finder > 5. File::Find > > thanks, > Tom > kellert at ohsu.edu > 503-494-2442 > > > > > > > > On Feb 18, 2010, at 11:40 AM, Eric Wilhelm wrote: > > # from Tom Keller > # on Thursday 18 February 2010 11:04: > > I need to be able to process files within a directory tree. > > > This will give you all of the files and directories under $topdir: > > my @paths = File::Fu->dir($topdir)->find(sub{1}); > > If your matcher sub returns true, the file is returned. So for only the > files: > > my @files = File::Fu->dir($topdir)->find(sub{$_->is_file}); > > The filenames returned are File::Fu::File objects relative to wherever > $topdir is relative to (i.e. absolute if $topdir is absolute.) > > If you want an iterator instead of one big list, you can use the > finder() method. > > my $iter = File::Fu->dir($topdir)->finder(sub{1}); > > while(defined(my $path = $iter->())) { > $path or next; > do_something_with($path); > } > > http://search.cpan.org/~ewilhelm/File-Fu-v0.0.6/lib/File/Fu/Dir.pm#finder > > There is currently some better documentation for find(), finder(), and > the knob in my svn trunk: > > http://svn.scratchcomputing.com/File-Fu/trunk/lib/File/Fu/Dir.pm > > --Eric > -- > Issues of control, repair, improvement, cost, or just plain > understandability all come down strongly in favor of open source > solutions to complex problems of any sort. > --Robert G. Brown > --------------------------------------------------- > http://scratchcomputing.com > --------------------------------------------------- > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.hengst at gmail.com Mon Feb 22 15:35:26 2010 From: ben.hengst at gmail.com (benh) Date: Mon, 22 Feb 2010 15:35:26 -0800 Subject: [Pdx-pm] defined $var->{key} changes $var in to a hashref? Message-ID: <85ddf48b1002221535k7618563ey785d5d9b6952936d@mail.gmail.com> is this expected? run under perl 5.10.0 : #!/usr/bin/perl use strict; use warnings; use Test::Most qw{no_plan}; my $var; eq_or_diff( $var, undef ); ok( ! defined $var->{key} ); eq_or_diff( $var, undef ); __END__ ok 1 ok 2 not ok 3 # Failed test at /tmp/mystry_hash.t line 14. # +----+-----+----------+ # | Elt|Got |Expected | # +----+-----+----------+ # * 0|{} |undef * # +----+-----+----------+ 1..3 # Looks like you failed 1 test of 3. -- benh~ http://three.sentenc.es/ From andy at petdance.com Mon Feb 22 15:37:44 2010 From: andy at petdance.com (Andy Lester) Date: Mon, 22 Feb 2010 17:37:44 -0600 Subject: [Pdx-pm] defined $var->{key} changes $var in to a hashref? In-Reply-To: <85ddf48b1002221535k7618563ey785d5d9b6952936d@mail.gmail.com> References: <85ddf48b1002221535k7618563ey785d5d9b6952936d@mail.gmail.com> Message-ID: <51D8FF40-06FE-4054-BE99-3981945BC9A2@petdance.com> On Feb 22, 2010, at 5:35 PM, benh wrote: > eq_or_diff( $var, undef ); > > ok( ! defined $var->{key} ); > > eq_or_diff( $var, undef ); Yes, because you're forcing $var to be a hashref because you want to get something out of it. You want to check to see if it's a hashref first. -- Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance From ben.hengst at gmail.com Mon Feb 22 15:47:34 2010 From: ben.hengst at gmail.com (benh) Date: Mon, 22 Feb 2010 15:47:34 -0800 Subject: [Pdx-pm] defined $var->{key} changes $var in to a hashref? In-Reply-To: <51D8FF40-06FE-4054-BE99-3981945BC9A2@petdance.com> References: <85ddf48b1002221535k7618563ey785d5d9b6952936d@mail.gmail.com> <51D8FF40-06FE-4054-BE99-3981945BC9A2@petdance.com> Message-ID: <85ddf48b1002221547u26be60fdy75eb8af9505c3eb9@mail.gmail.com> ok I guess I should rephrase, I understand ~why~ it's doing this ($var->{} builds out the hash, not defined), but it's not quite what my ~expectation~ was. What I was thinking was going to happen was more along the lines of: grep{$x = $_; $x->{key}} $var so that $var was not touched... though I can't think of a good way for defined to effectively clone in place as the transformation would have already happened as far as defined was concerned. On Mon, Feb 22, 2010 at 15:37, Andy Lester wrote: > > On Feb 22, 2010, at 5:35 PM, benh wrote: > >> eq_or_diff( $var, undef ); >> >> ok( ! defined $var->{key} ); >> >> eq_or_diff( $var, undef ); > > Yes, because you're forcing $var to be a hashref because you want to get something out of it. ?You want to check to see if it's a hashref first. > > -- > Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance > > > > > -- benh~ http://three.sentenc.es/ From schwern at pobox.com Mon Feb 22 16:21:15 2010 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 22 Feb 2010 16:21:15 -0800 Subject: [Pdx-pm] defined $var->{key} changes $var in to a hashref? In-Reply-To: <85ddf48b1002221547u26be60fdy75eb8af9505c3eb9@mail.gmail.com> References: <85ddf48b1002221535k7618563ey785d5d9b6952936d@mail.gmail.com> <51D8FF40-06FE-4054-BE99-3981945BC9A2@petdance.com> <85ddf48b1002221547u26be60fdy75eb8af9505c3eb9@mail.gmail.com> Message-ID: <4B831F7B.7000300@pobox.com> benh wrote: > ok I guess I should rephrase, I understand ~why~ it's doing this > ($var->{} builds out the hash, not defined), but it's not quite what > my ~expectation~ was. What I was thinking was going to happen was more > along the lines of: > > grep{$x = $_; $x->{key}} $var > > so that $var was not touched... though I can't think of a good way for > defined to effectively clone in place as the transformation would have > already happened as far as defined was concerned. Welcome to the Wonderful World of Autovivification. Generally considered to be a bug, or an overzealous feature, in cases where it vivifies just to check if something exists. Unfortunately, it was ill defined and is considered too ingrained into Perl to change. autovivification.pm can control this behavior lexically. perl5i comes with "no autovivification" built in. -- 54. "Napalm sticks to kids" is *not* a motivational phrase. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/ From enobacon at gmail.com Tue Feb 23 12:07:52 2010 From: enobacon at gmail.com (Eric Wilhelm) Date: Tue, 23 Feb 2010 12:07:52 -0800 Subject: [Pdx-pm] Perl 6 talk at westside Message-ID: <201002231207.52139.enobacon@gmail.com> Hi all, I'm giving a Perl 6 talk at the westside programmers group this Thursday. Please come heckle me. http://calagator.org/events/1250458344 The OTBC is right at the "The Round" stop on the max blue line (one stop west of beaverton transit center.) Thanks, Eric -- The opinions expressed in this e-mail were randomly generated by the computer and do not necessarily reflect the views of its owner. --Management --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From enobacon at gmail.com Wed Feb 24 18:39:57 2010 From: enobacon at gmail.com (Seven till Seven) Date: Wed, 24 Feb 2010 18:39:57 -0800 Subject: [Pdx-pm] XML with Xtra X -- March meeting in 2 weeks Message-ID: <201002241839.57129.enobacon@gmail.com> see http://pdx.pm.org/kwiki/ How to learn to parse huge XML documents by doing it wrong for 5 years Speaker: Tyler Riddle When XML documents can't fit into memory the vast majority of solutions available on CPAN are no longer available to you; when the XML documents are so large they take up to 16 hours to process with the standard tools for handling large documents your hands are tied even more. Tyler will cover his learning experiences creating the Parse::MediaWikiDump and MediaWiki::DumpFile modules which are made to handle the 24 gigabyte English Wikipedia dump files in a reasonable time frame. 1) Real world benchmarks of C and perl libraries used to process huge XML documents. 2) The dirty little secret about XS and what it means for you in this context. 3) The evolution of the implementation of a nice interface around event oriented (SAX style) XML parsing. 4) Why XML::LibXML::Reader and XML::CompactTree are your friends and how to tame them. As always, the meeting will be followed by social hour at the LuckyLab. -- http://pdx.pm.org