Re: Top 10 things to read when your flight is canceled
by Mutant (Priest) on Mar 13, 2007 at 17:03 UTC
|
Some of those are definitely on my list of things to read.
++Class::Accessor and DBIx::Class.
I am not a big constant fan however. I went through a phase (well, probably about 2 years) of using them, but they can be fiddly at times, especially if you use them for complex data structures. You often end up with something like:
print "I have " . FOO()->{APPLES} . " apples".
which to me is just ugly, and gets unreadable pretty quickly, especially if you have constants in different packages.
Besides that, I realised there's actually nothing stopping you modifying the values. Like most things in Perl, it's really just a convention. If that's the case, I'd rather just use uppercased variable names, which is a pretty widely used convention, and not as messy as the pragma. | [reply] [d/l] |
|
In Perl Best Practices (Ch. 4) TheDamian recommends "use Readonly" instead of "use constant", both because it prevents further modification of the value, and because Readonly gives your constants the syntax properties you would expect to go with their having a sigil.
| [reply] |
|
The disadvantage to Readonly is that it isn't optimized away, if it was possible. For example:
use constant DEBUG => 0;
print STDERR "foo = $foo\n" if DEBUG;
The second statement gets optimized away. But in
use Readonly;
Readonly::Scalar $DEBUG => 0;
print STDERR "foo = $foo\n" if $DEBUG;
the last statement is not optimized away, and the test is indeed performed every time the statement is encountered.
Even worse: a Readonly variable is a tied variable, so the test will be slower than it would have been if it wasn't Readonly.
| [reply] [d/l] [select] |
|
printf "I have %s apples", FOO()->{APPLES};
| [reply] [d/l] |
Re: Top 10 things to read when your flight is canceled
by jdporter (Paladin) on Mar 13, 2007 at 16:40 UTC
|
I usually "cross-train" by reading books on philosophy, religion, or theoretical physics... or maybe a good book on enterprise software development. ;-)
For flights, I also usually bring along one of those big books of mixed puzzles, and a pad sudoku puzzles.
A word spoken in Mind will reach its own level, in the objective world, by its own weight
| [reply] |
Re: Top 10 things to read when your flight is canceled
by Old_Gray_Bear (Bishop) on Mar 14, 2007 at 01:05 UTC
|
The last time I was at loose ends in an airport I was working my way through Effective Perl Programming, Hall & Schwartz, for the second time. If I were stranded today, I have Advanced Perl Programming, 2nd Ed., Simon Cozens, in the back-pack. I like to have something useful to read when I am taking a take a sanity break from work. (My Boss thinks I just go find an out-of-the-way table and think Deep Thoughts About Work when I go on breaks....)
----
I Go Back to Sleep, Now.
OGB
| [reply] |
|
OGB said: (My Boss thinks I just go find an out-of-the-way table and think Deep Thoughts About Work when I go on breaks....)
That's such a strange phenomenon, but it's a very useful one. My (slightly)PHB has a similar misconception. Since I often come back from breaks with good ideas to sticky problems, he has come to believe that my breaks involve me disappearing to puzzle on Deep Matters of the Project.* Naturally, it follows that I need to take more breaks. ;-)
*: In reality, I go for a walk by the river (nearby); or, in colder weather, perhaps retire to a conference room (we have no lounge) with a fresh cuppa and my Nintendo DS. It's the relaxation that helps me percolate the good ideas. ;-)
<–radiant.matrix–>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet
| [reply] |
Re: Top 10 things to read when your flight is canceled
by zerogeek (Monk) on Mar 13, 2007 at 16:21 UTC
|
| [reply] |
|
Sorry for the confusion. The original title was "...Perl things to read..." but I didn't think it sounded as good and I didn't want to limit the replies too much.
In all honesty, I spent the first leg of the flight reading the newspaper and Perl Best Practices. :-)
| [reply] |
Re: Top 10 things to read when your flight is canceled
by Moriarty (Abbot) on Mar 14, 2007 at 07:47 UTC
|
Given that it's been quite a while since I flew anywhere, and considering that I can't take my craft on a plane (for some reason crochet hooks are considered lethal weapons), I guess I would have to go with a couple of computer magazines, a crossword book and a book of Sudoku and Karuku puzzles (why are pens allowed? Aren't they mightier than the sword?).
Update: Corrected typos
| [reply] |
Re: Top 10 things to read when your flight is canceled
by andyford (Curate) on Mar 13, 2007 at 20:49 UTC
|
| [reply] |
Re: Top 10 things to read when your flight is canceled
by DrHyde (Prior) on Mar 14, 2007 at 10:19 UTC
|
I'd read a book. When travelling I always carry several.
I'd also not fly, because it's such a gigantic pain in the arse. Take the train instead when possible. Only fools fly when there's an alternative.
| [reply] |
|
I had 10 really short flights last year (20 minutes tops) and I can tell you that it's not flying that sucks, it's the airports. Technically I was at the airport all day for each one, but it was really more like a beach party than a lobby.
| [reply] |
Re: Top 10 things to read when your flight is canceled
by greatshots (Pilgrim) on Mar 14, 2007 at 10:12 UTC
|
I relax my soul and mind to the maximum when my flight is cancelled. | [reply] |
Re: Top 10 things to read when your flight is canceled
by valdez (Monsignor) on Mar 18, 2007 at 17:45 UTC
|
That happened to me many times during last year, because my work now is split between Italy and China. The average layover is 5 hours, so I have plenty of time to read and program!
The most important discoveries were definitely Net::Server and Net::Server::Mail, they transformed some daunting tasks into a real programming pleasure!
Next modules on my list are Attribute::Handlers, Params::Validate and Config::General::Validate.
The second discovery was a bookshop in the center of Beijing, where I buy O'Reilly books that are useful after my laptop battery runs out: they are so cheap that I tend to read even topics not related to my job (ie. AI for Game Developers).
| [reply] |