Re: MacPerl INC question

2004-02-05 Thread John Delacour
At 10:48 pm -0500 4/2/04, [EMAIL PROTECTED] wrote:

Interestingly, the problem I was trying to solve with MacPerl's 
SetFileInfo is still open. Once Perl set the creator/type...
At 6:23 pm -0500 3/2/04, [EMAIL PROTECTED] wrote:

MacPerl::SetFileInfo('CARO', 'PDF', $path);
Is that precisely what you are writing?  If so then you need 4 bytes 
in the file type and I guess it should be 'PDF '

JD



Re: MacPerl INC question

2004-02-05 Thread AWLeverenz

In a message dated 2/5/04 12:37:24 AM, [EMAIL PROTECTED] writes:

 
  So my next question is: What is Acrobat doing when opening a file that
  SetFileInfo isn't?
 
 Setting the correct file type?  :^)
 
 According to your previous message, you're doing this:
 
     MacPerl::SetFileInfo('CARO', 'PDF', $path);
 
 HFS file and creator types are four-bytes long; the file type for
 PDF is PDF , with a trailing space, not PDF. So try changing the
 above line to:
 
     MacPerl::SetFileInfo('CARO', 'PDF ', $path);
 
 and I think you'll be set.
 
 
Right you are. Thanks for reminding me that it's the small things in life 
that matter... and it's a spaceband.

-Alan


Re: MacPerl INC question

2004-02-04 Thread Chris Nandor
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:

 #!perl
 
 use strict;
 use warnings;
 
 my ($folder,$x,$file,$path);
 my @files;
 
 $folder = :pdf:;

This won't work in Mac OS X.  You must use Unix paths.

 opendir(PDF, $folder) || die $!;
 @files = readdir(PDF);
 close(PDF);
 
 for $x (0..$#files) {
 $file = $files[$x];
 $path = $folder . $file;
 if (-f $path) {
 MacPerl::SetFileInfo('CARO', 'PDF', $path);
 } # END FOR

You can use the MacPerl module under Mac OS X, if you install it.  Use the 
CPAN shell:

   % perl -MCPAN -e shell
   cpan install MacPerl

See man perlmodinstall for more information.

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/


Re: MacPerl INC question

2004-02-04 Thread Sherm Pendley
On Feb 3, 2004, at 6:23 PM, [EMAIL PROTECTED] wrote:

I've written the following to sweep a folder and set creator/type for 
pdf
files (coming off a Linux server).
Standard caveat: Creator/type has been deprecated for Mac OS X, so you 
really shouldn't need to do this unless these files either lack a 
proper .pdf extension, or will be used by Macs running older OSes.

This works from MacPerl, but I really need
to run it from OSX Perl. How do I get Perl to use MacPerl.pm, which 
@INC can't
Mac OS X doesn't need a special Perl - it comes with the standard UNIX 
Perl. What you need now is the Mac::Carbon package, which includes the 
MacPerl module.

See 'perldoc perlmodinstall' for details, but in a nutshell what you do 
is download the module from cpan.org (or a mirror site), unpack it 
(StuffIt should work), and then open a Terminal window and navigate to 
the unpacked directory. In the terminal window you want to run a series 
of four commands:

perl Makefile.PL
make
make test
make install
Make sure to review the output from make test before proceeding to 
make install - you may not want to install the module if the 
self-tests fail.

If you find yourself needing more than a handful of modules, you'll 
probably want to use the CPAN shell. It automates the process of 
downloading, testing, and installing most modules, handling 
dependencies, etc. I wrote a rather lengthy spiel about it just a 
couple of days ago, in a thread titled 'many module questions'. You can 
find it in the archives at 
http://www.mail-archive.com/macosx%40perl.org/

sherm--



Re: MacPerl INC question

2004-02-04 Thread Ken Williams
On Tuesday, February 3, 2004, at 05:23  PM, [EMAIL PROTECTED] wrote:

I've written the following to sweep a folder and set creator/type for 
pdf
files (coming off a Linux server).   This works from MacPerl, but I 
really need
to run it from OSX Perl. How do I get Perl to use MacPerl.pm, which 
@INC can't
locate? ( #!/usr/bin/perl   use MacPerl; ... ).
If you install MacPerl.pm in the obvious way, then it should be 
found.  Otherwise, if you install it in an alternate location, then you 
can do:

 use lib qw(/path/to/where/you/installed/it);
 use MacPerl;
 -Ken



Re: MacPerl INC question

2004-02-04 Thread AWLeverenz

 I've written the following to sweep a folder and set creator/type for 
 pdf
 files (coming off a Linux server).   This works from MacPerl, but I 
 really need
 to run it from OSX Perl. How do I get Perl to use MacPerl.pm, which 
 @INC can't
 locate? ( #!/usr/bin/perl   use MacPerl; ... ).

If you install MacPerl.pm in the obvious way, then it should be 
found.  Otherwise, if you install it in an alternate location, then you 
can do:

  use lib qw(/path/to/where/you/installed/it);
  use MacPerl;
Thanks for pointing me in the right direction. Interestingly, the problem I 
was trying to solve with MacPerl's SetFileInfo is still open. Once Perl set the 
creator/type, the file was still not fully recognized as belonging to that 
application (no icon, and not recognized by the Classic application).

It seems that the means for associating the creator/type with this 
application (Acrobat 5) is either through the Get Info (Opens with...) window (this 
works in Jaguar), or by simply opening it first with the application (this works 
in Panther). So for the moment, I'm relying on AppleScript to tell the 
application to open the file to get it fully associated.

So my next question is: What is Acrobat doing when opening a file that 
SetFileInfo isn't?

-Alan


Re: MacPerl INC question

2004-02-04 Thread John Gruber
[EMAIL PROTECTED] wrote on 2/4/04 at 10:48p:

 So my next question is: What is Acrobat doing when opening a file that 
 SetFileInfo isn't?

Setting the correct file type?  :^)

According to your previous message, you're doing this:

MacPerl::SetFileInfo('CARO', 'PDF', $path);

HFS file and creator types are four-bytes long; the file type for
PDF is PDF , with a trailing space, not PDF. So try changing the
above line to:

MacPerl::SetFileInfo('CARO', 'PDF ', $path);

and I think you'll be set.

Hope this helps,

-- 
John Gruber  |  Daring Fireball
[EMAIL PROTECTED]|http://daringfireball.net