geeky Perl plea
Mar. 29th, 2006 05:47 pmHelp!
I'm trying to get a Perl script wrapped in Platypus to set its working directory to the current one... it has an example using "$1/.." for sh, but I'm a total novice and don't know how to get perl to either do that right away or fold it into a system() call. I just want the script to run a command from the directory it's sitting in (I can't predict what directory the user will drop it in, but the files the command acts on will be in the right relative spots).
If anyone has an idea how to access what Platypus gives to sh as "$1" from Perl, or another way to do this, I'd be much obliged.
I'm trying to get a Perl script wrapped in Platypus to set its working directory to the current one... it has an example using "$1/.." for sh, but I'm a total novice and don't know how to get perl to either do that right away or fold it into a system() call. I just want the script to run a command from the directory it's sitting in (I can't predict what directory the user will drop it in, but the files the command acts on will be in the right relative spots).
If anyone has an idea how to access what Platypus gives to sh as "$1" from Perl, or another way to do this, I'd be much obliged.
no subject
Date: 2006-03-29 11:22 pm (UTC)no subject
Date: 2006-03-30 02:37 am (UTC)That was it, exactly. You've saved me untold hours of trying to figure out a mapping between two languages I only kind of know.
One meta point for you!
no subject
Date: 2006-03-29 11:26 pm (UTC)$1 in Perl is the Regexp back reference from the previous match (can be undefined)
$1 in Shell is the first argument passed to the shell script.
no subject
Date: 2006-03-30 02:40 am (UTC)I now know why $1 resolved to empty space in perl in my case, thanks!
no subject
Date: 2006-03-30 01:22 am (UTC)no subject
Date: 2006-03-30 02:43 am (UTC)You're right, the documentation suffered from a cookbook approach where a "Platypus sends this in the first argument" might've been vaguer but more useful.