Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Silly errors repeated from time to time

by strat (Canon)
on Oct 14, 2002 at 09:38 UTC ( [id://205014]=perlmeditation: print w/replies, xml ) Need Help??

Dear monks,

I am doing the following stupid error from time to time again:
I edit one file but execute another one with the same name and wonder why the changes are not working. One reason for it is that I always create a backup of a script before editing, and if I haven't got any version management tool, I just do it manually by copying it to a special subdirectory (e.g. like backups/backup2002_10_14-09_12/ ). Another one are different PATH-settings for different users (e.g. I switch user for a certain action, then go off for lunch and when I return I forgot about it).

Do you do similar errors from time to time? What are they? And how do you try to prevent them?

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

  • Comment on Silly errors repeated from time to time

Replies are listed 'Best First'.
Re: Silly errors repeated from time to time
by joe++ (Friar) on Oct 14, 2002 at 10:57 UTC
    Familiar problem, but I learnt to cope with it in a very early stage the hard way...

    I named a Perl script plainly "test" and thought to execute is by typing "test" in a bourne shell. It was only one hour later that I learnt about the shell builtin test and to always prefix a local script/program name with a dot-slash, like "./test" or whatever. On a side note, on unix, user root shouldn't even have the working directory in its PATH for security reasons...

    By always explicitly invoking the command in the (current) directory you shouldn't get too many surprises IMHO (and yes, using a real version management system is the way to go - familiarising oneself with the somewhat arkane CVS syntax pays very much in the longer run).

    --
    Cheers, Joe

      IMO, it's not just root who shouldn't have "." in their PATH.

      Abigail

Re: Silly errors repeated from time to time
by JaWi (Hermit) on Oct 14, 2002 at 09:54 UTC
    Yep, I also faced the same problem; especially when hacking on a script locally and forget the changed file to upload. This one always lets me shout and curse ;-)

    I've taught myself to use CVS for almost everything. How many times this has saved my butt I can't tell you, but it's been a lot! Unfortunately, this does not help you with the problem I sketched above.
    To address this, I wrote a simple bash which takes the name of the file I'm editting. It sleeps normally for 15 seconds, peeks wheter the file has been modified, and if so, uploads it to its remote place. It saves me a lot of time, that I can assure you... (it is also never been so quite in my home :-)

    -- JaWi

    "A chicken is an egg's way of producing more eggs."

Re: Silly errors repeated from time to time
by physgreg (Scribe) on Oct 14, 2002 at 10:53 UTC
    In our shop there are two directories of code: src and bin. The classic mistake is altering something in the bin directory and then swearing when you overwrite it by doing make install.

    On a slightly different note, do you find that moving from language to language introduces a lot of silly mistakes? I often switch betweeen TCL/TK and Perl, and end up forgetting ';' in Perl and putting too many '$' charaters in TCL.

Re: Silly errors repeated from time to time
by Popcorn Dave (Abbot) on Oct 14, 2002 at 21:04 UTC
    I ran in to a similar problem when I was taking a Perl class a while ago. Sometimes I would be doing my work at work and other times at home, and forget to transfer "the current version" of whatever I was working on. Major pain in the ass.

    Now, whatever project I'm working on goes in to an FTP directory so that I can grab the latest version of anything off any machine I'm working on. It does the job for me and I haven't run in to that problem since.

    There is no emoticon for what I'm feeling now.

Re: Silly errors repeated from time to time
by hossman (Prior) on Oct 14, 2002 at 21:34 UTC

    I've gotten in the habit of running the following whenever I log into an account that isn't mine, or sit down at someone elses terminal to help them with something...

    some silly prompt#>tcsh some slightly different prompt>source ~hossman/.cshrc username@host:path>

    The last prompt is because of htis line in my .cshrc file...

    set prompt = "%m:%~%# " if (`whoami` != "hossman" ) then set prompt "%n@%m:%~%# " endif

    why do i do this you ask?

    • I allways know exactly what my PATH, and all of my other environment settings are (they're what I'm allways used to)
    • I allways know exactly what directory I'm in (in the prompt)
    • I allways know exactly who I am (if i'm not me, it says so in my prompt)

Re: Silly errors repeated from time to time
by John M. Dlugosz (Monsignor) on Oct 14, 2002 at 20:26 UTC
    I've done that from time to time. When I suspect old or wrong versions, I just search the drive for that file name.

    For your backup, why not rename the file as well, by adding a .backup to it or somesuch?

    For multiple users' settings, put an indication in your prompt, or color code, or something.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found