Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: archival storage ($/=\)

by mr_mischief (Monsignor)
on Jun 30, 2016 at 18:01 UTC ( #1166946=note: print w/replies, xml ) Need Help??


in reply to Re^3: archival storage ($/=\)
in thread archival storage

Ah. So it seems on rereading very carefully, I've tripped up on some slight ambiguities in this line:

Setting $/ to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer.
That should be read as reference to (integer|scalar containing integer|scalar convertible to an integer) and not as (reference to integer|scalar containing an integer|scalar convertible to an integer). It's not talking about scalar values. It's talking about Perl's idea of Scalar variables, a definitional ambiguity for which I should have been prepared as it's peppered through the Perl documentation that way. The "reference to" part covers all three cases in the list, a structural ambiguity that I should have tested out.

So in trying to golf out three characters and testing edge cases insufficiently (IIRC I tested with all alpha text) I ended up with a bug on my arm. Again, if clear but still shortened was the goal I'd have just gone with undef$/, but $/=\-1; is pretty nice. It still comes down to trying to be overly clever. It's a minimal code change to fix it and the code still makes its intended point with or without the bug.

Just please forgive me if I don't patch the hardcopy right away...

Replies are listed 'Best First'.
Re^5: archival storage (patches)
by tye (Sage) on Jun 30, 2016 at 19:50 UTC

    Yeah, that is badly ambiguous. Thanks for quoting it. I think it also suffers from stressing unimportant aspects too much, making it more confusing beyond the ambiguity. The minimal change I'd make would be to go more like:

    Setting $/ to a reference to an integer (or a reference to a scalar that contains an integer or that is convertible to an integer) will attempt to read records instead of lines, with the maximum record size being the referenced integer.

    You should submit a doc patch request.

    Just please forgive me if I don't patch the hardcopy right away...

    I seriously considered not posting at all, going back and forth several times before finally deciding. I liked your tattoo (that you recently linked to a photo of in chatter) but I didn't understand what $/-- was meant to do so I went looking for some context. It is still a great tattoo. Now you just know that it has some extra "character" and of a variety that most will be completely unaware of. In some ways that makes it more interesting, more subtle.

    IMHO, you don't need to ever patch the hardcopy. I'm still jealous that you came up with such a cool tattoo idea and I'm still waiting to come up with one cool enough for me to do.

    - tye        

      I was actually thinking of adding to it. A red - before the current line and a green + before a debugged one. I'm not sure I'll change it yet, but if I do that's how.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1166946]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2018-02-20 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (271 votes). Check out past polls.

    Notices?