Syntactic Confectionery Delight | |
PerlMonks |
OS X troubleshooting help needed - parse filename & open fileby elef (Friar) |
on Oct 17, 2010 at 12:38 UTC ( [id://865794]=perlquestion: print w/replies, xml ) | Need Help?? |
elef has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks, I'm asking you a favour in troubleshooting a perl script on a mac. The part that's broken is the following: the script tells the user to drag and drop the two input files into the console window, it parses the resulting strings to find the folder, filename and extension, checks that the files indeed exist and moves on to open the files and do its thing. This works for me in Windows XP and 7, but in OS X Leopard, it fails to find the files even though the filepath seems to be parsed correctly. I don't have a mac so I can't troubleshoot it myself. Perhaps it's some problem with the encoding the filepath itself is in or the if (-e "file") command I used is wrong in some mysterious way... to be honest, I have no idea what's going on. Backstory: The program is a text aligner that creates parallel corpora out of texts and their translations. It is an open source project that will end up on sourceforge in Windows, linux and mac flavours (I'm using PAR::Packer to package the script and the modules it relies on into an executable). The script is broadly the same for all three platforms, with if/else branching to account for platform-specific issues. The windows executable is done and it works fine, but I ran into problems with getting it to work on a mac. As I don't have a mac, I asked a friend to test it. He tells me the script says it can't find the files, but that's about as far as we got with troubleshooting. I would appreciate any help. A short test script to check basic functionality:
Could some kind monk run this and let me know if one or both tests pass on a mac? The actual aligner script is almost 2K lines and it needs a couple of other bits and pieces to run, so I uploaded the full package to mediafire. It's my first perl project and I'm not a programmer... Let me know if you notice something hideous that should be improved. Everything in there is tested and working on Windows, though. To test on mac OS X, just start LF_aligner_10_12.pl and drag and drop the two pdf files from testfiles. You will get some feedback in the console and a log will also be created in aligner/scripts. The error message it threw in testing is "ERROR! File 1 not found" If you want to have a look at the code itself, the relevant bit starts at "# DRAG & DROP FILES (t, h, p)" around line 400. The code looks about like this (this is just a simplified, cleaned-up sample that won't actually run; to run the script, please get the mediafire package.)
Back to
Seekers of Perl Wisdom
|
|