Re: MacOSX::File on Panther

2003-10-24 Thread Dan Kogai
On Friday, Oct 24, 2003, at 14:58 Asia/Tokyo, [EMAIL PROTECTED] wrote:
No, it doesn't work for me.  I had tried something similar, but it 
seems that -U only affects a corresponding -D, but not #define in 
files.
Hmm  Right.  Okay.  It seems like I have to work it out which I 
will start right now.  But I have to begin w/ downloading the latest 
seed, burning the CD and install it.  It will take half a day, at 
least, to fix my testbed.  Since Panther release is so close I would 
like to use your patch for last-minute insurance;  Can I post your 
patch in my web?

Dan the Maitainer of MacOSX::File



Reading preferences

2003-10-24 Thread James Reynolds
In BASH, it is really easy to read preferences.  For example, in 
Mac OS X's /etc/rc startup script, it includes a file like so:

. /etc/rc.common

This file also includes /etc/hostconfig like so:

. /etc/hostconfig

So all startup items have access to the variables in /etc/hostconfig like:

SSHSERVER=-YES-
WEBSERVER=-YES-
My question is, can something similar be done in perl?  Or do I have 
to open, read, parse, then close the preference file?

--

Thanks,

James Reynolds
University of Utah
Student Computing Labs
[EMAIL PROTECTED]
801-585-9811


Pashua

2003-10-24 Thread Chris Nandor
Saw this on Ranchero's RSS feed this morning (they didn't write it, just 
linked to it):

   http://q41.de/downloads/pashua_en/

Just a quick notice of what it is, and a short first-glance review of how it 
interacts with Perl:

It's an app to create dialog boxes from Perl, PHP, Python, tcsh, and 
AppleScript, it says.  Really, it just reads a configuration file from the 
filesystem and displays the dialog via that, runs the app on the command 
line and gets the results back via the app's STDOUT.

It's not very smart; it is named Pashua.pm (should be Mac::Pashua or 
something IMO); it doesn't local()ize its filehandle; it does not use a 
smart way of finding the application from the Perl code (it looks in a few 
known paths, instead of using something like LSFindApplicationForInfo in 
Mac::Processes); it doesn't cache the path once it finds it (even for a 
single running process); it names the configuration file based on a 
timestamp (better not run two scripts that use it at the same time!).

But the Perl code is simple and you could rewrite it if you wanted to, with 
a better name, File::Temp, and LSFindApplicationForInfo(), etc.

Even AppleScript talks to Pashua via the command line, so you can't use 
Mac::Glue or something to talk to it.  The app is not AppleScriptable.

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


Re: MacOSX::File on Panther

2003-10-24 Thread Edward Moy
On Oct 23, 2003, at 11:20 PM, Dan Kogai wrote:

On Friday, Oct 24, 2003, at 14:58 Asia/Tokyo, [EMAIL PROTECTED] wrote:
No, it doesn't work for me.  I had tried something similar, but it  
seems that -U only affects a corresponding -D, but not #define in  
files.
Hmm  Right.  Okay.  It seems like I have to work it out which I  
will start right now.  But I have to begin w/ downloading the latest  
seed, burning the CD and install it.  It will take half a day, at  
least, to fix my testbed.  Since Panther release is so close I would  
like to use your patch for last-minute insurance;  Can I post your  
patch in my web?

Dan the Maitainer of MacOSX::File
Sure, go right ahead.

 
--
Edward Moy
Apple

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


Re: Reading preferences

2003-10-24 Thread drieux
On Thursday, Oct 23, 2003, at 11:15 US/Pacific, James Reynolds wrote:

In BASH, it is really easy to read preferences.
[..]
My question is, can something similar be done in perl?
Or do I have to open, read, parse, then close the preference file?
I'm not sure quite what bash is offering you for the 'read'
but it will still need to
open
read
parse
close
a preference file.

you really merely need a sub like:
which given a config_file name will return a reference to the hash
of stuff in that config file.
#
#
sub apple_config_file_parser
{
my ($file_name) = @_;

open(FD, $file_name) or die unable to open $file_name: $!;

my $ref;

while(FD)
{
chomp;
s/#.*//;
if( /(.*)=(.*)/)
{
$ref-{$1} = $2;
}
}

close(FD);

$ref;

} # end of apple_config_file_parser
ciao
drieux
---



Re: Reading preferences

2003-10-24 Thread James Reynolds
Ok, I think I just need to use a library or module.  Sorry for asking 
before thinking... :-/

--

Thanks,

James Reynolds
University of Utah
Student Computing Labs
[EMAIL PROTECTED]
801-585-9811
At 10:22 AM -0700 10/24/03, drieux wrote:
On Thursday, Oct 23, 2003, at 11:15 US/Pacific, James Reynolds wrote:

In BASH, it is really easy to read preferences.
[..]
My question is, can something similar be done in perl?
Or do I have to open, read, parse, then close the preference file?
I'm not sure quite what bash is offering you for the 'read'
but it will still need to
open
read
parse
close
a preference file.

you really merely need a sub like:
which given a config_file name will return a reference to the hash
of stuff in that config file.
#
#
sub apple_config_file_parser
{
my ($file_name) = @_;
	open(FD, $file_name) or die unable to open $file_name: $!;

	my $ref;

while(FD)
{
chomp;
s/#.*//;
if( /(.*)=(.*)/)
{
$ref-{$1} = $2;
}
}
	close(FD);

	$ref;

} # end of apple_config_file_parser

ciao
drieux
---



Panther/DBI

2003-10-24 Thread Rich Allen
iH

have read the archive about modify Config.pm with

ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'

have reinstalled Bundle::DBI and DBD::mysql and restarted, but still 
get the follwoing:

Can't locate DBI.pm in @INC (@INC contains: 
/System/Library/Perl/5.8.1/darwin-thread-multi-2level 
/System/Library/Perl/5.8.1 
/Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 
/Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level 
/Network/Library/Perl/5.8.1 /Network/Library/Perl .) at 
scripts/perltk_ex/sdttk.pl line 18.

what am i NOT doing correctly?

thanks
- hcir