How to get started

2004-01-21 Thread manu chao
Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'
I did the chmod step as you can see below

[:~/Desktop] xx% chmod 755 helloWorld.pl
[:~/Desktop] xx% ./helloWorld.pl
./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
Thanks.


Re: How to get started

2004-01-21 Thread Ray Zimmerman
Are you sure you did step 3?  It sounds like you ended up with 
something that isn't a plain text file.

On Jan 21, 2004, at 11:53 AM, manu chao wrote:

Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'
I did the chmod step as you can see below

[:~/Desktop] xx% chmod 755 helloWorld.pl
[:~/Desktop] xx% ./helloWorld.pl
./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
Thanks.

Ray Zimmerman
Director, Laboratory for Experimental Economics and Decision Research
428-B Phillips Hall, Cornell University, Ithaca, NY 14853
phone:  (607) 255-9645   fax: (815) 377-3932


Re: How to get started

2004-01-21 Thread Doug Leffert
On 21 Jan 2004, at 10:53 AM, manu chao wrote:

Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'
I did the chmod step as you can see below

[:~/Desktop] xx% chmod 755 helloWorld.pl
[:~/Desktop] xx% ./helloWorld.pl
./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
Thanks.
Did you follow step 3, Select Format-Make Plain Text, before saving?

/doug



Re: How to get started

2004-01-21 Thread Doug McNutt
At 17:53 +0100 1/21/04, manu chao wrote:
Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'

The web page seems to show a space between the exclamation point and the /.. I have 
never put one there and I'm not sure it's an error to do so.

Try, from Terminal

perl  -w  ../helloWorld.pl

