Re: confusing bulltes

2004-01-12 Thread Chris Devers
On Sun, 11 Jan 2004, Oliver Schnarchendorf wrote:

 Okay... I think the problem here is that BBEdit doesn't use your
 Environmental variables.

 You can print them with the following one liner

   perl -e 'use Data::Dumper; print Dumper (\%ENV);'

 Do yourself a favor and put the above perl into a script []

Maybe I'm being naive, but in what way is this better than just using
plain old /usr/bin/env?

$ perl -e 'use Data::Dumper; print Dumper (sort \%ENV);' | head
$VAR1 = {
  'CVSROOT' = '/usr/local/cvsrep',
  'MANPATH' = '/sw/share/man:/usr/share/man:/usr/X11R6/man',
  'HOSTTYPE' = 'powermac',
  'MACHTYPE' = 'powerpc',
  'SECURITYSESSIONID' = '860df50',
  'SGML_CATALOG_FILES' = '/sw/etc/sgml/catalog',
  'GROUP' = 'staff',
  'HOME' = '/Users/cdevers',
  'TERM' = 'xterm-color',

$ env | sort | headANT_HOME=/sw/lib/ant
CVSEDITOR=/sw/bin/vim
CVSROOT=/usr/local/cvsrep
DISPLAY=:0.0
EDITOR=/sw/bin/vim
GROUP=staff
HOME=/Users/cdevers
HOST=Booker.local
HOSTTYPE=powermac
INFOPATH=/sw/share/info:/sw/info:/usr/share/info

etc.

I can see that the output isn't identical; is the point of the
Data::Dumper one liner that you just want the %ENV data as Perl sees it,
and not as you have in a regular shell?



-- 
Chris Devers
had plumbing problems last night,
didn't get enough sleep to be
thinking altogether clearly


Re: confusing bulltes

2004-01-12 Thread Oliver Schnarchendorf
On Mon, 12 Jan 2004 09:38:09 -0500 (EST), Chris Devers wrote:
 On Sun, 11 Jan 2004, Oliver Schnarchendorf wrote:
  perl -e 'use Data::Dumper; print Dumper (\%ENV);'
 Maybe I'm being naive, but in what way is this better than just using
 plain old /usr/bin/env?
It was a perl question... not a shell question.

The reason that I asked Vic to run this code snippet in the terminal as in BBEdit was 
to find out if Vic has differnces in the enironment variables that might screw up his 
perl code.

/oliver/



Re: confusing bulltes

2004-01-11 Thread Vic Norton
I'm sorry for all the confusion. Let me try one last time.

I have a perl file with a single chunk of data produced by typing 
option-8 after __DATA__. So the end of the file looks like this:

__DATA__
option-8
When I look at this file with HexEdit, option-8 appears as A5.

My actual script looks for the pattern m/\xa5/ in the data. If I 
make the script executable and run it from the terminal, it finds 
A5. If I execute the script from BBEdit, either directly or Run in 
Terminal, no A5 is found.

When I write another script to print out the bytes under __DATA__, I see
A5 if I execute the script from Terminal, and I see E2 80 A2 if I 
run the script fom BBEdit, either directly or Run in Terminal. But 
BBEdit can see A5. It just can't see it as DATA. If I write a 
script to look for A5 in the file that contains the single option-8 
data element and run the script from BBEdit, BBEdit has no trouble 
spotting the A5 at the end of the file.

Sorry to be such a bore! Now I quit.

Regards,

Vic


Re: confusing bulltes

2004-01-11 Thread Oliver Schnarchendorf
On Sun, 11 Jan 2004 21:02:14 -0500, Vic Norton wrote:
 
 My actual script looks for the pattern m/\xa5/ in the data. If I 
 make the script executable and run it from the terminal, it finds 
 A5. If I execute the script from BBEdit, either directly or Run in 
 Terminal, no A5 is found.
 
Okay... I think the problem here is that BBEdit doesn't use your Environmental 
variables.

You can print them with the following one liner

perl -e 'use Data::Dumper; print Dumper (\%ENV);'

Do yourself a favor and put the above perl into a script, run it from the command line 
and run it from BBEdit. If you see differences you might want to read up on the 
.MacOSX/environment.plist file and how it is used.

http://developer.apple.com/qa/qa2001/qa1067.html

If you don't want to go through the steps mentioned in the article above, you might 
want to follow the steps in the following use.perl journal entry by brian d foy.

http://use.perl.org/~brian_d_foy/journal/8915

/oliver/



Re: confusing bulltes

2004-01-11 Thread Peter N Lewis
At 9:02 PM -0500 11/1/04, Vic Norton wrote:
When I write another script to print out the bytes under __DATA__, I see
A5 if I execute the script from Terminal, and I see E2 80 A2 if 
I run the script fom BBEdit, either directly or Run in Terminal. 
But BBEdit can see A5. It just can't see it as DATA. If I write 
a script to look for A5 in the file that contains the single 
option-8 data element and run the script from BBEdit, BBEdit has no 
trouble spotting the A5 at the end of the file.
When you 'run the script from BBEdit, either directly or Run in 
Terminal.', what actually happens is BBEdit saves the file in a 
temporary file and then executes it.

It would seem that BBEdit is saving the temporary file in UTF8 format 
rather than the specified format.

Actually, check your BBEdit preferences for Text Files: Opening, and 
also Saving.  There is a configuration in there for Default Text 
Encoding and Guessing Text Encoding.  It seems when BBEdit saves the 
temporary file, these are used instead of the current file's text 
encoding.

Enjoy,
   Peter.
--
http://www.interarchy.com/  http://documentation.interarchy.com/


Re: confusing bulltes

2004-01-11 Thread Jim Correia
On Jan 11, 2004, at 9:55 PM, Peter N Lewis wrote:

When you 'run the script from BBEdit, either directly or Run in 
Terminal.', what actually happens is BBEdit saves the file in a 
temporary file and then executes it.
Not always. If the editing window is unsaved, or has non-native line 
endings, or a non-native encoding (see below.)

It would seem that BBEdit is saving the temporary file in UTF8 format 
rather than the specified format.
This can be controlled by the checkbox in the Unix Scripting prefs.

Jim