Field of Science

Not as simple a task as it should have been

Before he left last night the undergrad sent me what should be a fully functional version of our USS model, with the desired new features all working (they're described here).  But I just tried to run it on my home computer and absolutely nothing happens.  I enter "perl USSv4a.pl" at the Terminal prompt, and I just get another terminal prompt.

The problem is likely with the computer, not the program.  This is the first program I've tried to run on it since I replaced the hard drive a few months ago - as everything on the old drive was lost I was effectively starting from scratch.  I don't think I need to install perl - I've never had to do that before.  The USSv4a.pl file is in the Rosie directory, as is the settings.txt file it calls.  I could create a 'Hello World' perl file to test that perl is working but my perl book is at my office; maybe I can find one online ('Hello World' file, not perl book).

Yes I can (it's just one line), but now I discover that TextEdit will only save files as rtf, html, word and wordxml!  Wtf?  Guess I'd better install Komodo Edit.  OK, I remember that finding a Komodo Edit download site took a bit of looking (Komodo IDE was easy to find but costs a bundle), but Google found a site for downloading Komodo Edit.  Unfortunately what this has given me has a '.msi' suffix, and my Mac doesn't know what to do with it.  On looking more carefully at the source site, I see that it says something about bittorrent, which I don't know how to use.  Back to Google - OK, a site offering a Mac version, which is coming in (very slowly) as '.dmg'.

OK, got Komodo Edit, in Applications folder, opening for first time involves 'pre-loading' various bells and whistles, Mac gets VERY HOT (Fan Control maxed out).

OK, I created the Hello World file, and it ran fine.  Hmm, maybe there IS something wrong with the USSv4a.pl program.  Well, now I have Komodo Edit so I can take a look at it.  It looks fine, so I created a 'test' version with Hello World print lines at various places.  None of them gets printed.  I see that the undergrad has inserted a 'die' reporting step if the program can't open its settings file, so I think that's not the problem.  Instead Terminal acts as if the USSv4a.pl file and the new USSv4atest.pl file don't exist.

Back to the original USSv4a.pl file; now Komodo is claiming that every line fails to end with the expected "LF" end-of-line marker, but when I have it show the markers they all look fine.  The USSv4atest.pl file markers look exactly the same, and Komodo has no problem with them.

Time to quit working on this for now.  Maybe I'll send an email to the undergrad, or maybe I'll just wait till I get to my office (maybe not till tomorrow) and try to run it there.

6 comments:

  1. As I mentioned, if you paste the code in one webpage someone would be able to help more.

    You can also try running perl -d to debug the script.

    ReplyDelete
  2. Komodo Edit is very easy to obtain directly from ActiveState. ActiveState's home page, at http://activestate.com/, has a link at the bottom left of the page.

    Another good free code editor for the Mac is TextWrangler, which is available at http://bbedit.com/products/textwrangler/.

    Finally, you can use TextEdit to create a new Perl script. When you create a new file with TextEdit, click on the Format menu and select Make Plain Text. However, I think you should use TextEdit only as a last resort because both Komodo and TextWrangler have features that make writing code much easier.

    ReplyDelete
  3. Hi Nuin,

    It's nice of you to offer to read the code, but I don't want you (and other readers) to think of my posts as cries for help. Not that I don't appreciate suggestions... I guess it's hard to find the right balance.

    I've solved the problem. As usual, it was the line feeds. The files (program and settings) had been sent to me as email attachments, and they had somehow acquired Mac line feeds rather than Unix line feeds. It took me a little while to work out how Komodo controls line feed settings.

    Rosie

    ReplyDelete
  4. When it comes to code testing and debugging it is always handy to have a couple of different systems to test the code on. It can be two different Linux installations, Linux and Mac, Mac and Windows or any other combination.

    I understand the posts are not "cries for help" but sometimes just the fact of successfully running the code in another machine can give you immediately the hint that it is a different format of the carriage return.

    ReplyDelete
  5. Sure, having another system to test my code on would be handy, but revising my life so that I have such a system and know how to use it would be a nightmare.

    ReplyDelete
  6. A different system does not mean a different computer or learning to use another OS. Even a computer from a friend, post-doc, collaborator, etc might come handy. There are ways of booting Windows on Macs too, and one does not need to revise his/her life in order to do that.

    Another option is to ask for help in discussion lists, newsgroups, etc. But then you would need to give your code ...

    ReplyDelete

Markup Key:
- <b>bold</b> = bold
- <i>italic</i> = italic
- <a href="http://www.fieldofscience.com/">FoS</a> = FoS