The shell will ignore the shebang (#!) line and go directly to perl. The -w flag turns 
on perl's extra warnings.

Also do a ls -l after you do the chmod to be sure the permissions got changed.

It also wouldn't hurt to do cat  helloWorld.pl just to be sure what you expect is 
there. If it has improper line ends or is in RTF format you'll see it.

echo $PATH

to be sure /usr/bin/ is in your search path

which perl

to be sure perl is actually installed.

-- 
--  There are 10 kinds of people:  those who understand binary, and those who don't 
--


Cocoa::* anyone?

2004-01-21 Thread Adam Turoff
Hi,

I was doing a little hacking around with the AddressBook the other day,
and used PerlObjCBridge to write some glue code to use AddressBook.framework.

It strikes me that it'd be better to put these quick hacks on CPAN
instead of constantly rewriting glue code to use this and other bits of
Cocoa.  Specifically, I'm talking about Perl access to ObjC frameworks,
nothing so ambitious as CamelBones or even GUI apps.

So, is anyone else working in this sandbox?  Is Cocoa::* a good
namespace for modules that provide access to Mac OS X frameworks?

Thanks,

Z.



Re: How to get started

2004-01-21 Thread manu chao
Thanks, no it was something else, I had saved the file as Unicode-16 
(UTF-16), once I saved it in UTF-8 it worked.

It's one of those things you suspect right away but refuse to check 
because UTF 'should' always work, and if it doesn't, it's the fault of 
somebody else.

Ray Zimmerman wrote:

Are you sure you did step 3?  It sounds like you ended up with something 
that isn't a plain text file.

On Jan 21, 2004, at 11:53 AM, manu chao wrote:

Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'
I did the chmod step as you can see below

[:~/Desktop] xx% chmod 755 helloWorld.pl
[:~/Desktop] xx% ./helloWorld.pl
./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
Thanks.

Ray Zimmerman
Director, Laboratory for Experimental Economics and Decision Research
428-B Phillips Hall, Cornell University, Ithaca, NY 14853
phone:  (607) 255-9645   fax: (815) 377-3932





Re: How to get started

2004-01-21 Thread John Delacour
At 5:53 pm +0100 21/1/04, manu chao wrote:

Hi, I just wanted to get started by following the tutorial at
http://www.mactipscafe.com/tip015/
but I get the following error:
'Exec format error. Binary file not executable.'
I did the chmod step as you can see below

[:~/Desktop] xx% chmod 755 helloWorld.pl
[:~/Desktop] xx% ./helloWorld.pl
./helloWorld.pl: Exec format error. Binary file not executable.
Any help would be really appreciated.
1.  Your file must have the shebang #!/usr/bin/perl to be executable
2.  The shebang must be followed by a line feed, NOT a carriage return
3.  The whole file will preferably be delimited with line feeds
4.  It is not necessary to have either the shebang or exec permissions
to run the script using $  perl temp.pl
5.  To run it with ./temp.pl, the file must be executable
6.  If you create the file in a text editor, make sure it is saved as plain
text and with line feeds and not carriage returns
7.  The only place where a line feed is absolutely de rigueur is immediately
after the shebang.
Here's something you can try step by step in the Terminal:



xx:~ jd$ cd /tmp   # go to the tmp directory
xx:/tmp jd$# write a test file ...
xx:/tmp jd$ echo '#!/usr/bin/perl
 print Hello\n
 '  temp.pl
xx:/tmp jd$ cat temp.pl # check the result by reading the file...
#!/usr/bin/perl
print Hello\n
xx:/tmp jd$ perl temp.pl  # Have perl run the script
Hello
xx:/tmp jd$ ./temp.pl  # Try running the script as executable
-bash: ./temp.pl: Permission denied
xx:/tmp jd$ chmod +x temp.pl # Make it executable
xx:/tmp jd$ ./temp.pl # Try again
Hello
xx:/tmp jd$



Re: perl in /usr/bin

2004-01-21 Thread Ken Williams
On Thursday, January 15, 2004, at 02:12  PM, John Delacour wrote:

At 12:57 pm +0100 15/1/04, Stephan Hochhaus wrote:

is the file /usr/bin/perl just a link to /usr/bin/perl5.8.1 and could 
therefore easily replaced by /usr/local/bin/perl5.8.2 (as an 
example)? Or would that break anything?
Provided you install the later version in Apple's default location, 
/usr/bin/perl will be overwritten with perl 5.8.2, 5.8.3 or whatever 
and will be identical to the latest installation.  This is how things 
look in my directory:

-rwxr-xr-x  2 root  wheel987340  8 Jan 19:47 perl
-rwxr-xr-x  1 root  wheel987076  9 Nov 13:56 perl5.8.1
-rwxr-xr-x  1 root  wheel 21924 18 Nov 10:14 perl5.8.2
-rwxr-xr-x  2 root  wheel987340  8 Jan 19:47 perl5.8.3
John: overwritten is the wrong term here, linked would be better - 
your 'perl' and 'perl5.8.3' files are linked to the same inode.  That's 
why they have a 2 in the first numerical column, while the other two 
files have a 1.  Here's an excerpt from `man ls`:

 If the -l option is given, the following information is displayed 
for
 each file: file mode, number of links, owner name, group name, 
number of
 bytes in the file, abbreviated month, day-of-month file was last 
modi-
 fied, hour file last modified, minute file last modified, and the 
path-
 name.

Stephan: there's no way to tell a hard link from a regular file, 
because creating a hard link to an existing file simply creates an 
additional way to access the existing file's inode through a different 
name.  After creating the link, the original file and the new file have 
equal status, neither is subordinate to the other anymore.  To see 
whether two files point to the same inode, you can do `ls -i`.

This is all in contrast to soft links, i.e. symbolic links, which 
point by name to the original file, and remain subordinate to it.  If 
you deleted the original file, a hard link would work fine but a soft 
link wouldn't work anymore.

 -Ken



Re: Need help with a string parsing problem

2004-01-21 Thread Ken Williams
On Sunday, January 18, 2004, at 02:38  PM, Andy Turner wrote:

There some sort of regexp strangeness going on here that I can't grok.
Your script doesn't work for me unless I print out the values of $1 
AND $2.
If I just print out one it doesn't work either.

turner:~$ cat foo.pl
$_ = UA-UI1,3,4,6;
m~(..)\-(..)(\d.+)~;
for $CC( $1 .. $2 ) { for $n ( split /,/, $3 ) { print $CC$n } }
turner:~$ perl foo.pl
01 03 04 06 turner:~$
But oddly, it works if I add a little debuging:

turner:~$ cat foo.pl
$_ = UA-UI1,3,4,6;
m~(..)\-(..)(\d.+)~;
print $1, $2\n;
for $CC( $1 .. $2 ) { for $n ( split /,/, $3 ) { print $CC$n } }
turner:~$ perl foo.pl
UA, UI
UA1 UA3 UA4 UA6 UB1 UB3 UB4 UB6 UC1 UC3 UC4 UC6 UD1 UD3 UD4 UD6 UE1 
UE3 UE4 UE6
UF1 UF3 UF4 UF6 UG1 UG3 UG4 UG6 UH1 UH3 UH4 UH6 UI1 UI3 UI4 UI6 
turner:~$
This is probably because 5.6 expands the whole for(...) list in 
advance, but 5.8 evaluates it lazily.

Or it could be because the $1 and $2 variables weren't being properly 
detected as strings by the .. operator in 5.6 unless they had been used 
in a string context.  But they should pretty much always be strings, 
and I'm not sure I've seen this problem quite like this.

In any case, it's always a little risky to use $1 and friends more than 
1 statement after the regex they come from.  Too many things clobber 
'em at a distance.  To be safer, I'd write that as:

$_ = UA-UI1,3,4,6;
my ($start, $stop, $digits) = m~(..)\-(..)(\d.+)~;
for $CC( $start .. $stop ) { for $n ( split /,/, $digits ) { print 
$CC$n } }

 -Ken