Re: New Perl-Installation on new OS X
At 10:38 -0400 6/10/11, Sherm Pendley wrote: On Fri, Jun 10, 2011 at 10:34 AM, John Delacour j...@bd8.com wrote: What would be the effect of setting a value (or no value) for PERL5LIB in ~/.MacOSX/environment.plist? That plist is for setting up environment variables for GUI apps. It has no effect on shell sessions. That's not the case for 10.3.9. Has it changed? I have been defining $PERL5LIB and some other stuff in environment.plist for years mostly because of AppleScripts I like to use. Most of the scripts are executed with osascript from a shell and they work fine with no additional redefinition in .tcshrc. They also work OK when I log in to 10.3.9 from a Linux box or use bbedit worksheets. I always thought environment.plist was just a way to be sure things were set immediately after the sort of login that is used to start up the machine rather than waiting for a shell style login. -- -- A fair tax is one that you pay but I don't --
Re: clipboard and macos
Top posted : Try using the pbcopy and pbpaste UNIX tools provided with Mac OS neXt or perhaps Open BSD, You can shell out using a line like this $theclipboard = `pbpaste`; man pbcopy or man pbpaste in Terminal.app for more. At 21:54 -0700 5/9/10, Spencer Chase wrote: sorry for posting to a bunch of lists, some of which i may not be subscribed to. please write to me directly since i forget which lists i am receiving. i have spent the entire day trying to figure out how to copy to the system clipboard on the Mac OSX (darwin) non of the CPAN modules seems to work for darwin. i have tried clipboard which is supposed to work with most OSs but i get all sorts of errors that i have not been able to resolve in hours and hours of attempts. i am just trying to use the example code in the clipboard module which works fine for win32 but nothing i can modify in the module gets it to work on Mac OSX. i have also tried mac pasteboard but there is not PPM for it and i could not get it installed myself. anything else that might work? i am using TKx and need to copy from an entry widget to other applications. no problems copying and pasting with the app, it is the system clipboard that i need to copy to. -- Best regards, Spencer Chase mailto:spen...@spencerserolls.com 67550-Bell Springs Rd. Garberville, CA 95542 Postal service only. Laytonville, CA 95454 UPS only. spen...@spencerserolls.com http://www.spencerserolls.com (707) 984-8356 (707) 972-3149 -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Help setting Perl path
I'm adding some comments between yours. To me the state of affairs reminds me of the terrible problems I got into when first moving from MacPerl on OS 9 to real perl on OS 10. With Fink, DarwinPorts, and CPAN I got really lost. Darwin is now MacPorts and CPAN has been improved but I'm stuck on OS 10.3.9 because I insist on using my SE/30 file server from long ago. Ubuntu is fun. What I have been personally doing is just not using stuff directly from any of those we'll do it for you schemes that seem always to have an entirely different idea about how I want to organize my life with my computer. I use those sites as sources of code but I pretty much always recompile the stuff here or, in the case of perl modules that don't use any included C code, it's just a copy of the source. I put things in my home directory under $HOME/perl/ and point to that with $PERL5LIB. It's often a pain because of dependencies that you don't discover right away but I prefer that to not having the foggiest idea where things were put. You are less familiar with command line UNIX than I am and I am still having problems because of my prior experience on a 64 kiloword UNIX box in the late 1970's gets in the way of more modern tools. I'm also a csh user who has never figured out sh and bash. Others on this list are more knowledgeable than I. I hope some of them will have suggestions based on comments here and below. At 22:23 +0100 9/17/09, Mine wrote: You are right the first line of get_iplayer is #!/usr/bin/perl That's pretty much standard these days. It's there so the UNIX kernel knows what software - perl - to use when executing a file by typing its name at the start of a command line. Up to line 25 appear like comments about the program. Line 26 is: package main; Line 50: use Env q...@path]; Normally the environment variable PATH would be accessed by $p = $ENV{'PATH'}; followed by a split command to change the string to a list of individual directories. This author uses the Env module probably because perl works in non-UNIX environments and the module makes the code portable. Line 51 down to 69 is the Perl modules to use use Env q...@path]; use Fcntl; use File::Copy; use File::Path; use File::stat; use Getopt::Long; use HTML::Entities; use HTTP::Cookies; use HTTP::Headers; use IO::Seekable; use IO::Socket; use LWP::ConnCache; #use LWP::Debug qw(+); use LWP::UserAgent; use POSIX qw(mkfifo); use strict; #use warnings; use Time::Local; use URI; use POSIX qw(:termios_h); Those seem reasonable. Note that the # lines are commented out. They were likely used during debugging by the author. When I use either of the following: /usr/local/bin/perl -w get_iplayer /usr/local/bin/perl5.10.1 -w get_iplayer With all of the copies of perl you seem to have the execute line with the complete path to perl5.10.1 is probably what you should be sticking with.. With it you will be ignoring the #! line in the code for get_iplayer. You might also want to prepare a complete path for get_iplayer and put it into the command. Your shell will allow you to make an alias of the line so it's easy to repeat. I get this in the Terminal: Can't locate loadable object for module HTML::Parser in @INC (@INC contains: /usr/local/lib/perl5/5.10.1/darwin-2level /usr/local/lib/ perl5/5.10.1 /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level /usr/local/lib/perl5/site_perl/5.10.1 .) at /usr/local/lib/perl5/5.10.1/ HTML/Entities.pm line 145 Compilation failed in require at /usr/local/lib/perl5/5.10.1/HTML/ Entities.pm line 145. Compilation failed in require at get_iplayer line 56. I assumed that some of the modules are missing so when I used to try and install then I get the following: cpan install HTML::Entities HTML::Entities is up to date. What's happening is that HTML::Entities contains a use HTML::Parser probably at line 145. I would look up the code for HTML::Entities and have a look. With luck the module will be pure perl with no C-language parts. In any case what you would need to install is HTML::Parser - and anything it uses. The problem is recursive dependencies which CPAN, and the other port services are supposed to be taking care of. My experience with that is terrible and, by the way, it's not so good in many UNIX distributions other than OS neXt either. CPAN seems to think all the modules are up to date. Do a Finder get info on /usr/bin/perl and post what it says. No sure what you need me to post. Kind: Unix Executable File, Size: 20 KB, Where: /usr/bin, Open with: not applicable. Yeah. Finder doesn't speak perl or UNIX very well. ls -lF /usr/bin/perl* -rwxr-xr-x 1 root wheel 19280 Jan 30 2006 /usr/bin/perl* -rwxr-xr-x 1 root wheel 19280 Jan 30 2006 /usr/bin/perl5.8.6* That pair is interesting. It would be common to have /usr/bin/perl be a hard link (man ln for more about that) to the version of perl that a user wants to use. It might be created this way
Re: Help setting Perl path
At 22:10 +0100 9/16/09, Mine wrote: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi, I have Perl 5.8.8 installed by MacPorts and a CPAN install of 5.10.1. Is there a simple way switch between them hopefully from the Terminal, so I can use 5.10.1 when using get_iplayer and 5.8.8 for other programs. You must have links and aliases to perl that are making life difficult. Copy the first 5 lines of the get_iplayer script and post them. I'm particularly interested in a line, probably the first, that is something like: #!/usr/bin/perl Copy and paste some of the Terminal lines you have used with the error messages included and post them too. Is it just get_iplayer Or have you tried things like: /usr/local/bin/perl -w get_iplayer /usr/local/bin/perl5.10.1 -w get_iplayer Do a Finder get info on /usr/bin/perl and post what it says. In terminal, do these: ls -lF /usr/bin/perl* and post the answer. file /usr/bin/perl and post the answer. and . . . string/usr/local/bin:/usr/local/lib:/opt/local/bin:/opt/ local/sbin:/usr/bin:/bin:/sbin:/usr/sbin/string seems to have acquired a space. in the middle of the line. That has to be an e-mail problem. Sigh. You can make a Finder alias or a UNIX link to the full path to the perl you want to use. Call it myperl and make it executable. man ln in Terminal for more on that. myperl get_iplayer -- -- In Christianity, man can have only one wife. This is known as monotony. --
Re: Perl install problems OSX 10.4.11
At 13:04 +0100 9/15/09, Mine wrote: Hi Doug, Just before I create the file I would like to check a few points. but you should edit that so that the first directory, before the first separating colon, is the one that perl 5.10 is in I am not quite sure which is the main Perl folder. /usr/local/bin contains two Unix executable Perl files - Perl and Perl 5.10.1. I assume that this should be the first directory. Ouch. There really ought NOT to be two perl executables. And they would have to have different names to be allowed in the file system. Is there a Macintosh alias or a UNIX link called perl which points to one of them? You might even find a link/alias in /usr/bin or /bin that some helpful porter put there. The UNIX tool: which perl can be helpful. You can also, in Terminal, do something like cd /usr/ local/lib/perl5/5.10.1 ./perl -v to see just what you have. The ./ tells the kernel to forget about $PATH and look in the current directory only. In real UNIX file systems perl and Perl would be different. Apple's HFS file system treats them the same (well you can change that) but the likes of CPAN and perl itself might not. Which files is PERL5LIB. All the installed modules are stored in /usr/ local/lib/perl5/5.10.1/. Is this the location of the PERL5LIB. If so, do I need the full path /usr/local/lib/ perl5/5.10.1/ or can I use /usr/local/lib/. Environment variable PERL5LIB adds a directory of your choice to perl's @INC list. The way I use it is to place modules, some of my own creation and others downloaded from the likes of CPAN, into my own directory in my own space where I can control it all. Placing a directory within a perl distribution into PERL5LIB probably won't help much but it's conceivable that you could pick up a module from one distribution for use in another. Personally I have had serious problems with CPAN which are related to my need to keep modules on a disk that is not the startup disk. The procedures may be better now - it has been a few years and OS neXt versions since I have tried. If the above is correct, then the following is what I think I should write to a plist file. ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http:// www.apple.com/DTDs/PropertyList-1.0.dtd plist version=1.0 dict keyPATH/key string/usr/local/bin:/usr/local/lib:/opt/local/bin:/opt/ local/sbin/string keyPERL5LIB/key string/usr/local/lib/perl5/string /dict /plist opt/local/bin and /opt/local/sbin is taken from a .profile created by MacPorts which I hope will preserve the links for MacPorts. I think this would be better. I have added the directories that have the regular UNIX tools in them at the end. Yours will be looked at first.. I have also removed a space. Watch out for line ends added by rampant email and mail list services there should be no line ends or spaces between string and /string and the DOCTYPE line should be all one line. ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; plist version=1.0 dict keyPATH/key string/usr/local/bin:/usr/local/lib:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/sbin:/usr/sbin/string /dict /plist You can also, in Terminal, change the PATH temporarily with the shell path (lower case) command or by resetting environment variable PATH which is setenv in my favorite shell (tcsh) but is different in bash. Remember that you have to log out and back in to persuade OS neXt to read the plist file. The sbin directories are supposed to be for use by system managers. You might not need them but there are those periodic cleanups that run automatically. Whonoze? -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Perl install problems OSX 10.4.11
Is it possible that some perl modules are not installed until Apple's developer tools are installed? -- -- A fair tax is one that you pay but I don't --
Re: Perl install problems OSX 10.4.11
At 23:26 +0100 9/14/09, Mine wrote: Is it possible to add the Perl 5.10.1 path to the environment so i don't loose the MacPort option. mkdir $HOME/.MacOSX and put this, after changing it a bit, in the new folder. This is just a copy of mine. cat $HOME/.MacOSX/environment.plist paste the text of the new file here type CONTROL D should handle it without having to use finder which just doesn't like directories that start with a dot. Note that you cannot add things to PATH this way. You have to specify the whole thing with full path names. The file is read when you log in to OS neXt in the GUI sense. It is not read when you open a Terminal or run a perl script. [~]% cat ~/.MacOSX/environment.plist ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; plist version=1.0 dict keyPROGRESS/key stringProgress/string keyDOUG/key stringDouglas P. McNutt/string keyLANG/key stringus_ENG/string keyLC_ALL/key stringC/string keyPATH/key string/Users/doug/local/bin:/Users/doug/bin:/opt/local/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin/string keySERVER_NAME/key stringEarth/string keySHELLOG/key string/Users/doug/logs/shel_log/string keyPROJ/key string/Volumes/Echo/Projects/string keyPERL5LIB/key string/Users/doug/perl/string /dict /plist -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Perl install problems OSX 10.4.11
At 01:10 +0100 9/15/09, Mine wrote: Hi Doug, Thanks for the info, but I think this possibly way out side my level of experience. Would what you have suggested allow get_iplayer find the path to Perl 5.10.1 when I try to run get_iplayer from the terminal? If it does then I don't fully understand your instructions. I assume mkdir $HOME/.MacOSX creates a directory. I tried it but could not find the directory. When I used cat $HOME/.MacOSX/environment.plist in the Terminal, it seemed to hang. When you say paste the text of the new file here what text do you mean? cat, used that way is waiting for you to paste the text onto the Terminal screen. The text will become the contents of the environment.plist file. The problem is that Apple takes pleasure in making things difficult for users who might be able to muck something up. Those leading dots typically identify files that are private to the system. You can see dotted files with the unix command ls -a for list all. cat stands for concatenate which reads standard input, the terminal screen, and writes to standard out which the directs to a file. You use control-D to terminate the input. I also used cat to display my environment.plist file. You can see the command that immediately precedes the text. But remember that you do have to edit the copy of my file to meet your needs. It is likely that you need only the PATH part but you should edit that so that the first directory, before the first separating colon, is the one that perl 5.10 is in. You probably don't want my personal bin directory but you might want to have a PERL5LIB directory which could also contain modules that would be found wherever perl came from. The /bin and /usr/bin items are pretty much required. cat, for instance, gets found that way. The file format is xml. Entries are in pairs of lines key defines the name and string declares the corresponding value. You might well have a text editor, bbedit or text wrangler (its free cousin) come to mind, that would have no problems dealing with directories whose names start with a dot. That would be fine in place of unix tool cat. You could also use Apple's plist editor but I suspect it would confuse you more than it would help. I dislike it. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Perl install problems OSX 10.4.11
At 23:22 +0100 9/12/09, Mine wrote: Hi, Thanks for your excellent response, makes installing so easy assuming I did it correctly. I think everything that was required is installed, but I am not sure everything was installed in the right location. It appears that Perl 5.10.1 was installed and all the modules I installed are associated with Perl 5.10.1. When I try to run the get_iplayer PVR module I get the following error: Can't locate loadable object for module HTML::Parser in @INC (@INC contains: /opt/local/lib/perl5/5.8.8/darwin-2level (I have abbreviated the error message) And when I enter perl -v I get the following: This is perl, v5.8.8 built for darwin-2level So the system does not see the Perl 5.10.1 install. Can someone please tell me if there is a was to install the modules so they relate to perl, v5.8.8, or point get_iplayer to use Perl 5.10.1. I suspect that Apple's perl is 5.8.8 and it is installed in /usr/bin. It needs to stay there because Apple's updates may depend on it. Installing 5.10.1 in /usr/bin/ replacing 5.8.8 is not recommended. I also suspect that perl 5.10 is installed in /usr/local/bin but that might be different like /opt/bin depending on just how you installed it.. Look around for it. /opt/local/lib/ sounds unlikely to me. You are probably going to make a change to your PATH environment variable to make the directory that perl 5,10 resides in appear before /usr/bin. A shell command like: setenv PATH /usr/local/bin:$PATH # csh PATH=/usr/local/bin:$PATH # something like this in bash export PATH You can also specify PATH in a startup file $HOME/.MacOSX/environment.plist. but you'll have to create that including the .MacOSX directory unless it's already there. There are some instructions on Apple's web site. Ask if you'd like a sample. @INC is a perl array that lists directories in which modules can be found. There are a bunch of standard locations relative to the directory that perl itself lives in but you can add more directories by setting the PERL5LIB environment variable to a PATH-like list of other directories. That too can be done in environment.plist. It's a bit hard to understand why iplayer doesn't have an installation script or at least some less geeky instructions for users. -- -- A fair tax is one that you pay but I don't --
Re: Dumb path question
At 20:25 + 3/10/09, John Delacour wrote: At 21:10 -0600 9/3/09, Doug McNutt wrote: At 22:24 -0400 3/9/09, Chris Devers wrote: How can a Perl script reliably, portably resolve the path inside which it is running?... $0 That's a zero. Has always worked for me to produce a full path to a running perl script. ...There is a module cwd... or rather Cwd. $0 will give the name but not the full path, so I'd suggest the following: #usr/bin/perl use Cwd; my $currentdir = cwd(); print $currentdir/$0\n; Interesting. It turns out that I rarely call a stored perl script without specifying a full path in the call. I'm getting a full path in $0 when I do that. There may be more to think about. The stuff I just checked calls the script itself which has been made executable rather than making a call to perl with the argument being the path to the script. I also don't know about a stored script placed in a directory that's included in $PATH but is not in $PWD. portable seems to be the key here. Modules good for that. -- - Stocks are getting pilloreid -
Re: Adding to @INC
Mac OS neXt also provides for a file: $HOME/.MacOSX/environment.plist. .If it's not present you can create it and its hidden directory. Contents are environment variables that you would like defined even if you haven't opened a Terminal.app session. AppleScript's do shell script command, for instance will not run your startup scripts for your chosen shell. In environment.plist you can define PERL5LIB as /opt/local/lib/perl5/site_perl/5.8.8 without adding whatever else was in $PERL5LIB. The result is independent of your choice of shell. Apple has published a note on it somewhere. Concatenations to existing environment variables will not work. Watch out for some errant scripts in /etc/ that once overwrote $PATH when it was redefined in environment.plist. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: MacPort: how to port perl?
At 18:23 -0400 9/7/08, Vic Norton wrote: As far as I can tell Perl on a Mac pays absolutely no attention the environmental variable PERL5LIB. I have eliminated all PERL5LIB specifications on my machine. You WILL have that problem if you try to define PERL5LIB as an environment variable in your .profile or one of the *rc scripts. If you define it in $HOME/.MacOSX/environment.plist it will actually be read at log in to aqua time and will be reflected in whatever shell script or bbedit worksheet that you open after that. A login to MacOS neXt bears no resemblance to a login via ssh. -- -- If it's not on fire it's a software problem. --
Re: Can't find Mac::Growl
At 18:17 -0400 8/25/08, David Green wrote: Can't locate Mac/Glue/Common.pm in @INC There is an environment variable PERL5LIB that can be set to add directories to perl's default include path. It is, for instance, possible to add the library from a previous install to @INC. There is some danger of incompatibility but it's easy enough to try. $HOME/.MacOSX/environment.plist is a file you would need to modify or create. In it you can define PERL5LIB as you want. The format is available on Apple's site. Ask if you'd like a copy of mine. Note the dot in .MacOSX. -- -- A fair tax is one that you pay but I don't --
Re: MacPerl Script on OS X
At 08:43 +0100 8/23/08, Eberhard Lisse wrote: 7 open (trans, g5hd:newScansImages:trans) or die Error, can't open; open (TRANS, /Volumes/g5hd/newScansImages/trans) or die Error can't open $!\n; Be really careful about that /Volumes/ directory. Apple uses it as a mount point for external and secondary disks and not for the root disk which can't have a name other than / in the world of UNIX. g5hd sounds a lot like a user inserted name for a main disk. The proper form in the UNIX - perl5 world would be more like /newScansImages/trans where the leading solidus is the root directory for the operating system. A sure way to get the right string is to open Terminal.app and use Finder to drag a file icon into the window. Terminal.app will display the POSIX path relative to the current working directory which you might want to set to / with a cd / command. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: How to run Perl script at Mac OS (Darwin) Release?
Hashing of tools by shells has not been mentioned. It may not be part of the problem but on invocation many, if not all, shells examine the $PATH variable and make a table of executables that it finds. The table is then converted to a hashed lookup array in order to improve speed of response. (That probably makes little sense today but it was started during the days of mag tape.) So if you create a perl script, place it somewhere in $PATH, and set its execute permission a running shell will not find it. A full path, perhaps starting with the current directory . always works. In tcsh the command to rework the hash of tools is rehash. Restarting the shell with a new Terminal.app window will do pretty much the same thing. -- Applescript syntax is like English spelling: Roughly, though not thoroughly, thought through.
Re: MacPerl Script on OS X
At 16:52 -0500 2/28/08, Jay Savage wrote: On Thu, Feb 28, 2008 at 4:03 PM, Ben Crane [EMAIL PROTECTED] wrote: I have a Perl 4.X script that runs using MacPerl in Classic on my G5 Mac but I can't get it to run using Perl in 10.4.11. What do I need to do to make it run? Thanks for any suggestions. Upgrade it work with Perl 5.x ;) Seriously, though: what errors are you seeing? Does it rely on any modules? Perhaps mober that the permissions scheme is different on X, and if it was set to run under MacPerl on Classic, it won't be executable by default. Unfortunately, a *lot* has changed in the last 15 years (the last perl4 release was in 1993), so I don't think anyone is going to be able to give you a list of all the things that could be going wrong off the tops of their heads. Post the errors, though, and if possible the problematic code, and we can help. One very simple possibility is that the line ends in the code itself may need to be converted from Mac Classic 0D's to UNIX 0A's. ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit 52 kB is one way. Remember that in MacPerl the designator \n generates 0D and \r generates 0A. That's reversed from UNIX conventions which are used in OS neXt. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Proposed Mac::Pasteboard
At 03:15 + 1/21/08, [EMAIL PROTECTED] wrote: Is there a module that will let one manipulate a Mac OS X pasteboard? There does not seem to be anything on CPAN that strikes me as being for that purpose. Have a look at the tools pbcopy and pbpaste that are delivered with OS neXt. There is a subtle difference between pasteboard and clipboard. NeXt has a pasteboard which sometimes refers to the current selection and not just to something that has been copied. That allows services to do things like execute selected text as a terminal command. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: CamelBones...
At 09:31 -0500 1/10/08, Dan Neville wrote: I am writing an application in Perl and compiling it in CamelBones. I want to make it a DragDrop. I can't get the pasteboard to pass the file or folder information to the script. Does anyone have an example I could use as a template? If all of Sherm's X-code stuff confuses your brain there is an AppleScript solution that doesn't make you learn the details of AppleScript. There is an example, with source, in: ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit It's actually some C drivel that changes line ends in text files but it could just as well have been a perl executable with a #! line at the top. It might now work properly for an application that is running when the drag occurs. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Mac OS alias from Perl
At 20:11 +0900 12/9/07, Peter N Lewis wrote: At 19:01 -0500 8/12/07, Dan Neville wrote: Does anyone know how to make a Mac OS alias in Perl? So, I wish to have Perl create aliases in multiple directories rather than copy the original file. There actually is no API call to create an alias file. You can do it in Perl as described at http://use.perl.org/~pudge/journal/10437 Alternatively, you can make a new alias via AppleScripting the Finder as: set thaAlias to Harddisk:Users:peter:thefile.cpp as alias tell application Finder set f to make new alias file at desktop to thaAlias end tell If you're not into the O-O stuff involved with the AppleScript modules, and you're not in a hurry, it's possible to invoke the osascript tool from within perl using backticks. You can create a string of AppleScript commands to pass to it with simple perl concatenations like .= or you can use a here document with perl's here or with shell's here depending on how you set the backticks. Test your AppleScript code with Script Editor first. Using Finder is pretty much required because Finder owns the specification for an alias file. I have never seen a formal description of that or, for that matter, an alias resource. They are based on the file-id number which never repeats as files are created on a partition but there is more to it because that doesn't always work. Aliases do survive a file name change by the user and they use volume names so that Finder can request a floppy by name if an old alias pops up. What can cause an alias to fail is an editor that always writes the changed file to a newly created copy and then changes the names around so the original becomes the backup. The alias will point to the original while a symbolic link will point to the new. -- Applescript syntax is like English spelling: Roughly, though not thoroughly, thought through.
Re: interaction between tr and s (was Re: tr question -- probably wrong list to ask, but ...)
At 17:03 +0900 12/1/07, Joel Rees wrote: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: [EMAIL PROTECTED] Content-Transfer-Encoding: 7bit From: Joel Rees [EMAIL PROTECTED] At 11:43 +0900 12/1/07, Joel Rees wrote: Content-Type: text/plain; charset=ISO-2022-JP; delsp=yes; format=flowed Message-Id: [EMAIL PROTECTED] Content-Transfer-Encoding: 7bit From: Joel Rees [EMAIL PROTECTED] I had some intermittent problems reading your postings using Eudora-5 on this Mac 8500 running OS9.1 which I prefer for email. The $line =~ tr/+/ /; showed up as $line =? tr/+/ /; and I got a couple of yen marks. I blamed it on lack of unicode support. Looking back I see a couple of Content headers in your email that bother me They both say simple 7 bit ASCII but then they also have divers encodings stated which really are about how to use the eighth bit. There is also the big-endian / little-endian consideration which has reared its ugly head with the introduction of Intel machines running Mac OS. Is it possible that some of the failure to decode %xx encoded stuff is associated with development on one machine followed by execution on another? Is UTF-8 input coming from the likes of Apache a possible source of failure? Pack may need to allow for endian-ness of a specific machine. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: tr question (probably wrong list to ask, but ...)
At 21:29 -0500 11/30/07, Chas. Owens wrote: The tr/// operator does not take a regex, it takes two strings. Yep. Damn. What I meant to type is $line =~ s/\+/ /g; But that does explain why there was no error message. Looking at Joel's code the substitute might still be the way to go. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: tr question (probably wrong list to ask, but ...)
At 01:56 + 12/1/07, Andy Holyer wrote: On 1 Dec 2007, at 00:33, Joel Rees wrote: This is probably the wrong list for this question, but is anyone willing to give me a clue why $line =~ tr/+/ /; would clip out the lead bytes of a shift-JIS string in a cgi script? what was just expressed, but you haven't expressed anything so far, so god knows what it will match. I think you meant to say .+, but that will just delete the whole string in this context. What did you want to do? + is a special representation of a space in URL encoding but it's the one-or-more collective char in perl. My guess is that the intent is to replace plus's with spaces which requires escaping the +, How about $line =~ tr/\+/ /g; where I have added the g to get them all. But what the devil is the thingy (missing char) repeated at least once? Should it not have produced a compile error or a least a warning? Was the -w switch used? -- -- On the eighth day, about 6 kiloyears ago, the Lord realized that free will would make man ask what existed before the Creation. So He installed a few gigayears of history complete with a big bang and a fossilized record of evolution. --
Re: Is there a True Boolean type in Perl?
At 18:20 -0700 10/15/07, Michael Barto wrote: I think in the more newer languages, they have implemented true booleans. Perl is kind of old school. use constant TRUE = 1; use constant FALSE = 0; Is a complete solution in perl 5. There was once a reason back in the time of grandfathered languages for booleans which actually used only one bit of a precious word of memory. That would be a true boolean. I'll bet those new school languages use a native word, 16 , 32, or perhaps 64 bits while arguing that it's faster and better that way. -- -- Halloween == Oct 31 == Dec 25 == Christmas --
globbing with Apple's HFS+
The Camel book is a bit scary describing performance of filename globbing with the *.pl or the glob(*.pl) syntax with or without use Cwd in the preamble. Portability is declared questionable. I find that the only thing that works is * within a loop where each file is tested by hand. Consider this bit of doggerel. I'm looking for special cases of a *.pl file that appears where * means the short name of the enclosing directory. Note especially the last command in the second while loop. It works not! What happens is that the second pass through the while() loop begins in the previous directory at the point where it was cut short after finding the file I want. If I comment out the last statement, so that all of the files in the directory are processed, everything works. my ($trial, $ddd, $lookfor, $error, $nextdir); @thefolders = (); @directories = (); while ($trial = *) { if (-d $trial) { push @thefolders, $trial; # print REPORT $trial\n; } } for $ddd (@thefolders) { $lookfor = $ddd.pl; $nextdir = $mybase/$ddd; # $mybase, global, is full path to initial directory. $error = chdir $nextdir; while (*) { if ($_ eq $lookfor) { push @directories, $ddd; # print REPORT Added directory $ddd, $lookfor in $ddd\n; # last; # Fails. while() continues where it left off in the previous pass } } } If I try finding *.pl, $lookfor, or glob($lookfor) I get a real mess with hits from directories that bear no resemblance to the most recent chdir which returned without error. Making the second while loop operate within the while looking for directories is even worse. I'll probably get around to looking more deeply but there's little point if someone here knows that it's all a known problem on MacOS neXt. (10.3.9 here because I need to talk to my SE/30 file server.) Oh It's perl 5.8.1-RC3. -- Applescript syntax is like English spelling: Roughly, though not thoroughly, thought through.
globbing with Apple's HFS+
The Camel book is a bit scary describing performance of filename globbing with the *.pl or the glob(*.pl) syntax with or without use Cwd in the preamble. Portability is declared questionable. I find that the only thing that works is * within a loop where each file is tested by hand. Consider this bit of doggerel. I'm looking for special cases of a *.pl file that appears where * means the short name of the enclosing directory. Note especially the last command in the second while loop. It works not! What happens is that the second pass through the while() loop begins in the previous directory at the point where it was cut short after finding the file I want. If I comment out the last statement, so that all of the files in the directory are processed, everything works. my ($trial, $ddd, $lookfor, $error, $nextdir); @thefolders = (); @directories = (); while ($trial = *) { if (-d $trial) { push @thefolders, $trial; # print REPORT $trial\n; } } for $ddd (@thefolders) { $lookfor = $ddd.pl; $nextdir = $mybase/$ddd; # $mybase, global, is full path to initial directory. $error = chdir $nextdir; while (*) { if ($_ eq $lookfor) { push @directories, $ddd; # print REPORT Added directory $ddd, $lookfor in $ddd\n; # last; # Fails. while() continues where it left off in the previous pass } } } If I try finding *.pl, $lookfor, or glob($lookfor) I get a real mess with hits from directories that bear no resemblance to the most recent chdir which returned without error. Making the second while loop operate within the while looking for directories is even worse. I'll probably get around to looking more deeply but there's little point if someone here knows that it's all a known problem on MacOS neXt. (10.3.9 here because I need to talk to my SE/30 file server.) Oh It's perl 5.8.1-RC3. -- Applescript syntax is like English spelling: Roughly, though not thoroughly, thought through.
Re: @INC problem
At 18:21 -0500 2/22/07, Vic Norton wrote: So this is my question. How do I add /Library/Perl/5.8.6 to @INC, without having to add use lib /Library/Perl/5.8.6; to every script ? It's likely that there is abetter way, but. . . If you define the environment variable PERL5LIB in your $HOME/.MacOSX/environment.plist file you can add directories to @INC which will be present no matter what shell or scripting language you are using. There is an Apple-provided app note about environment.plist. What I worry about is the older functions in 5.8.6 may not work. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Strange problem with @INC
At 08:53 -0500 1/10/07, Jay Savage wrote: As I said before, you have two options here. Since reinstalling all your Finked software manually probably isn't appealing, what you need to do is use your .xinitrc file to setup the fink environment in X. Either setup your PATH and PERL5LIB manually in .xinitrc (it works just like any other rc file) or source /sw/bin/init.sh. Another option on a Mac is to define $PERL5LIB at the time of login to the OS itself. That is done with an XML file $HOME/.MacOSX/environment.plist where you can set environment variables that are set up for all applications you activate. Apple has a note on it that CAN be found on apple,com. A well behaved rc file will NOT remove things previously defined but /etc/cshrc, the global startup file, can and will overwrite any $PATH you set in environment.plist. -- -- The greenhouse effect due to water vapor has never been fully modeled and weather forecasting remains irreducibly complex. It is clear that global warming is the act of an Intelligent Designer. --
Perl Module Installation in $HOME
At 17:03 +0100 8/24/06, David Cantrell wrote: Run the CPAN shell as root as all will be well. Idonwannadodat! Although I have root privileges on all machines around here there are still two of use who install things and I much prefer NOT to step on the War Department's toes. She's the one who keeps my Linux OS's up to date and I rarely know whether it's Fedora or Ubuntu because I log in from OS neXt.. My solution is to use the --prefix option in ./configure to point to --prefix $HOME/local In $HOME/local/ there are the usual directories one of which is $HOME/local/bin/ or in some cases $HOME/perl/. I see to it that the PERL5LIB environment variable gets set to one or the other of those. My $PATH is set to look at the $HOME/local/bin/ directory first. The result is that I can compile and install without being root. My stuff does not get any chance to screw up something like a system update from Apple or some Linux distribution. I happily accept the responsibility for fixing things up if such an update requires changes to my stuff. My own perl modules end up in $HOME/local so there can be no accidental naming confusion. The problem is - - - How do I tell cpan to do things that way? - especially when there is a batch of dependencies to worry about. -- -- The message came to Abraham that he would beget a son. Sarah, who was behind the door, laughed. --
Re: Perl Module Installation in $HOME
At 19:39 +0100 8/24/06, John Delacour wrote: All tests successful, 1 subtest skipped. Files=18, Tests=503, 3 wallclock secs ( 1.75 cusr + 0.50 csys = 2.25 CPU) /usr/bin/make test -- OK Running make install Installing /usr/local/lib/perl5/5.8.8/CGI.pm Installing /usr/local/lib/perl5/5.8.8/CGI/Cookie.pm Installing /usr/local/share/man/man3/CGI.3 ... etc. I guess I wasn't clear. I want the modules installed in my $HOME directory so that they won't 1) Get lost when a newer OS gets installed - especially with Linux. 2) Get in the way of someone else's, the main geek - my wife's, idea of what should be there. Installation in /usr/local gets me into trouble. $HOME/local/bin and the like is what I want cpan to use for me. Just downloading source and doing any required makes myself seems to work OK except that dependencies get to be a PITA. When the module is all perl code there is really nothing to make anyway and I can just reload my $HOME directory from a backup. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Math::GMP and Net::SSH::Perl
At 18:29 -0700 8/5/06, [EMAIL PROTECTED] quoted: On Aug 5, 2006, at 3:43 PM, Michael Barto wrote: The issue is that the Math/GMP.pm is located in my development directory : /Users/Mbarto/Development/Perl/GMP.pm setenv PERL5LIB /Users/Mbarto/Development/Perl PERL5LIB=/Users/Mbarto/Development/Perl export PERL5LIB Either way perl will add the directory to @inc before it starts compiling. -- -- In Christianity, man can have only one wife. This is known as monotony. --
Re: How a file gets copied remotely
Perhaps I'm ranting but this IS an Apple based list. In MacOS classic from M1, I can mount a folder that exists on M2 and another folder that exists on M3. Dragging a file, as an icon on a CRT connected to M1, from M2 to M3 goes directly with no problem. I think it's because high level AppleEvents are set up to handle copies and moves like that. The 128 kb/sec LocalTalk network it was designed for may have had an effect. But I can't do that if M1 is running Tiger. Apple deliberately turned it off for my OS 7 machines.. -- Applescript syntax is like English spelling: Roughly, though not thoroughly, thought through.
Re: Mac / Perl / 3D
At 09:59 +0800 7/26/06, Peter N Lewis wrote: I'm interested in producing some drawings/diagrams/pictures based on 3D data/objects generated from Perl. Something that would allow me to write code that generates boxes, cylinders, spheres, etc with various colours and material styles and generate an image (or potentially an animation). I have used perl on a Mac, starting with MacPerl, to generate Autodesk DXF formatted stuff. Not much in 3D but a couple of specialized projects that 2D folks were happy with. If you start with an exported DXF file from the version of AutoCAD that's being used you can copy the boilerplate from front and back. I usually use Vectorworks to view my own work and it doesn't care much about the boilerplate. There is other software that reads and displays the format. The current specification for DXF is freely available at the AutoCAD web site in html format. Ask if you'd like some samples. -- -- Life begins at ovulation. Ladies should endeavor to get every young life fertilized. --
Re: Regex and Mac vs UNIX line endings
If you want to adjust the line ends in the files have a look at: ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit 52 kB ftp://ftp.macnauchtan.com/Software/LineEnds/ReadMe_fixends.txt 4 kB Yeah. It's pretty easy in perl too. I have on occasion, read the first few hundred characters of a file and then searched for \n and \r and \r\n. From that I make a guess and reopen the file for line by line reading after setting $/ to what I found. If you slurp in the whole string you can play with $option1 = split /\n/, $thedata; $option2 = split /\r/, $thedata; Which option has the most elements? split /(\r|\n)/, $thedata; # is an idea I just had. I wonder? -- -- Science is the business of discovering and codifying the rules and methods employed by the Intelligent Designer. Religions provide myths to mollify the anxiety experienced by those who choose not to participate. --
Re: hex editor
At 12:37 -0500 5/20/06, Joseph Alotta wrote: I have this text file I want to read that has ^M as the record separator (in emacs). Is there a utility on the Mac that i can use to view this file in hex. I thought i remember something like hex filename, but it is not there. hexedit is a GUI tool for Macintosh that has been around for a long time. MPW and BBEdit have a dumpfile option that displays in hex but will not allow editing. sedit was around for Classic OS which allowed editing and access to SCSI features. That probably is dead for ATA drives. pack and print with perl?? -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: When does a hash of lists get defined?
At 08:41 -0700 4/5/06, Stewart Leicester wrote: 'defined' will autovivify, 'exists' will not. I'll leave it up to Doug to decide if knowing that helps. The Camel book, page 710 in the third edition is very clear that exists goes the same way as defined. But perl has gone through a couple of new versions since it was written. Thanks to Stewart who did get me on the right track by mentioning exists. That's where I found autovivification mentioned in the Bible. It also says there: This behavior is likely to be fixed in a future release. In 5.8.1-RC3 it hasn't changed. I wonder if the comment refers to perl6 ? Do those fellows know about it? The solution for my problem was to test just the hash element without looking at the underlying list item. Exists and defined both work that way without behaving like the Creator. Checking for the list item = also works if the vivifivation has occurred. I appreciate the help from the list -- -- Science is the business of discovering and codifying the rules and methods employed by the Intelligent Designer. Religions provide myths to mollify the anxiety experienced by those who choose not to participate. --
When does a hash of lists get defined?
While messing with CGI POSTed data I got trapped by this one. Version 5.8.1-RC3 for Mac OS 10.3.9 It appears that the hash element D gets defined in the process of testing to see if an element in the associated string is defined. The last if below takes the else route. Is that normal? Does it somehow make sense? %phash = (); foreach $jill (A, B, C) { for ($lynn = 0; $lynn3; $lynn++) { $phash{$jill}[$lynn] = $jill$lynn; print \$phash{$jill}[$lynn] = $phash{$jill}[$lynn]\n; } } if (! defined $phash{D}) { print \$phash{D} is undefined, We expected that.\n; } if (! defined $phash{D}[3]) { print \$phash{D}[3] is undefined. We expected that too.\n; } if (! defined $phash{D}) { print \$phash{D} is undefined\n; } else { print \$phash{D} got defined - why?\n; } __END__ -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: Faxing
At 13:29 -0600 1/17/06, Bill Stephenson wrote: I want to write a script that faxes selected members of congress my humble opinions ;) You can send e-mail from perl and that leads to two options: 1) Send the email to efax (sp) where it can be converted to FAX and sent for a fee. 2) Don't vote for representatives who steadfastly refuse to publish an e-mail address. I know, they will need a clerk to read it but that's true for the FAX too. Joel Hefley; are you listening? -- -- Love your country. But don't trust its government. --
Re: @INC
At 12:15 -0600 1/5/06, The Ghost wrote: How can I permanently add to @INC? I have 2 versions of perl installed and only use one of them. The reason for 2 versions is a port system that refuses to rely on the already installed perl. Try setting the PERL5LIB environment variable. It's formatted like a $PATH for perl. I set it in $HOME/.MacOSX/environment.plist so that it works when initiated from a Cocoa or Carbon application. You may have a problem with incompatibility of stuff in an @INC area that demands another version of perl. That's why the ports don't attempt to mix things up. -- -- Science is the business of discovering and codifying the rules and methods employed by the Intelligent Designer. Religions provide myths to mollify the anxiety experienced by those who choose not to participate. --
Re: CPAN modules ...
At 17:15 -0500 12/30/05, Vic Norton wrote: A second question. When I run for (sort keys %ENV) { printf %25s = %s\n, $_, $ENV{$_}; } from BBEdit, I see a small subset of the %ENV that comes from running the script in Terminal. How can I make BBEdit's %ENV more like the system %ENV? I'm not so sure there IS a system environment. Login to Aqua and login to BSD are entirely different thingies. The likes of /etc/profile or /etc/cshlogin and similar things which I have probably spelled wrong seem to override whatever the system sets up in the first place. They can be removed or edited. You can set up an environment, that pretty much sticks, by creating a file and directory $HOME/.MacOSX/environment.plist where you can set the environment so that it is the same whether you enter via some Cocoa app - BBEdit - or through Terminal.app. Apple has some info on that and a search in the developer area for environment.plist should show it up. Ask off line if you'd like a copy of mine. But even if you set it there those damnable /etc/* startup files can screw it all up. And. . . You are running that script from a BBEdit worksheet are you not? If you're running it as a filter from the #! menu all bets are off. You are basically starting a brand new non-daughter shell and it probably doesn't get any variables you have changed in BBEdit. -- -- Science is the business of discovering and codifying the rules and methods employed by the Intelligent Designer. Religions provide myths to mollify the anxiety experienced by those who choose not to participate. --
Re: Detecting file's line endings
At 15:15 + 12/22/05, James Harvard wrote: I'm trying to detect a file's line endings (\r\n for DOS, \r for Mac and \n for Unix as I'm sure y'all know). ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit 52 kB ftp://ftp.macnauchtan.com/Software/LineEnds/ReadMe_fixends.txt 4 kB I have trouble with files that contain multiple types of line ends. The result was these drag and drop AppleScripts that might help. They do look at the whole file but the underlying code (included) is in C and pretty fast and not memory intensive. You can change or just test for line endings but they don't (yet) handle the two newer 16 bit unicode line ends. -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: The shell and my scripts
At 08:08 -0400 7/29/05, Sherm Pendley wrote: On Jul 28, 2005, at 11:10 PM, John Horner wrote: What about a script run from BBEdit? BBEdit is a GUI app, and GUI apps don't use your login shell. To define environment variables to be used by GUI apps, have a look at this QA from Apple: BBEdit also allows BBEdit worksheets which are a bit like Apple's MPW using ENTER to execute selected text as shell commands. If you are using one of those an instance of your selected shell, tcsh, is associated with each open worksheet. On opening a worksheet your ~/.tcshrc is sourced and you can set environment variables there. Your tcsh login script is NOT run. It's probably better to create a $HOME/.MacOSX/environment.plist file but watch out for the public tcsh startup files in /etc/. As delivered they can overwrite your selections in the plist especially for $PATH. The plist is read only at login-to-Aqua time. If you change it you must logout and login again to see the changes. Things are better now that it's UNIX underneath. Just ask Steve. -- -- Halloween == Oct 31 == Dec 25 == Christmas --
Re: Different results using the substr command
At 22:23 + 1/5/05, John Delacour wrote: If not then you need to consider your line endings. And remember that MacPerl subscribes to the MPW convention that reverses the meanings of \n and \r for the Mac. ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit (52 kB) ftp://ftp.macnauchtan.com/Software/LineEnds/ReadMe_fixends.txt (4 kB) might be useful. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Reading in a File
At 22:44 -0500 12/25/04, Lola Lee wrote: Nothing happens. This lesson that I'm working on is working from the premise that people are using a Windows Perl installation. Watch out for line ends in the source file that is being counted. Perl probably doesn't care because the return-linefeed pair from Windoze still contains the single linefeed that UNIX expects. But I have been fooled, especially with Unicode's two new code points representing line ends. -- -- Halloween == Oct 31 == Dec 25 == Christmas --
Re: [OT] Text Editor for OSX
At 07:46 -0700 10/3/04, wren argetlahm wrote: all correspondence should be directed to [EMAIL PROTECTED] off-list. I'm not so sure about the OT designation. Apple's Macintosh Programmer's Workshop (MPW) is the best programming environment I have ever used. BBEdit worksheets are a start but are not nearly as flexible. emacs is another option but it still doesn't approach MPW with its window = file metaphor. MPW allows one to execute a shell command by selecting it and using the ENTER key. Output from the command, which can be a named file or an open window, can be redirected to any other open window or to a file. A start for an editor is Apple's TextEdit for which Cocoa source is available. There is still an active MPW group and there is regular talk about getting MPW carbonized for OS neXt. Apple is not responding and makes it clear that it doesn't want to and won't release the source. It is likely that you could find support for your effort on the MPW mailing list http://lists.apple.com/mailman/listinfo/mpw-dev especially if you are interested in making the editor a real shell while you're at it. Note that the source for tcsh is available from Debian with public license provisions. -- -- The best programming tool is a soldering iron --
Re: BBEdit 8.0
At 19:41 -0500 9/9/04, Ian Ragsdale wrote: Shell worksheets (allows easy editing running of shell commands) And there is by far the most important item. When the MacPerl port ran as an MPW tool it looked a whole lot like UNIX perl and you could run it from a command line, with arguments, and redirect output to another open window or to a file. Any open window, if it contained shell commands, could be invoked as a tool by simply naming it. I am told, by my son, that the best replacement for MPW in OS neXt is really emacs but it requires that I learn smalltalk or something similar and, though I have read the book, I just ain't there. X11 isn't that easy to use either with my four monitors. BBEdit worksheets are still fairly new and I really hope they will migrate more and more closely to either MPW or emacs. As of now even emacs is not a real shell having to pass commands to the user's chosen shell. That makes handling the environment a pain just as it is in BBEdit. Each open document has its own associated shell process which doesn't talk to the others. MPW was a shell, of sorts, but the underlying operating system didn't have shells so the point is moot. As of version 8 you cannot save a working BBEdit worksheet as an executable perl script. You must first convert to a normal BBEdit document and save that while adding the appropriate shebang line and executable permission bits. (Yes. you can muck with OS 9 file type and creator codes but it's not approved.) It is so much easier to select a few lines of text and execute them than it is to play keyboard games with history arrays. . . I wax happy about the concept but I miss OS 9 and MPW. BBEdit is the best choice right now. Every once in a while there is a burst of activity requesting a Carbon version of MPW. Should Apple decide to release the source code and provide some kernel hooks for intercepting read and write requests from compiled code it could become a real open-source competitor but BBEdit could easily beat it out by incorporating selected content from tcsh, or bash, so that BBEdit itself becomes a real boy -- er, a shell -- rather than a wooden one with a long nose.. -- -- Halloween == Oct 31 == Dec 25 == Christmas --
Re: Incorrect Path or format?
At 09:16 -0400 7/27/04, Nick Pappas wrote: When I type: perl /Documents/simple_print, I get the diagnostic Can't open perl script /Documents/simple_print: No such file or directory Your documents folder is probably in your home directory rather than on the root. perl $HOME/Documents/simple_print or cd $HOME/Documents perl simple_print The OS neXt GUI confuses the concept when it offers the option of saving to Documents. -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: Perl droplet how?
At 15:06 -0400 6/6/04, Ingo Weiss wrote: how can i make a Perl droplet (A Perl script that processes files or folders dropped onto it) fast and easily? One way is to write a three line AppleScript. An advantage - or disadvantage - is that aliases and symbolic links will be resolved before you get the file to process. AppleScript has a do shell script command that doesn't care if the script is really perl. Sample code - for something else - is at: ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit ftp://ftp.macnauchtan.com/Software/LineEnds/ReadMe_fixends.txt You can also make a script into a package but getting a dropped file will require more: ftp://ftp.macnauchtan.com/Software/PrepAPPL/ReadMe_PrepAPPL.text ftp://ftp.macnauchtan.com/Software/PrepAPPL/PrepAPPL.scr Is a tcsh script I wrote which will make a double-clickable Finder-recognized app from a script. It does not pick up dropped items. -- -- Life begins at ovulation. Ladies should endeavor to get every young life fertilized. --
Re: Basic question
At 10:10 -0500 5/22/04, Timothy Bailey wrote: Oddly enough, shell scripts (which I am less familiar with) don't seem to pay attention to the shebang line either. I am guessing that the problems are related. You do have the execute bit set don't you? chmod 755 yourScript In any case it's not perl that isn't recognizing the shebang line, it's your working shell. Learn about tool hashing and the rehash command if it's tcsh. If your script is in the current working directory try ./yourscript. That's dot-slash. It will avoid the hashing. Think about creating a $HOME/bin/ directory and adding it to your path in $HOME/.MacOSX/environment.plist. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Web servers with cable DSL
At 20:23 -0700 3/16/04, Joel Rees wrote: I guess that 'll make it a sort of world of geocities minus the ads, lusers, l33tz, and exploits. And google will run the yellow pages. http://www.bellsystemmemorial.com/belllabs.html We, in the USA, once had the best in the whole world. -- -- The corporate income tax is a sales tax collected, on behalf of the government, through price increases. It is paid in the end by consumers of the products. --
Re: Soliciting opinions from Applescript refugees
At 01:08 -0600 2/28/04, Chap Harrison wrote: I am about to switch away from Applescript -- either that, or go mad. Welcome to perl. You will be pleased. It involves loading a Filemaker database. I'm sorry for you. When Filemaker allows me to prepare a macro - er script - with a text editor I might try it again. The idea that one is required to mouse around to make things work is a disaster. You can't even copy and re-use something you did previously in another database. My major use for AppleScript has been to make drag and drop applets which are usually one liners that simply pass a file to perl or perhaps an ANSI-C coded UNIX executable. There is a way to put a perl script in a *.app package which can be run from Finder but I haven't yet figured out how to pass arguments. A problem with scripting applications with other than AppleScript is obtaining the information you need about the structure of the target application. The dictionaries are bad enough in the script editor and you may find it even harder in perl. Just finding the codes that are the meat of AppleEvents can be impossible. perl will not fix problems with Filemaker or its documentation. Become aware of BBEdit worksheets. They work well with perl. It's almost like MacPerl under MPW. You can store command lines that you use regularly in a worksheet. Then just select and execute with the enter key or - in my case - the right mouse button. And by the way. . . perl can evaluate $y = -$x^2 and get the right answer. -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: *nix Perl newbie Question
I worry that the ~/ convention for the home directory is a shell convention. In the first case it is expanded by the shell while in the other cases it's expanded by perl. Does perl honor the option? When you say @INC is properly modified is the expansion done in the list as displayed? In either case I'd try a full pathname because it's an easy thing to do. At 14:33 -0800 2/15/04, wren argetlahm wrote: % perl -I ~/lib script.pl #!perl use module; (or moral equivalent) works fine but: % ./script.pl #!perl -I ~/lib use module; and: % ./script.pl #!perl use lib '~/lib'; use module; both return the error that they can't find the module, even though @INC is modified as it should be. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: small consulting job
At 10:55 -0600 2/3/04, Joseph Alotta wrote: I am looking for someone to write a subroutine for me involving graphics and pdf files. Please reply to me offline with an email address that works.
Re: Perl/MacPerl on MacOS X
At 16:59 -0500 1/23/04, [EMAIL PROTECTED] wrote: do shell script perl /tmp/junk.pl -- = Hello I'm afraid I don't have a handle on the Mac OS Extended file system. When you make the do shell call in Script Editor, as you demonstrated, where is the origin of the filepath? I'm not successful with SE locating my perl file, which located on my Macintosh HD. Will that be the same filepath if called from Terminal? http://developer.apple.com/technotes/tn2002/tn2065.html Will be helpful. HFS+ starts with a disk name and uses colons for file separators. There is no root except perhaps for the name of the startup disk. Also AppleScript will not honor your .login or .profile definition of $PATH and it defaults to the bash shell regardless of your choice as a user. One pretty much needs full paths for everything but POSIX path of HFS+ file path helps a lot. See also quoted form of to get the escapes escaped. If you really get involved learn about $HOME/.MacOSX/environment.plist where you can set up a default $PATH. Forget about using MacPerl with AppleScript on OS neXt. I find it easier to prepare perl scripts in an editor, make them executable with a #! line and an x permission bit. Use AppleScript only to create a Finder-executable application with a do shell script that just points to your executable. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: How to get started
At 17:53 +0100 1/21/04, manu chao wrote: Hi, I just wanted to get started by following the tutorial at http://www.mactipscafe.com/tip015/ but I get the following error: 'Exec format error. Binary file not executable.' The web page seems to show a space between the exclamation point and the /.. I have never put one there and I'm not sure it's an error to do so. Try, from Terminal perl -w ../helloWorld.pl The shell will ignore the shebang (#!) line and go directly to perl. The -w flag turns on perl's extra warnings. Also do a ls -l after you do the chmod to be sure the permissions got changed. It also wouldn't hurt to do cat helloWorld.pl just to be sure what you expect is there. If it has improper line ends or is in RTF format you'll see it. echo $PATH to be sure /usr/bin/ is in your search path which perl to be sure perl is actually installed. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Perl calling AppleScript
I just saw this on the AppleScript mailing list. John is probably not a member of this list but I'll bet someone here can help off list. Isn't there a module available? To: [EMAIL PROTECTED] From: John DeYoung [EMAIL PROTECTED] Begin copy Apologies for being a little off-topic... I've inherited a Perl script with a few routines invoking AS commands which, being written a couple of years ago, expects to make the calls through MacPerl. Needless to say, it breaks under OS X, but the client still wants to use it. As you'll soon figure out, my Perl is pretty much limited to spelling its name correctly, so I may be up against something trivial, but does anyone know how I can rewrite the MacPerl calls to run straight through the included Perl under OS X? The operative sections all look like this: { MacPerl::DoAppleScript(END_SCRIPT); tell application $myApp [...] end tell END_SCRIPT } Thanks in advance, -John DeYoung End copy -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: perl in /usr/bin
At 12:57 +0100 1/15/04, Stephan Hochhaus wrote: ps: How can I find out if a file is just a link from this: -rwxr-xr-x 2 root wheel 19944 24 Sep 09:00 perl try cd /usr/bin file perl or man file -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: confusing bullets
At 13:52 -0500 1/11/04, Vic Norton wrote: Now I seem to have resolved the problem--sort of. I believe it's a bug in BBEdit. I suspect BareBones will call it a feature. The unwillingness of BBEdit to work on a file without doing things like changing all of the line ends has been a pain. It is impossible to edit and save a file that has mixed line ends. When looking at a file, even with show invisibles enabled, it's impossible to see what kind of line end is present. It's also possible that BBEdit is preprocessing the UTF* stuff before you get to see it. I usually run to MPW on my 8500 to handle such things. BBEdit's HEX dump Tool will allow you to look at the raw file but, in ordinary Editing mode, there is no way to see, for instance, the byte order mark. HEX Dump will not allow any editing of the file. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: get contents from clipboard
It used to be, back in the days of Apple Classic, that the clipboard contained several copies of the stuff that was placed there. Each copy was identified by one of those four character type codes that are now deprecated in OS neXt. pbpaste, as a tool, does not allow tor an argument for selecting which information type is to be selected. Does it take the first type encountered? Does it default to TEXT, meaning the UTF-8 copy will be ignored? Does it read the UTF-8 version as though it were simple text? Are the type codes no longer supported in OS neXt? And, for that matter, what is the difference between the pasteboard and the clipboard anyway? Some NeXT documentation refers to the pasteboard as equivalent to the current selection, copied or not. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Cp and ditto do not always copy files the same size
At 04:32 -0500 11/25/03, Ari Kahn wrote: I use the cp or ditto commands to accomplish the last part. `cp $filename $chromat_dir`; #copy encountered file to the chromatograph_dir `ditto $filename $chromat_dir/$file_prefix$file_suffix`; I find that sometimes the sizes of the copied files are not the same. Original size 192 KB Copied size 4 KB I don't think that cp is able to copy resource forks though there may be an Apple provided option. It sounds as though you are losing them. My MPW heritage made me put this line in my .tcshrc script. alias files ls -lF \*/..namedfork/data \*/..namedfork/rsrc It will show the resource forks in the current working directory -- -- On the eighth day, about 6 kiloyears ago, the Lord realized that free will would make man ask what existed before the Creation. So He installed a few gigayears of history complete with a big bang and a fossilized record of evolution. --
Re: Cp and ditto do not always copy files the same size
At 11:53 -0500 11/25/03, Ari Kahn wrote: When I do a search for the original file, I find .../../.AppleDouble/ What is an AppleDouble? AppleDouble and AppleSingle are file formats which incorporate the resource fork and the data fork and the finder information (type/creator and some other things) into a structure for storage on a medium that does not support the HFS specialties. They are commonly used for transport of Apple files over a network. At 15:05 + 11/25/03, John Delacour wrote: --rsrc Preserve resource forks and HFS meta-data. ditto will store this data in Carbon-compatible ._ AppleDouble files on filesystems that do not natively support resource forks. I thought that AppleDouble would produce two files and that AppleSingle would produce only one but now I am a bit confused. Are you moving files from an HFS+ volume to a UFS volume? I doubt that ../../.AppleDouble/ would ever exist on an HFS+ device unless, perhaps, it got there over a modem. -- -- In Christianity, man can have only one wife. This is known as monotony. --
Re: head
At 20:20 +0100 11/23/03, Jerry Rocteur wrote: Why would a Perl Module installation wipe out a standard UNIX program 'head' with a head Perl script which is completely unrelated to the real 'head' ?? In the old days there was a problem with head and HEAD. The perl installer was accustomed to a case sensitive file system which Apple's HFS+ is not. I thought is was fixed but . . . -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: File Writing and CGI
The || and or operators differ in the evaluation of their operands. It probably doesn't matter in this particular case but don't be fooled into thinking they are the same. || and are short circuit operators that may not evaluate all of their operands. Programming Perl, 3rd edition,, page 102 At 11:42 -0500 11/21/03, Chris Devers wrote: On Fri, 21 Nov 2003, Jeremy Mates wrote: * Chris Devers [EMAIL PROTECTED] open(FILE,hello.txt) || die(Cannot Open File: $!); I find '||' far less readable than 'or', and far more likely to cause precedence problems. Though I do write fairly () free Perl code. Agreed, but I was trying not to nitpick :) I was trying to focus on the 'structural' issues, not 'stylistic' ones, but now that you mention it, the English versions of some of the operators ('or' instead of '||', 'and' instead of '') do seem to make code much more readable. open(FILE,hello.txt) or die(Cannot Open File: $!); -- -- As a citizen of the USA if you see a federal outlay expressed in $billion then multiply it by 4 to get your share in dollars. --
Re: Panther problems
2. If I must live with the current setup, how do I change my MANPATH in bash. In tcsh I would simply put the line setenv MANPATH /man:/usr/share/man: ... :${HOME}/man Personally I would change my default to tcsh in Netinfo But check out the export command in bash. -- -- In Christianity, man can have only one wife. This is known as monotony. --
Re: BBEdit-Perl confusion
At 09:56 -0400 10/16/03, Vic Norton wrote: I have recently installed Perl 5.8.0 on my iMac via PortsManager from DarwinPorts http://www.opendarwin.org/projects/darwinports/. Perl 5.8.0 resides in the /opt/local/bin directory, and this directory is at the beginning of $PATH. Everything works well except that BBEdit seems rather confused. BBEdit is almost surely executing perl 5.6 and it's probably because of a hard coded path. I had 5.8 running, with some difficulty, over a year ago from the CPAN distribution and it is in /opt/. But I had to remove 5.6 from the other directories. It was an interesting experience while I learned about gzip and tar to preserve my options. You'll be OK after that so long as the link in /usr/bin/perl points to the new version. Some have complained about Apple's installer requiring the old perl 5.6 but it has never bitten me. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
RE: BBEdit-Perl confusion
At 16:12 -0700 10/16/03, Ingles, Juan W. wrote: I wonder: Is this because /opt/local/bin/perl points to the perl 5.6 binary or 5.6 binary path is hard coded in BBEdit I don't have any /opt/local/bin/. None was created by the CPAN perl 5.8 install in July 2002 which perl on the terminal will tell you what binary you are launching It just says /usr/bin/perl and says nothing about what it links to. When I installed 5.8 I had to recreate the link for /usr/bin/perl manually and that fixed up almost everything but BBEdit 6.x was in vogue at the time and worksheets were brand new. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Cron Progress Bar in OSX
At 00:16 +0100 10/14/03, Alan Fry wrote: do shell script /Users/alanfry/Desktop/backatcha.pl results in the error: ...backatcha.pl:perl:bad interpreter:Permission denied do shell script is misnamed as are a lot of other commands in AppleScript. What it really means is Tell the OS to execute something that has been flagged as executable by setting the x bit in its permissions for the user who is making the request. It doesn't matter whether the file pointed to is a shell script or not though AppleScript does invoke the bash shell to manage the execution and can accept bash commands directly. Compiled C code and perl scripts with a #! line are equally executable but you must set that x bit. The failure you report is that you didn't have execute permission. Terminal is the easy way. The command is chmod 777 path_to_file which actually opens it up completely to anyone. The rightmost bit in each octal digit is the x bit for user, group, and world. man chmod for more. It would be nice if Finder allowed access to the x bit but it doesn't. It would be nice if Finder would execute a double-clicked file with the x bit set but. . . Steve? Is it possible to write an AppleScript to do that? -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Cron Progress Bar in OSX
At 12:03 +0100 10/13/03, Alan Fry wrote: What I miss most is the MacPerl droplet, on which you could drop a file, extract the path (into ARGV) and do something with the file. For instance I have a droplet to decode Base64 -- drop and bingo there is the decoded file. I do use AppleScript for that kind of thing. I'll try to find some samples for you. In the meantime check this out. It is a droplet to replace line ends in dropped files but ignore that and have a look at the source. ftp://ftp.macnauchtan.com/Software/LineEnds/ ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit (52 kB) It's not perl but it does show a way to make AS droplets pass filenames and arguments to executable shell tools. You should also learn about POSIX path of and quoted form of commands in AS. And similarly with more complicated issues like translating a 'pod' file to 'pdf'. Wasn't that corncob great? I changed the creator code of all .pm's to match, but all that is repaired in OS neXt.. Can anybody cheer me up? -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: Locale setting errors in Perl
At 01:58 -0700 9/28/03, Chris Cantrall wrote: If your shell is tcsh, put the following 2 lines in your .tcshrc login/setup file. setenv LANG en_US setenv LC_ALL C Remember though that your .login script will not be executed unless you log in to Darwin using Terminal or externally with ssh. The result will be that execution of perl stuff via AppleScript, BBEdit worksheets, Project Builder, the Execute-Text Service, and others will still have problems. Apple can repair it by making the login which you do with the startup window be a true *NIX login. but that seems unlikely. -- -- As a citizen of the USA if you see a federal outlay expressed in $billion then multiply it by 4 to get your share in dollars. --
Re: [OT] right mailing list for perl lwp/html question
At 21:54 +0200 9/26/03, Marco Baroni wrote: suppose I had a question about extracting plain text from web pages with perl. Is there an appropriate list for this sort of questions? The perl / curl combination is great for just that. I'd like to talk about it. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Locale setting errors in Perl
At 17:19 -0400 9/25/03, Kevin Barry wrote: perl: warning: Please check that your locale settings: LC_ALL = (unset), LANG = en_US environment.plist lives in $HOME/.MacOSX/ (with a leading dot) It is read only at login time. And that means login to the OS neXt GUI and not login via Terminal or ssh. Just creating the .plist won't do anything until you logout and login again. And. . . I do wish Apple would fix that. A login should be a login to Darwin wherever it is performed. Your LC_ALL = (unset) line is suspect: Here is my file. ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; plist version=1.0 dict keyLANG/key stringus_ENG/string keyLC_ALL/key stringC/string keyPATH/key string/Users/doug/bin:/opt/bin/perl/bin:/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools/string keyRCCOUNT/key string0/string keySHELLOG/key string/Users/doug/logs/shel_log/string keySERVER_NAME/key stringEarth/string /dict /plist -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: File write/read problem
At 06:37 -0700 9/24/03, Mark Wheeler wrote: #!/usr/bin/perl -w use strict; print Content-type: text/html\n\n; print The contents of the file: brbr; open (DATA, example.txt) || die (Could not open file br $!); my @text = DATA; print @text; close (DATA); exit; If you're calling the script from Apache or another CGI you will not see the die message. Also, from Apache the execute bit will need to be set: chmod 775 thescript.pl How about? if (! open (DATA, example.txt) { print P Could not open file, $!\n; die; } -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: File write/read problem
At 07:57 -0700 9/24/03, Mark Wheeler wrote: Yes, I am running this as a cgi. I called it from a web browser. IE 6 on a PC. Yes, the script has no Mac line endings. I wrote it on a PC using a text editor. Peecee's use a CR/LF pair for line ends. If you uploaded it in ASCII mode with ftp it should get converted to the ends in use on the server. But modern ftp clients aren't very good at that. Extra CR characters seen in the lines might cause problems with the OS neXt server which will - I'm reasonably sure - want simple LF ends. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: opening files whose names contain CRs?
At 07:19 -0700 9/15/03, Chris Nandor wrote, and I snipped: $ cat Icon^M foo ^C $ perl -e 'open $fh, Icon\r or die $!; print scalar $fh' No such file or directory at -e line 1. # add null $ perl -e 'open $fh, Icon\r\0 or die $!; print scalar $fh' foo The cat operation creates a text file with foo in the data, and only, fork. Rich's problem is opening Icon\r files which are surely from Classic icon resource files zB (using MPW on a 9.1 box): directory Ganymede: files -x br 'Icon'n'' ### OPTION-d n is a return character in classic. NameData Sz Rsrc Sz 'Icon'n'' 0b 1982b If 'Icon'n'' is opened in perl in OS neXt, will perl read from the resource fork if there is no data fork? Or will it fail to open? What about a write-enabled open? Will it write to the end of the resource fork or will it create a data fork? $ perl -e 'open $fh, Icon\r\0 or die' -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: opening files whose names contain CRs?
Icon\r files appear when, in earlier Mac OS's, a folder - directory in UNIX parlance - was to be displayed by Finder with a special icon. I'm pretty sure the files are resource-only with no data fork. You might try concatenating /..namedfork/rsrc to the path but if you do open it it will be difficult to interpret without the resources of something like ResEdit and I don't think that's an aqua APPL yet. . . . . I am surprised by the 0d0a pair that you see. That doesn't happen in the MPW world of classic OS. It's possible that the ls operation adds the 0a prior to the pipe. At 18:24 -0700 9/13/03, Rich Morin wrote: While traversing one of Eudora's subdirectories, I encountered a file whose name appears to be Icon\r, as: % pwd /Applications/Eudora Pro X/Eudora Spelling Checker % ls Ic* Icon? % ls Ic* | od -cx 000I c o n \r \n 49636f6e0d0a 006 When I try to open this file open(TMP, $path) or die can't open '$path'; I get an error. Help? -- -- On the eighth day, about 6 kiloyears ago, the Lord realized that free will would make man ask what existed before the Creation. So He installed a few gigayears of history complete with a big bang and a fossilized record of evolution. --
Re: Perl 5.8 locale
At 12:50 -0500 3/2/03, Bill Metzinger wrote: perl: warning: Please check that your locale settings: LC_ALL = (unset), LANG = en You need to create a plist file and a directory for it: $HOME/.MacOSX/environment.plist and set up LC_ALL and LANG there. Setting them in your .login, .profile, or .***rc won't work. The file is read only once at login-to-OSneXt time. It is not read on a remote login via ssh. *** begin copy of mine - watch out for mail forwarders that add returns. *** ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; plist version=1.0 dict keyRCCOUNT/key string0/string keySHELLOG/key string/Users/doug/logs/shel_log/string keyLANG/key stringus_ENG/string keyLC_ALL/key stringC/string keyPATH/key string/Users/doug/bin:/opt/bin/perl/bin:/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools/string /dict /plist -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: unix or mac-style text files?
At 16:30 -0800 11/19/02, Heather Madrone wrote: I've already encountered a few text file anomalies on OS X. Most GUI applications seem to default to Mac-style text files (linefeeds only), I think that's returns only for Mac style. Don't be fooled by MPW's and perhaps MacPerl's redefinition of \n and \r in the reverse sense from the rest of the world. I recommend use of linefeed only - ASCII 10 - for all future work in perl. BBEdit has no trouble with that. If you're even a little bit involved with moving perl scripts to some UNIX server where your web pages are based you'll find that your scripts move effortlessly with any kind of file transfer. OT The internet norm is a linefeed-return pair which is really strange because in the days of teletype one sent the return first because it took longer than the linefeed and one needed a few null characters to be sure the operation completed at 100 baud. Of course you had the option of sending the return only and repeating the line to get a bold appearance. If you don't believe that look at a UNIX man page with repeated characters and backspaces. /OT -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Darwin darwin or darwin6.0
We are getting somewhere here. I think I have to add code to support MacPerl and perl running under Windoze or DOS. Perhaps Parrot/Perl6 will fix it all up. Using MPW on MacOS 9.1 perl -v This is perl, version 5.004 perl -e 'print `uname`;' ### ToolServer - Command uname was not found. (Not surprising.) perl -e 'print $^O;' MacOS Over on the MacPerl list the suggestion is to use Gestalt but I'll bet one can't do that until after the OS is determined somehow. I donno about uname on a M$ box but $^O returns: MSWin32 or dos depending on how the perl script is executed, booting into real DOS or emulated DOS under Windoze. Note the non-use of lowercase in both MacPerl and Windoze versions. I'm pretty sure it's Active Perl but I really don't know what's in use at the other end. At 13:45 -0500 11/16/02, William H. Magill wrote: opsys=`uname -a | cut -d -f1` print opsys = $opsys case $opsys in OSF1) ?? DPM Is that for Open Software Foundation - Linux? SunOS) ?? DPM My ISP returns solaris for $^O in perl 5.00x but SunOS using uname. HP-UX) AIX) Darwin|darwin) esac -- -- In Christianity, man can have only one wife. This is known as monotony. --
Darwin darwin or darwin6.0
What is the official name of the operating system under MacOS neXt? Where does perl get it? I need it so that I can write perl and shell scripts that can be tested on a Mac and then run under Solaris. I solicit comments on the most reliable way to keep things working at least until next week. From Terminal or a BBEdit window: echo $OSTYPE darwin From within a cron job: echo $OSTYPE $HOME/bin/cronlog darwin6.0 uname $HOME/bin/cronlog Darwin From perl executed from terminal: print $^0 -- darwin From perl executed from cron: print $^0 -- darwin From a BBEdit worksheet or from terminal: perl -e 'print `uname`;' Darwin Using bash: if [ $(uname) = Darwin ] ; then works. Note the capital D. It fails with darwin. -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: LWP install
I had the same problems. The readme talks about other required modules and then those talk about others. It's a recursive exercise apparently done for us in the MacPerl world. (Thanks Chris) After a couple of hours I found my way thru CPAN getting one missing module at a time. It appears that the warning messages just point out things you can install afterwards though. The URI and HeadParser aka the HTML module are pretty much required. Base64 and FTP seem not to be used for LWP::simple. At 10:50 +0100 10/30/02, Tom Holland wrote: Warning: prerequisite HTML::HeadParser failed to load:. Warning: prerequisite MIME::Base64 failed to load:3. Warning: prerequisite Net::FTP failed to load: Warning: prerequisite URI failed to load: -- Applescript syntax is like English spelling: Roughly, but not thoroughly, thought through.
Re: LWP install
Actually Chuck sent this to me. This is one of those lists that has a hangup about changing the reply to: header so that it defaults to the list. Someday I'll learn about bundles but as of now it's up to someone else to answer. And - while were at it? Is there a document somewhere that talks about just where modules ought to be installed. I can find no evidence of /site-perl/ on my system and there are at least three /Library/ folders buried in the perl zoo. The make-install procedures seem to have a mind of their own and I have no idea where things are going. At 16:38 -0500 10/30/02, Chuck Jacobson wrote: My understanding (possibly wrong) is that if there is a budle available (i.e. Bundle::LWP) that will install any needed prereqs too. Is this correct? I just installed Bundle::Slash and it seemed to download all the necessary modules. BTW, if anyone has Slash going on their system please email me. I have it installed and would like some advice on how to set it up. Thanks! - Chuck Jacobson, Technical Systems Specialist North Central Baptist Church, Gainesville, FL http://www.northcentralbaptist.org/ - -- -- As a citizen of the USA if you see a federal outlay expressed in $billion then multiply it by 4 to get your share in dollars. --