From phil at five-lawrences.com Mon Jan 3 09:05:06 2005 From: phil at five-lawrences.com (Phil Lawrence) Date: Mon Jan 3 09:03:39 2005 Subject: [ABE.pm] data structures within data structures In-Reply-To: <41D59115.2060200@Lehigh.EDU> References: <20041231160405.GA4194@uranus.faber.nom> <41D59115.2060200@Lehigh.EDU> Message-ID: On Dec 31, 2004, at 12:49, Jim Eshleman wrote: > > I don't understand the question/example, but you'll likely find what > you need in "perldsc", the Perl Data Structures Cookbook: > > perldoc perldsc > > Check out the CODE EXAMPLES section. Good answer. I'm woefully unfamiliar with perldoc! Ric gave some good examples, and for my $.02 I'll preach on the infix operator ( i.e. this arrow looking thing: -> ) I love the infix for it's visual cue. So much nicer to see: $ds->[1][2][2] instead of $ds[1][2][2] Of course that requires $ds be an aref instead of an array, but that doesn't bother me. Hmmm. I've used the "arrow operator" for some neat visual cues... can't remember... Well, in the meantime, while I'm thinking, I'll mention it is used to dereference coderefs: $cr->( 'arg1', 'arg2' ); Oh, well. Can;t remember whatever is nibbling at my brain. But infix ops are optional, i.e. $ds->[1]->[2]->[2] is the same as: $ds->[1][2][2] You have some freedom of expression, for example if you wanted to make the last level stand out: $ds->[1][2]->[2] prl From rhkramer at gmail.com Mon Jan 3 17:29:08 2005 From: rhkramer at gmail.com (Randy Kramer) Date: Mon Jan 3 17:23:41 2005 Subject: [ABE.pm] Choosing between Ruby and Lisp Message-ID: <200501031829.08103.rhkramer@gmail.com> As I started my Ruby reading (pickaxe2), I digressed to a fair amount of reading about Lisp. I'm now contemplating switching to Lisp. I'm seeking general comments, and have some specific questions: * I'm fairly certain Lisp will have a steeper learning curve than Ruby? * Can I find the libraries I'll need (widgets including editors/renderers for plain text, HTML (or a browser), maybe some other like RTF)? Randy Kramer From rhkramer at gmail.com Tue Jan 4 08:58:10 2005 From: rhkramer at gmail.com (Randy Kramer) Date: Tue Jan 4 10:59:17 2005 Subject: [ABE.pm] Re: [Lvlug] Re: Choosing between Ruby and Lisp In-Reply-To: <20050103233409.GB3922@uranus.faber.nom> References: <200501031829.08103.rhkramer@gmail.com> <20050103233409.GB3922@uranus.faber.nom> Message-ID: <200501040958.10204.rhkramer@gmail.com> Faber, Thanks for the reply (and the offer)! (more comments interspersed below) All, I welcome everyone's comments. Randy Kramer On Monday 03 January 2005 06:34 pm, Faber Fedor wrote: > That's the problem I had. I take it you mean lack of libraries? (vs. steeper learning curve?) > A Lisp programmer who lives down the street > kept telling me to get Franz Lisp but that's a commercial package. I'll look into Franz Lisp (check price, libraries, Linux compatibility, etc.). > Somewhere around here I've got a CD from NYLISP group with various > tutorials and the like on it. If you want it I can try and find it. I took a look, I thought I might have gotten a copy at one of the LinuxWorld expos, but I guess not. I've found the nyc lispers (iirc) mail list and subscribed. I'll probably ask some questions there, but I suspect I can find those same things on their site. If you happen to be coming to an lvlug or similar meeting in this area in the near future (for any value of near), and you find the CD, bring it along (and let me know you're coming to that particular meeting so I show up). PS: The impressions I'm starting to get about Lisp include: * It is extremely flexible, you can make it do anything you want. * The keyword may be "you" (can make it) -- doesn't sound like there are many (useful) prebuilt libraries (for widgets and the like, especially). * Lisp is clearly not one "language" but includes a lot of alternatives (Common, scheme (maybe), Franz, ...), so not only would I have to pick Lisp as my language, but which Lisp (and, iirc, there is some significant difference between Common Lisp and Scheme (like one supports some good sounding feature (continuations?) and the other doesn't). On the other hand, I'm somewhat hesitant about Ruby. I'm lurking on a lot of their mail lists, and seeing discussions (and debates/uncertainty (from "matz")) about features they want to add to 2.0. If the language is so good (i.e., I would have assumed that meant well planned/thought out), why is he uncertain about these things. Makes it sound like it is just another language that somebody threw together (and maybe even the best language so far), but people aren't quite sure of the limitations yet (because they haven't got that far). Aside: Part of my quest is to learn only one more programming language. I don't want to learn Ruby, and then find that I need to consider moving to the next great language. (I'm too old for that.) On the other hand, I suspect I could expand some version of Lisp to do almost anything that anyone could imagine, but I may have to do more of it myself. (I want to get things done, not immerse myself in a programming wonderland where I can get lost in theoretical discussions about the best way to program something.) Comments welcome from everyone! regards, Randy Kramer From rjbs-perl-abe at lists.manxome.org Thu Jan 6 08:52:38 2005 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu Jan 6 08:52:41 2005 Subject: [ABE.pm] using, not writing, perl objects Message-ID: <20050106095238.O8135@manxome.org> I saw this article by Sean Burke today, and I thought some intermediates out there might find it useful. It's a nice introduction to how objects, and specifically Perl objects, are useful and used. http://interglacial.com/~sburke/tpj/as_html/tpj17.html -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050106/5e53be4a/attachment.bin From rhkramer at gmail.com Thu Jan 6 12:09:56 2005 From: rhkramer at gmail.com (Randy Kramer) Date: Thu Jan 6 12:05:52 2005 Subject: [ABE.pm] (1) A Lisp observation (for comment), (2) A Question for abe-pm Message-ID: <200501061309.56721.rhkramer@gmail.com> (2) I've been cross posting some of these type questions and comments to lvlug and abe.pm. I think most of my responses have been coming from the lvlug. I think my future questions will focus primarily on Lisp and Ruby. Is there anybody that is interested (or likely to reply to) such question on the abe-pm who is not also on the lvlug list? (In other words, unless I hear to the contrary, I'll probably stop cross posting in favor of posting only to the lvlug list.) (1) One of the things I'm beginning to sense about Lisp is that it is both a very high and a very low level programming language. For example, I believe (but couldn't prove, and wouldn't try to prove) that the conventions for, for example, calling a subroutine are not defined by some definition within Lisp but are conventions built on top of Lisp. I (or someone else) could come along and define and use a different subroutine calling convention, and Lisp gives me low enough level tools to let me implement that within Lisp. (Am I wrong about that? But, the bigger question for me is:) Is that a practical problem? I mean, have different Lisp libraries used different calling conventions that would make it difficult to use libraries from different sources within the same program? (And, is that part of the difference between the different dialects of Lisp?) Randy Kramer From faber at linuxnj.com Fri Jan 7 13:17:43 2005 From: faber at linuxnj.com (Faber Fedor) Date: Fri Jan 7 13:17:46 2005 Subject: [ABE.pm] making things more perlish Message-ID: <20050107191743.GA9257@uranus.faber.nom> Heyguys, I just found a nasty little bug in one of my date routines (turns out when date(1) substracts a month, it subtracts 30 days instead) so I rewrote it using DateTime. What I have know does what I want (and more!) so it's going into the codebase, but it's not very Perl-ish; I especially didn't like having to create the second DateTime object. I was wondering if anyone in here would like to show me how to make it more Perl-ish? <----------------------------< cut here >----------------------------> #!/usr/bin/perl -w use strict; use DateTime; my $mydate = ldopm(); print "$mydate\n"; $mydate = ldopm("20041231"); print "$mydate\n"; $mydate = ldopm(ldopm()); print "$mydate\n"; sub ldopm { # Get the last day of the previous month my ($date) = @_; my $dt; if ($date) { $dt= DateTime->new(year => substr($date, 0, 4), month => substr($date, 4, 2), day => substr($date, 6, 2) ); } else { $dt = DateTime->now; } $dt = $dt->subtract(months => 1); my ($year, $month); $year = $dt->year(); $month = $dt->month(); my $dt2 = DateTime->last_day_of_month( year=> $year, month=> $month ); return $dt2->ymd(''); } -- Regards, Faber Linux New Jersey: Open Source Solutions for New Jersey http://www.linuxnj.com From rhkramer at gmail.com Fri Jan 7 19:16:25 2005 From: rhkramer at gmail.com (Randy Kramer) Date: Fri Jan 7 19:10:35 2005 Subject: [ABE.pm] using, not writing, perl objects In-Reply-To: <20050106095238.O8135@manxome.org> References: <20050106095238.O8135@manxome.org> Message-ID: <200501072216.25286.rhkramer@gmail.com> On Thursday 06 January 2005 09:52 am, Ricardo SIGNES wrote: > I saw this article by Sean Burke today, and I thought some intermediates > out there might find it useful. It's a nice introduction to how > objects, and specifically Perl objects, are useful and used. > > http://interglacial.com/~sburke/tpj/as_html/tpj17.html Ricardo, Very helpful article, thanks! I think it will be of help to beginners as well, and not just for Perl. Randy Kramer From sol0 at Lehigh.EDU Fri Jan 7 19:20:50 2005 From: sol0 at Lehigh.EDU (Lidie Steve) Date: Fri Jan 7 19:20:58 2005 Subject: [ABE.pm] using, not writing, perl objects In-Reply-To: <200501072216.25286.rhkramer@gmail.com> References: <20050106095238.O8135@manxome.org> <200501072216.25286.rhkramer@gmail.com> Message-ID: <4BCCA2A9-6124-11D9-9530-00039366E622@lehigh.edu> On Jan 7, 2005, at 10:16 PM, Randy Kramer wrote: > On Thursday 06 January 2005 09:52 am, Ricardo SIGNES wrote: >> I saw this article by Sean Burke today, and I thought some >> intermediates >> out there might find it useful. It's a nice introduction to how >> objects, and specifically Perl objects, are useful and used. >> >> http://interglacial.com/~sburke/tpj/as_html/tpj17.html > > Ricardo, > > Very helpful article, thanks! > > I think it will be of help to beginners as well, and not just for Perl. Yes, nicely done. Another great benefit of objects is the encapsulation of data and methods they provide. From jce0 at Lehigh.EDU Fri Jan 7 22:30:10 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Fri Jan 7 22:30:33 2005 Subject: [ABE.pm] making things more perlish In-Reply-To: <20050107191743.GA9257@uranus.faber.nom> References: <20050107191743.GA9257@uranus.faber.nom> Message-ID: <41DF7DF2.6000403@Lehigh.EDU> Long ago I decided to use Date::Calc for these kinds of things, so here is how I would do it. I know it doesn't really answer your question but thought it may be of some use... #!/usr/bin/perl -w use Date::Calc qw(:all); use strict; print ldopm() . "\n"; print ldopm("20041231") . "\n"; print ldopm(ldopm()) . "\n"; print ldopm("20050101") . "\n"; print ldopm("20040301") . "\n"; print ldopm("20030301") . "\n"; print ldopm("00000000") . "\n"; sub ldopm { # Get the last day of the previous month my $ymdstr = shift; my @ymd; if ($ymdstr) { @ymd = $ymdstr =~ /(\d\d\d\d)(\d\d)(\d\d)/; check_date(@ymd) or die "ldopm: invalid date '$ymdstr'\n"; } else { @ymd = Today(); } return sprintf "%04d%02d%02d", Add_Delta_Days(@ymd, -$ymd[2]); } should produce: $ ./ldopm.pl 20041231 20041130 20041130 20041231 20040229 20030228 ldopm: invalid date '00000000' -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050108/ed7c49f4/signature.bin From rjbs-perl-abe at lists.manxome.org Sat Jan 8 04:46:13 2005 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sat Jan 8 04:46:24 2005 Subject: [ABE.pm] making things more perlish In-Reply-To: <41DF7DF2.6000403@Lehigh.EDU> References: <20050107191743.GA9257@uranus.faber.nom> <41DF7DF2.6000403@Lehigh.EDU> Message-ID: <20050108074613.X8135@manxome.org> * Jim Eshleman [2005-01-08T01:30:10] > Long ago I decided to use Date::Calc for these kinds of things, so here > is how I would do it. I know it doesn't really answer your question but > thought it may be of some use... I'm with Jim. DateTime is a goldarn pain in the butt. It has a nice interface, it works correctly, and it can do /anything/. But it's huge, and it can't be installed automatically on some platforms, and it's often overkill for simple uses. > @ymd = $ymdstr =~ /(\d\d\d\d)(\d\d)(\d\d)/; I would probably say: @ymd = $ymdstr =~ /\A(\d\d\d\d)(\d\d)(\d\d)\Z/; to make sure that it's the only thing in the string... but that's just me. It's not a big deal. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050108/765dc00d/attachment.bin From faber at linuxnj.com Sat Jan 8 07:08:07 2005 From: faber at linuxnj.com (Faber Fedor) Date: Sat Jan 8 07:08:19 2005 Subject: [ABE.pm] Re: making things more perlish In-Reply-To: <41DF7DF2.6000403@Lehigh.EDU> References: <20050107191743.GA9257@uranus.faber.nom> <41DF7DF2.6000403@Lehigh.EDU> Message-ID: <20050108150807.GA2494@uranus.faber.nom> On 08/01/05 01:30 -0500, Jim Eshleman wrote: > Long ago I decided to use Date::Calc for these kinds of things, Now he tells me! > is how I would do it. I know it doesn't really answer your question but > thought it may be of some use... It raises some usage Q, such as... > #!/usr/bin/perl -w > > use Date::Calc qw(:all); Why include the 'qw(:all)'? > sub ldopm { > > # Get the last day of the previous month > > my $ymdstr = shift; You're doing a shift cuz you only have one argument? > my @ymd; > > if ($ymdstr) { > @ymd = $ymdstr =~ /(\d\d\d\d)(\d\d)(\d\d)/; See! More Perl-ish! That's what I'm talking about! > check_date(@ymd) or die "ldopm: invalid date '$ymdstr'\n"; check_date() is a function I write? > } else { > @ymd = Today(); > } > > return sprintf "%04d%02d%02d", Add_Delta_Days(@ymd, -$ymd[2]); I'll look into this Add_Delta_Days thing. As RJBS pointed out, DateTime is a bit unwiedly. -- Regards, Faber Linux New Jersey: Open Source Solutions for New Jersey http://www.linuxnj.com From jce0 at Lehigh.EDU Sat Jan 8 07:49:29 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Sat Jan 8 07:49:47 2005 Subject: [ABE.pm] Re: making things more perlish In-Reply-To: <20050108150807.GA2494@uranus.faber.nom> References: <20050107191743.GA9257@uranus.faber.nom> <41DF7DF2.6000403@Lehigh.EDU> <20050108150807.GA2494@uranus.faber.nom> Message-ID: <41E00109.8020409@Lehigh.EDU> >>use Date::Calc qw(:all); > > > Why include the 'qw(:all)'? Imports all functions from the module. You could also list just those you need if you're "tight with a byte". >>sub ldopm { >> >> # Get the last day of the previous month >> >> my $ymdstr = shift; > > > You're doing a shift cuz you only have one argument? Yep. >> check_date(@ymd) or die "ldopm: invalid date '$ymdstr'\n"; > > > check_date() is a function I write? No, check_date() is provided by Date::Calc. >> return sprintf "%04d%02d%02d", Add_Delta_Days(@ymd, -$ymd[2]); > > > I'll look into this Add_Delta_Days thing. As RJBS pointed out, DateTime > is a bit unwiedly. Date::Calc also has a Days_in_Month function so you could subtract one from the month using Add_Delta_YMD, then use Days_in_Month. But just subtracting the day of month from the date, resulting in the date of the last day of the previous month, seemed easier. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050108/99faadf6/signature.bin From jce0 at Lehigh.EDU Sat Jan 8 08:19:09 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Sat Jan 8 08:19:28 2005 Subject: [ABE.pm] Re: making things more perlish In-Reply-To: <20050108150807.GA2494@uranus.faber.nom> References: <20050107191743.GA9257@uranus.faber.nom> <41DF7DF2.6000403@Lehigh.EDU> <20050108150807.GA2494@uranus.faber.nom> Message-ID: <41E007FD.5080008@Lehigh.EDU> > See! More Perl-ish! That's what I'm talking about! So you want to write idiomatic perl. You might want to check out the book "Effective Perl Programming" by Joseph N. Hall and Randal Schwartz. You can likely pick-up all the idioms from other books and the perl faq, but I'm a big Joseph Hall fan so I'll plug his book. IMO idiomatic just means concise and efficient. I was lucky enough to attend two of his talks at an early (@CMU I guess) YAPC. Maybe you can find the foils online. One was on idiomatic perl or effective perl programming I think, the other was OO Perl. I think some other perl guru gave an idiomatic perl talk at a later YAPC. If I ever get to another meeting I'll bring the book (no you cannot have/borrow it!) and those foils if I can find them. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050108/66970d59/signature-0001.bin From jce0 at Lehigh.EDU Sat Jan 8 08:42:14 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Sat Jan 8 08:42:34 2005 Subject: [ABE.pm] Re: making things more perlish In-Reply-To: <41E007FD.5080008@Lehigh.EDU> References: <20050107191743.GA9257@uranus.faber.nom> <41DF7DF2.6000403@Lehigh.EDU> <20050108150807.GA2494@uranus.faber.nom> <41E007FD.5080008@Lehigh.EDU> Message-ID: <41E00D66.1070207@Lehigh.EDU> > I was lucky enough to attend two of his talks at an early (@CMU I guess) > YAPC. Maybe you can find the foils online. One was on idiomatic perl > or effective perl programming I think, the other was OO Perl. I think > some other perl guru gave an idiomatic perl talk at a later YAPC. Hmmm, the Effective Perl foils are here: http://www.5sigma.com/perl/ Good stuff. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050108/f69d9c70/signature.bin From rjbs-perl-abe at lists.manxome.org Sun Jan 9 12:09:17 2005 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sun Jan 9 12:09:27 2005 Subject: [ABE.pm] finding calendar units Message-ID: <20050109150917.C4905@manxome.org> Ok, I want to do something, and I know how to do it, but I'm hoping there exists a nice pre-built (non-DateTime!) solution. Given a date in the format [year, [month, [ day ]]] I want to determine (begin, end) seconds. So: span(2004); # (first sec of 2004, last sec of 2004) span(2004,01); # (first sec of jan 2004, last sec of jan 2004) span(2004,01,02); # (first sec of jan 2nd 2004, last sec of jan 2nd 2004) Suggestions? -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050109/cfe942f5/attachment.bin From rjbs-perl-abe at lists.manxome.org Sun Jan 9 14:14:26 2005 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sun Jan 9 14:14:37 2005 Subject: [ABE.pm] finding calendar units In-Reply-To: <20050109150917.C4905@manxome.org> References: <20050109150917.C4905@manxome.org> Message-ID: <20050109171426.E4905@manxome.org> * Ricardo SIGNES [2005-01-09T15:09:17] > Given a date in the format [year, [month, [ day ]]] I want to determine > (begin, end) seconds. So: > span(2004); # (first sec of 2004, last sec of 2004) > span(2004,01); # (first sec of jan 2004, last sec of jan 2004) > span(2004,01,02); # (first sec of jan 2nd 2004, last sec of jan 2nd 2004) This is what I'm using in the interim: use strict; use warnings; use Time::Local; my @monthdays = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); # ly if /4 and not /100 unless % 400 sub is_leap_year { return 0 if $_[0] % 4; return 1 if not $_[0] % 400; return 0 if not $_[0] % 100; return 1; } sub span { my $date = shift; my ($y,$m,$d) = $date =~ /\A(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?\Z/; return unless $y; my $begin_secs = timelocal(0,0,0,$d||1,$m||0,$y); my $length; if ($d) { $length = 86400 } elsif ($m) { $length = 86400 * $monthdays[$m+0]; $length++ if $m==1 and is_leap_year($y) } else { $length = 86400 * is_leap_year($y) ? 366 : 365; } return ($begin_secs, $begin_secs + $length); } -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050109/a5fefcc2/attachment.bin From jce0 at Lehigh.EDU Sun Jan 9 16:10:25 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Sun Jan 9 16:10:40 2005 Subject: [ABE.pm] finding calendar units In-Reply-To: <20050109150917.C4905@manxome.org> References: <20050109150917.C4905@manxome.org> Message-ID: <41E1C7F1.5070009@Lehigh.EDU> > Ok, I want to do something, and I know how to do it, but I'm hoping > there exists a nice pre-built (non-DateTime!) solution. > > Given a date in the format [year, [month, [ day ]]] I want to determine > (begin, end) seconds. So: > > span(2004); # (first sec of 2004, last sec of 2004) > span(2004,01); # (first sec of jan 2004, last sec of jan 2004) > span(2004,01,02); # (first sec of jan 2nd 2004, last sec of jan 2nd 2004) > > Suggestions? Something like this?: #!/usr/bin/perl -w use Date::Calc qw(:all); use strict; print "span(2004)=", span(2004), "\n"; print "span(2004,01)=", span(2004,01), "\n"; print "span(2004,01,02)=", span(2004,01,02), "\n"; sub span { my($year, $month, $day) = @_; my($startm, $startd, $endm, $endd); if ($month) { $startm = $endm = $month; } else { $startm = 1; $endm = 12; } if ($day) { $startd = $endd = $day; } else { $startd = 1; $endd = Days_in_Month($year, $endm); } my $startsecs = Mktime($year, $startm, $startd, 0, 0, 0); my $endsecs = Mktime($year, $endm, $endd, 23, 59, 59); return $endsecs - $startsecs + 1; } should produce: $ ./span.pl span(2004)=31622400 span(2004,01)=2678400 span(2004,01,02)=86400 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050109/9c50a21b/signature.bin From jce0 at Lehigh.EDU Sun Jan 9 16:28:26 2005 From: jce0 at Lehigh.EDU (Jim Eshleman) Date: Sun Jan 9 16:28:36 2005 Subject: [ABE.pm] finding calendar units In-Reply-To: <41E1C7F1.5070009@Lehigh.EDU> References: <20050109150917.C4905@manxome.org> <41E1C7F1.5070009@Lehigh.EDU> Message-ID: <41E1CC2A.6060201@Lehigh.EDU> > Something like this?: Oops, not exactly what you asked for, but you get idea. You could return $startsecs and $endsecs, which are seconds since 1970/1/1 or somesuch... -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20050109/b72591eb/signature.bin From glim at mycybernet.net Mon Jan 24 19:51:00 2005 From: glim at mycybernet.net (glim@mycybernet.net) Date: Mon Jan 24 19:50:00 2005 Subject: [ABE.pm] Yet Another Perl Conference North America 2005 announces call-for-papers Message-ID: YAPC::NA 2005 (Yet Another Perl Conference, North America) has just released its call-for-papers; potential and aspiring speakers can submit a presentation proposal via: http://yapc.org/America/cfp-2005.shtml The dates of the conference are Monday - Wednesday 27-29 June 2005. The location will be in downtown Toronto, Ontario, Canada. (Note that a different date block was previously announced, but has been moved to accomodate venue availability.) The close of the call-for-papers is April 18, 2005 at 11:59 pm. If you have any questions regarding the call-for-papers or speaking at YAPC::NA 2005 please email na-author@yapc.org We would love to hear from potential sponsors. Please contact the organizers at na-sponsor@yapc.org to learn about the benefits of sponsorship. Other information regarding the conference (e.g. venue, registration specifics) will be announced soon. We look forward to your submissions and a great conference! From faber at linuxnj.com Mon Jan 24 20:51:22 2005 From: faber at linuxnj.com (Faber Fedor) Date: Mon Jan 24 20:51:32 2005 Subject: [ABE.pm] OOP design question Message-ID: <20050125045122.GA1581@uranus.faber.nom> Being raised back in the days of procedural languages, I never really wrapped my head around objects; they just seem like glorified C structs with virtual function pointers to me.But after reading up on Lisp, Python and tonight Ruby, I'm going to give OOP another go. I've got a client for whom I'm writing a bunch of small Perl scripts; the largest one being 12K + a 9K module. They generally consist of fetching a text file, putting it into a table (maybe with some massaging), doing some SQL, maybe outputting a subset of the data to a text file. That's it. Nothing special (although they were impressed that I reduced the original programs run-time from six days to 20 minutes, but that's another story). So I'm looking for an opportunity to use OOP here; language doesn't matter, but let's keep it to Perl for this group. Problem is, I can't seem to find a reason to use OOP. Here's one of the simplest programs I've written for them: 1. Get the date and some other options from the command line (like print debug statements, etc.). I use GetOpts for this. 2. Open up a text file. 3. toss the first 13 line 4. take fields 1,3, and 13 and put into a temporary MySQL table 5. Do a join with another table. 6. fetch the results 7. Print results to an output file. The non-simple ones included the above steps and some exploratory data analysis. BFD. How would you use OOP for something like this? Sure, I could shoehorn it into an object but that doesn't make it Right. And would there be any benefit to doing it as OOP? I certainly don't see any. Discuss. -- Regards, Faber Linux New Jersey: Open Source Solutions for New Jersey http://www.linuxnj.com