Re: openning file...

2006-04-02 Thread kurtz le pirate
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Sherm Pendley) wrote:

 The wanted function only gets the file name of the file, which is not  
 enough to open the file with, if it's in a subdirectory. Try calling  
 open() with the full path to the file, not just the file name alone.

sory but you're wrong. File::Find doc say : ...you are chdir()'d 
to$File::Find::dir when the function is called,unless no_chdir was 
specified.

thanks


-- 
klp


Re: openning file...

2006-04-02 Thread Ken Williams


On Apr 1, 2006, at 2:49 AM, kurtz le pirate wrote:


hello,

mac os x store file name in utf-8 format. so, how to open file with
special characters in name ?

a very simple exemple is a file name that begin with space. if i  
write :

open(FILE, Read in a file), perl return an error:
  *** can't open [ Read in a file] : No such file or directory


That's just because open() trims whitespace from the front of the  
argument.  See the open() docs in perlfunc:


--
...
The filename passed to 2-argument (or 1-argument) form of open() will
have leading and trailing whitespace deleted, and the normal
redirection characters honored.  This property, known as magic open,
can often be used to good effect.  A user could specify a filename of
Frsh cat file |, or you could change certain filenames as needed:

$filename =~ s/(.*\.gz)\s*$/gzip -dc  $1|/;
open(FH, $filename) or die Can't open $filename: $!;

Use 3-argument form to open a file with arbitrary weird characters in  
it,


open(FOO, '', $file);

otherwise it's necessary to protect any leading and trailing whitespace:

$file =~ s#^(\s)#./$1#;
open(FOO,  $file\0);
...
--

The 3-argument form of open() is definitely preferred.

 -Ken



Re: openning file...

2006-04-02 Thread Joel Rees


On 2006.4.2, at 10:34 PM, kurtz le pirate wrote:


In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Sherm Pendley) wrote:


The wanted function only gets the file name of the file, which is not
enough to open the file with, if it's in a subdirectory. Try calling
open() with the full path to the file, not just the file name alone.


sory but you're wrong. File::Find doc say : ...you are chdir()'d
to$File::Find::dir when the function is called,unless no_chdir was
specified.

thanks


--
klp



mind-boggling



Re: openning file...

2006-04-02 Thread kurtz le pirate
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Ken Williams) wrote:

 On Apr 1, 2006, at 2:49 AM, kurtz le pirate wrote:
 
  hello,
 
  mac os x store file name in utf-8 format. so, how to open file with
  special characters in name ?
 
  a very simple exemple is a file name that begin with space. if i  
  write :
  open(FILE, Read in a file), perl return an error:
*** can't open [ Read in a file] : No such file or directory
 
 That's just because open() trims whitespace from the front of the  
 argument.  See the open() docs in perlfunc:
 
 --
 ...
 The filename passed to 2-argument (or 1-argument) form of open() will
 have leading and trailing whitespace deleted, and the normal
 redirection characters honored.  This property, known as magic open,
 can often be used to good effect.  A user could specify a filename of
 Frsh cat file |, or you could change certain filenames as needed:
 
  $filename =~ s/(.*\.gz)\s*$/gzip -dc  $1|/;
  open(FH, $filename) or die Can't open $filename: $!;

that is i found too !!



 Use 3-argument form to open a file with arbitrary weird characters in  
 it,
 
  open(FOO, '', $file);
 
 otherwise it's necessary to protect any leading and trailing whitespace:
 
  $file =~ s#^(\s)#./$1#;
  open(FOO,  $file\0);

