"Word too long" ? And exactly WHAT word might that be? Curious

S

Sara

I have a script that runs fine, but on invocation in csh or bash or
tcsh or ksh, the script reports:

Word too long

before a single line is executed (I'm starting in the debugger). Other
than that message everything seems fine.

I searched CLPM and in fact saw others report this message, but in
each case they got the message after executing the script on a certain
line. In my case it comes up before execution. There is no line number
or other info reported- just "word too long"..

Can someone advise me on HOW to actually FIND the offending word? With
like 25,000 lines of Perl it's not going to be easy doing a manual
search, particularly when I don't even know what constitutes a "too
long" word!

Thanks,
Gx
 
S

Sara

How can it be that it "runs fine" if it reports an unexpected error? This
sounds suspiciously like your shell is trying to run a perl script
instead of passing it over to perl.

What are the first few lines of your program? (Copy and paste them. DON'T
retype them by hand.)

Chris

hi Chris-

What I mean is aside from the odd message, when I enter "c" at the
DBG> prompt the script takes off and does just what it's supposed to
do. So the only oddity is this message. If not for this strange
message I would't have any indication of a problem.

The begining or the script is the usual fare:

#!/usr/bin/perl -wd

use strict;

use mod1;
 
N

news

Sara said:
I have a script that runs fine, but on invocation in csh or bash or
tcsh or ksh, the script reports:
Word too long
before a single line is executed
What I mean is aside from the odd message, when I enter "c" at the
DBG> prompt the script takes off and does just what it's supposed to
do. So the only oddity is this message.

I can't reproduce this on Solaris 8 or GNU/Linux (bash, csh, ksh on
both platforms), variously with and without the execute bits set. What
OS platform are you running on?

However, my gut feeling is that this is a OS/shell issue. What I
suspect is happening is that your shell (csh, or whatever) is seeing the
#! line and trying to pass the file to the named interpreter (i.e. perl)
itself. At some point during this process the shell has read the entire
file and barfs on a line that it thinks is too long.

You can use perl itself to find and print long lines, on the basis that a
"long word" will probably be in a long line:

perl -ane 'print "$.\t$_" if length > 132' your_file.pl

It shouldn't be that much harder to find long words (I'll leave that to
you :)
The begining or the script is the usual fare:
#!/usr/bin/perl -wd

This /is/ on the first line without any leading spaces, isn't it.

Chris
 
B

bm

I have a script that runs fine, but on invocation in csh or bash or
tcsh or ksh, the script reports:

Word too long

before a single line is executed (I'm starting in the debugger). Other
than that message everything seems fine.

I have seen this happen when environment variables exceed their maximum
length. Is your script modifying %ENV?
 
S

Steve Grazzini

[...] However, my gut feeling is that this is a OS/shell
issue. What I suspect is happening is that your shell
(csh, or whatever) is seeing the #! line and trying to pass
the file to the named interpreter (i.e. perl) itself.

The shell never looks at the shebang -- that's handled by
the kernel during execve().

But since Perl doesn't have a "Word too long" diagnostic,
you're probably correct that a shell is being invoked by
mistake.
 
N

news

Steve Grazzini said:
The shell never looks at the shebang -- that's handled by
the kernel during execve().

For newer shells, yes, that's true. However, on older systems there was
a notorious csh problem that meant /bin/sh scripts had to start with a
colon as the only character on the first line, otherwise it would assume
it had a csh script. Gack.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,137
Latest member
NoelAshwor
Top