Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Never say never

by Lady_Aleena (Priest)
on May 06, 2015 at 03:37 UTC ( [id://1125791]=perlmeditation: print w/replies, xml ) Need Help??

A thud can be heard throughout the monastery as Lady Aleena's head hits her desk in the scriptorium. Shortly thereafter the sound of breaking glass filters through the monastery's halls as her preconceptions are shattered.

Never say you will never do a thing because, one day, you will do the thing then feel foolish.

Now here is some history and what happened tonight. I said I would never use pipes in my data fields. Tonight I did. Now I am feeling more than foolish. (And I've made more work for myself while trying to make less work for myself.) I just learned my lesson.

If you feel you are about to say "I will never...", stop, think very hard, count to ten, whatever. Just do not say it! One day you will be writing a piece of code, humming a little tune stuck in your head, then you will crash into a wall because you did not take into consideration the exception you just wrote.

Have a nice day!

I started this thought in the CB and continued it here.

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re: Never say never
by Not_a_Number (Prior) on May 06, 2015 at 16:57 UTC

    I'm afraid I don't get this (maybe because I'm not an avid follower of the CB?). Why on earth should one not want to put pipes in a data field? Unless, of course the fields themselves are pipe-separated...

    \|   # <- Ceci n'est pas une pipe

    Update: Just to be clear: my post was not meant to be taken as Lady Aleena bashing (which, BTW, seems to be the preserve of Anonymous Monk). Rather, it was meant to be a request for some context:

    From the OP:

    I said I would never use pipes in my data fields. Tonight I did. Now I am feeling more than foolish. (And I've made more work for myself while trying to make less work for myself.) I just learned my lesson.

    For me, this makes little or no sense out of context. Context that was presumably present in the Chatterbox ('I started this thought in the CB'). Context that should be provided in this thread, in order to make sense of it and to make the OP worthy of Meditations status.

      I think that is the point of the post. The problems come in when you think "Why would you ever want to put X in the data?".

      Thinking "Why would you ever NOT want to (have the option to) put X in the data?" is safer.

      PS: ++ for the !|

      Not_a_Number, sorry, I didn't want to get into the deep dark in my OP.

      A long long time ago, I decided to use pipe separated file to store some of my data. I wrote a little subroutine which would process those files. Everything was good up until last night.

      Last night I was rewriting a group of modules and scripts. A few of my data fields were several paragraphs each (making my data file scroll far off to the right as you can imagine). I decided to process those paragraphs with another subroutine I wrote a while ago, however, it would destroy HTML tags in the paragraphs. I needed to use another home rolled format to insert the tags. I had several HTML anchors in the text, so my home rolled way to show them looks akin to A<some text|href="http://some.link.com">. Now, you see the pipe in the tag? My subroutine which processes my data files was splitting the line at that pipe too.

      Now, I initially chose to use pipe separated files because I did not think to the future where I would use pipes inside a data field. I did not have the home rolled tag parser when I made the decision nor was it even in mind at the time.

      I tried to keep the OP clean of this deep dark history. It appears trying to be general has bitten me. I did not want this thread to turn into a discussion of my coding practices. I was just thinking of how I should not have said "I would never...", and how others should not get into that kind of thinking either about a little thing.

      Just because you are not doing it today and do not have plans to do it tomorrow does not mean you will not to it the day after next. I just wanted to impart that piece of wisdom with as little drama as possible.

      Most of what I have discussed up here is in a node somewhere else on PM. The subroutine I use to parse my data files is on my home node under "The present: Objects". The paragraph parser was discussed in 1059065 and 1062854 (discuss here if you wish). The home rolled tag parser was discussed in 1028657 and 1107051 (discuss here if you wish). I do not know if any of them need further discussion, they work.

      I hope I have provided enough context. Going into it anymore would be going into the pitch black deep dark. I try not to go there often due to how unpopular my code is in some corners of the monastery.

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena
      A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1125791]
Approved by kcott
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-19 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found