humm... in the wanted function i write :
065:  sub process {
066:if (-f $_) {
067:  $_ =~ s/ /\ /g;
068:  my $thisSize = stat($_)-size;
069:  if($thisSize0) {
070:if (open (INPUT,,$_)) {
071:...
... and that works. what think about it?
 
 --
 
 The 3-argument form of open() is definitely preferred.

yes. i always use this form. when i post, i think about about chars 
problems...



   -Ken
thanks 


-- 
klp


problems with intel architecture

2006-04-02 Thread Cheryl Chase
I'm a casual perl user. I just upgraded from a PPC OSX machine to a  
MacBook Pro, and I can't get perl to work right for me.


I used the Apple Migration Assistant to move my data from my PPC  
machine to the MacBook Pro.


Trying to run a simple perl script (requiring XML-RPC, DBI, and DBD- 
mysql) with the installed Apple Perl, I get errors like this:


@GlenEllen Fetch % perl walk.pl
Can't load '/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle' for module XML::Parser::Expat: dlopen(/ 
Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/Parser/Expat/ 
Expat.bundle, 1): no suitable image found.  Did find:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle: mach-o, but wrong architecture at /System/ 
Library/Perl/5.8.6/darwin-thread-multi-2level/DynaLoader.pm line 230.

at /Library/Perl/5.8.6/darwin-thread-multi-2level/XML/Parser.pm line 14
Compilation failed in require at /Library/Perl/5.8.6/darwin-thread- 
multi-2level/XML/Parser.pm line 14.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/darwin- 
thread-multi-2level/XML/Parser.pm line 18.
Compilation failed in require at /Library/Perl/5.8.6/RPC/XML/ 
Parser.pm line 85.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/RPC/XML/ 
Parser.pm line 85.
Compilation failed in require at /Library/Perl/5.8.6/RPC/XML/ 
Client.pm line 47.

Compilation failed in require at Confluence.pm line 24.
BEGIN failed--compilation aborted at Confluence.pm line 24.
Compilation failed in require at walk.pl line 2.
BEGIN failed--compilation aborted at walk.pl line 2.
@GlenEllen Fetch %

If I try to install XML-RPC with CPAN, I get a similar kind of failure:

  CPAN.pm: Going to build R/RB/RBERJON/XML-SAX-Expat-0.37.tar.gz

cp Expat.pm blib/lib/XML/SAX/Expat.pm
Manifying blib/man3/XML::SAX::Expat.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e  
test_harness(0, 'blib/lib', 'blib/arch') t/*.t
t/00basicCan't load '/Library/Perl/5.8.6/darwin-thread- 
multi-2level/auto/XML/Parser/Expat/Expat.bundle' for module  
XML::Parser::Expat: dlopen(/Library/Perl/5.8.6/darwin-thread- 
multi-2level/auto/XML/Parser/Expat/Expat.bundle, 2): no suitable  
image found.  Did find:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle: mach-o, but wrong architecture at /System/ 
Library/Perl/5.8.6/darwin-thread-multi-2level/DynaLoader.pm line 230.

at /Library/Perl/5.8.6/darwin-thread-multi-2level/XML/Parser.pm line 14
Compilation failed in require at /Library/Perl/5.8.6/darwin-thread- 
multi-2level/XML/Parser.pm line 14.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/darwin- 
thread-multi-2level/XML/Parser.pm line 18.
Compilation failed in require at /private/var/root/.cpan/build/XML- 
SAX-Expat-0.37/blib/lib/XML/SAX/Expat.pm line 13.
BEGIN failed--compilation aborted at /private/var/root/.cpan/build/ 
XML-SAX-Expat-0.37/blib/lib/XML/SAX/Expat.pm line 13.

Compilation failed in require at t/00basic.t line 3.
BEGIN failed--compilation aborted at t/00basic.t line 3.
t/00basicdubious
Test returned status 255 (wstat 65280, 0xff00)

I tried installing ActiveState Perl, but I get this:

@GlenEllen Fetch % /usr/local/ActivePerl-5.8/bin/perl walk.pl
install_driver(mysql) failed: Can't load '/usr/local/ActivePerl-5.8/ 
lib/site_perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/ 
mysql.bundle' for module DBD::mysql: dlopen(/usr/local/ActivePerl-5.8/ 
lib/site_perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/ 
mysql.bundle, 1): no suitable image found.  Did find:
/usr/local/ActivePerl-5.8/lib/site_perl/5.8.8/darwin-thread- 
multi-2level/auto/DBD/mysql/mysql.bundle: unknown file type, first  
eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 at /usr/local/ 
ActivePerl-5.8/lib/5.8.8/darwin-thread-multi-2level/DynaLoader.pm  
line 230.

at (eval 12) line 3
Compilation failed in require at (eval 12) line 3.
Perhaps a required shared library or dll isn't installed where expected
at walk.pl line 24
@GlenEllen Fetch %


Arggh! What's the right way to get my perl environment working on OSX  
10.4.5 Intel Core Duo architecture? Do I need to install a parallel  
version of perl from source?


THanks,

Cheryl



Re: problems with intel architecture

2006-04-02 Thread Edward Moy
A native intel program can't load a ppc binary (like Expat.bundle).   
Similarly, a ppc program running in Rosetta can't load an intel  
binary.  In the native or Rosetta environments, there can be no  
mixing of binaries.


You should probably move aside (or remove) the stuff in /Library/Perl/ 
5.8.6 (leaving the AppendToPath file), or at least the ones that  
have .bundle files.  Then you'll have to reinstall those CPAN modules.
 
--

Edward Moy
Apple Computer, Inc.
[EMAIL PROTECTED]

(This message is from me as a reader of this list, and not a statement
from Apple.)

On Apr 2, 2006, at 3:19 PM, Cheryl Chase wrote:

I'm a casual perl user. I just upgraded from a PPC OSX machine to a  
MacBook Pro, and I can't get perl to work right for me.


I used the Apple Migration Assistant to move my data from my PPC  
machine to the MacBook Pro.


Trying to run a simple perl script (requiring XML-RPC, DBI, and DBD- 
mysql) with the installed Apple Perl, I get errors like this:


@GlenEllen Fetch % perl walk.pl
Can't load '/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle' for module XML::Parser::Expat: dlopen(/ 
Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/Parser/Expat/ 
Expat.bundle, 1): no suitable image found.  Did find:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle: mach-o, but wrong architecture at / 
System/Library/Perl/5.8.6/darwin-thread-multi-2level/DynaLoader.pm  
line 230.
at /Library/Perl/5.8.6/darwin-thread-multi-2level/XML/Parser.pm  
line 14
Compilation failed in require at /Library/Perl/5.8.6/darwin-thread- 
multi-2level/XML/Parser.pm line 14.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/darwin- 
thread-multi-2level/XML/Parser.pm line 18.
Compilation failed in require at /Library/Perl/5.8.6/RPC/XML/ 
Parser.pm line 85.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/RPC/XML/ 
Parser.pm line 85.
Compilation failed in require at /Library/Perl/5.8.6/RPC/XML/ 
Client.pm line 47.

Compilation failed in require at Confluence.pm line 24.
BEGIN failed--compilation aborted at Confluence.pm line 24.
Compilation failed in require at walk.pl line 2.
BEGIN failed--compilation aborted at walk.pl line 2.
@GlenEllen Fetch %

If I try to install XML-RPC with CPAN, I get a similar kind of  
failure:


  CPAN.pm: Going to build R/RB/RBERJON/XML-SAX-Expat-0.37.tar.gz

cp Expat.pm blib/lib/XML/SAX/Expat.pm
Manifying blib/man3/XML::SAX::Expat.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e  
test_harness(0, 'blib/lib', 'blib/arch') t/*.t
t/00basicCan't load '/Library/Perl/5.8.6/darwin-thread- 
multi-2level/auto/XML/Parser/Expat/Expat.bundle' for module  
XML::Parser::Expat: dlopen(/Library/Perl/5.8.6/darwin-thread- 
multi-2level/auto/XML/Parser/Expat/Expat.bundle, 2): no suitable  
image found.  Did find:
/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/XML/ 
Parser/Expat/Expat.bundle: mach-o, but wrong architecture at / 
System/Library/Perl/5.8.6/darwin-thread-multi-2level/DynaLoader.pm  
line 230.
at /Library/Perl/5.8.6/darwin-thread-multi-2level/XML/Parser.pm  
line 14
Compilation failed in require at /Library/Perl/5.8.6/darwin-thread- 
multi-2level/XML/Parser.pm line 14.
BEGIN failed--compilation aborted at /Library/Perl/5.8.6/darwin- 
thread-multi-2level/XML/Parser.pm line 18.
Compilation failed in require at /private/var/root/.cpan/build/XML- 
SAX-Expat-0.37/blib/lib/XML/SAX/Expat.pm line 13.
BEGIN failed--compilation aborted at /private/var/root/.cpan/build/ 
XML-SAX-Expat-0.37/blib/lib/XML/SAX/Expat.pm line 13.

Compilation failed in require at t/00basic.t line 3.
BEGIN failed--compilation aborted at t/00basic.t line 3.
t/00basicdubious
Test returned status 255 (wstat 65280, 0xff00)

I tried installing ActiveState Perl, but I get this:

@GlenEllen Fetch % /usr/local/ActivePerl-5.8/bin/perl walk.pl
install_driver(mysql) failed: Can't load '/usr/local/ActivePerl-5.8/ 
lib/site_perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/ 
mysql.bundle' for module DBD::mysql: dlopen(/usr/local/ 
ActivePerl-5.8/lib/site_perl/5.8.8/darwin-thread-multi-2level/auto/ 
DBD/mysql/mysql.bundle, 1): no suitable image found.  Did find:
/usr/local/ActivePerl-5.8/lib/site_perl/5.8.8/darwin-thread- 
multi-2level/auto/DBD/mysql/mysql.bundle: unknown file type, first  
eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 at /usr/local/ 
ActivePerl-5.8/lib/5.8.8/darwin-thread-multi-2level/DynaLoader.pm  
line 230.

at (eval 12) line 3
Compilation failed in require at (eval 12) line 3.
Perhaps a required shared library or dll isn't installed where  
expected

at walk.pl line 24
@GlenEllen Fetch %

Arggh! What's the right way to get my perl environment working on  
OSX 10.4.5 Intel Core Duo architecture? Do I need to install a  
parallel version of perl from source?