Prev: worst concept in computer science [Was: to RG - Lisp lunacyand Perl psychosis]
Next: FAQ 8.2 How come exec() doesn't return?
From: John Bokma on 13 Mar 2010 10:49 Ben Morrow <ben(a)morrow.me.uk> writes: > Quoth John Bokma <john(a)castleamber.com>: >> Ben Morrow <ben(a)morrow.me.uk> writes: >> >> > Quoth John Bokma <john(a)castleamber.com>: >> >> jt(a)toerring.de (Jens Thoms Toerring) writes: >> >> >> >> > open my $handle, '<', $filename or die "Can't open file\n"; >> >> >> >> To me the acceptable minimum for the rhs of or would be: >> >> >> >> die "Can't open '$filename': $!"; >> >> >> >> this reports and the filename and why it couldn't be opened. >> >> >> >> >> >> Personally I prefer to add "for reading" since I consider it more clear >> >> compared to just "Can't open". >> > >> > I think I'll take this opportunity to recommend 'autodie' again. >> > >> > ~% perl -Mautodie -e'open my $X, "<", "/not/there"' >> > Can't open '/not/there' for reading: 'No such file or directory' at >> > -e line 1 >> > ~% >> > >> > No thought required :). >> >> Yup, I am aware of autodie I just have to start using it. Any chance it >> will be a core module in the near feature (as it replaces Fatal)? > > ~% corelist autodie > > autodie was first released with perl 5.010001 > ~% > > Ben john(a)ecce:~$ perl -Mautodie -e1 Can't locate autodie.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .). BEGIN failed--compilation aborted. john(a)ecce:~$ corelist autodie autodie was not in CORE (or so I think) john(a)ecce:~$ -- John Bokma j3b Hacking & Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl & Python Development
From: Ben Morrow on 13 Mar 2010 11:13 Quoth John Bokma <john(a)castleamber.com>: > Ben Morrow <ben(a)morrow.me.uk> writes: > > > Quoth John Bokma <john(a)castleamber.com>: > >> > >> Yup, I am aware of autodie I just have to start using it. Any chance it > >> will be a core module in the near feature (as it replaces Fatal)? > > > > ~% corelist autodie > > > > autodie was first released with perl 5.010001 ^^^^^^^^ > > john(a)ecce:~$ perl -Mautodie -e1 > Can't locate autodie.pm in @INC (@INC contains: /etc/perl > /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 ^^^^^^ > /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 > /usr/local/lib/site_perl .). > BEGIN failed--compilation aborted. > john(a)ecce:~$ corelist autodie > > autodie was not in CORE (or so I think) > john(a)ecce:~$ The version of Module::CoreList shipped with 5.10.0 only knows about modules that went in before 5.10.0 shipped. You need 5.10.1. Ben
From: John Bokma on 13 Mar 2010 11:24
Ben Morrow <ben(a)morrow.me.uk> writes: > Quoth John Bokma <john(a)castleamber.com>: >> Ben Morrow <ben(a)morrow.me.uk> writes: >> >> > Quoth John Bokma <john(a)castleamber.com>: >> >> >> >> Yup, I am aware of autodie I just have to start using it. Any chance it >> >> will be a core module in the near feature (as it replaces Fatal)? >> > >> > ~% corelist autodie >> > >> > autodie was first released with perl 5.010001 > ^^^^^^^^ >> >> john(a)ecce:~$ perl -Mautodie -e1 >> Can't locate autodie.pm in @INC (@INC contains: /etc/perl >> /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 > ^^^^^^ >> /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 >> /usr/local/lib/site_perl .). >> BEGIN failed--compilation aborted. >> john(a)ecce:~$ corelist autodie >> >> autodie was not in CORE (or so I think) >> john(a)ecce:~$ > > The version of Module::CoreList shipped with 5.10.0 only knows about > modules that went in before 5.10.0 shipped. You need 5.10.1. Ah, shoot. I read 5.010001 as a very, very old Perl 5.0000x version, not as 5.10.1 Anyway, thanks. I want to switch to autodie in all my (new) scripts for some time, and have now no more excuses not to. -- John Bokma j3b Hacking & Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl & Python Development |