jonasbn writes "An article on Perl, AppleScript, and Web Services by Randal L. Schwartz has been published on O'ReillyNet." See AppleScript and Perl work together!
Re:Full Access, My Access
jdavidb on 2002-09-25T13:28:54
I always found I had everything I needed with MacPerl. It even came with lots of extra goodies you didn't get with the standard distribution.
I first installed MacPerl on our Mac LCIII in 1998 (about four months after I learned Perl). It quickly became the only programming language I used on the Mac. It was also the first Perl 5 I ever used. (We were still on 4 at work at that point.)
I wrote my first LWP program with MacPerl sometime in 2000/2001. To my shame, I've never installed one of the more recent MacPerls, since pudge took over. The only reason is I started gradually moving away from the Mac platform.
Great program, and I don't ever recall anything missing. On the contrary, when I wanted to install a module that didn't come with the standard Perl distribution, I usually found it had been conveniently included for me.
:) Re:Full Access, My Access
merlyn on 2002-09-25T16:32:51
Well yes, in defense, there was a nice edit applied to my original text, as always. So some of the tone was changed. That's typical.The article was to show the SOAP interface. Certainly, I'd personally write the entire thing in Perl, except that I'd have to call
to launch the user's preferred browser, and perhaps to get the temporary area if I didn't just want to usesystem 'osascript', '-e', "open $htmlfile";/tmp. However, the SOAP interface between the AS side and the Perl side was very nice. The data just fell into place.
And I'll admit that my knowledge of OS9 MacPerl is limited. You obviously have a better handle on that. I didn't realize that the very intense SOAP::Lite would install nicely under OS9 MacPerl. Congratulations on your hard work if does.
Re:Full Access, My Access
pudge on 2002-09-25T17:02:26
Yes, you'd need to use osascript (for now... my evil plans include fixing that, someday) or simply the "open" command line program. Although, you could try PerlObjCBridge.pm, but I have no idea how to do it that way. Also, you could access the Temporary Items directory using Carbon (and possibly Cocoa) calls, but yeah, same thing. Or you could use Inline. Wheeeee!
I do realize that it was more just an example of interaction, and not "you should do it this way," I was pointing this out merely because the AppleScript you provided does not work on Mac OS, so I added that the whole thing could be done in MacPerl without the need for AppleScript.
Anyway, assuming you mean "Mac OS" when you say "OS9",* I actually don't recall how well it installed. It probably installed just fine; almost all CPAN distributions do. But even if it didn't, it is easy to just copy the files to the right place by hand (though I think this was not necessary).
But it works just fine, which is more important than installing just fine.:-) I've been using SOAP::Lite's client for many moons on MacPerl, and as noted, this morning, tried your server code, and (aside from changing the IP address) it just worked. Script Editor talked to MacPerl, MacPerl used SOAP::Lite to get the data and return it, Script Editor opened TextEdit (not my browser ... that part was weird).
Again, though, I liked the article, and hope we see more articles about using perl on Mac OS X. If you've not seen it, you may wish to check out my YAPC talk from earlier this year, which deals with a lot of issues with integrating perl with Mac OS X.
* There is no such thing as "OS9". I don't care if you think I am being overly pedantic.:p
Also, note that there is no Mac OS MacPerl (let alone OS9 MacPerl), there is just MacPerl. MacPerl is essentially defined as "the application implementing the port of perl for Mac OS", so saying "Mac OS" (let alone "OS9") as a prefix is redundant.
Re:Full Access, My Access
jhi on 2002-09-25T17:18:58
> * There is no such thing as "OS9". I don't care if you think I am being overly pedantic.:p But there is... though not for Apple
:-) I know of at least OS9 for MC6809 based computers. It's vaguely UNIX-like multitasking multiuser OS, used for example in the Dragon microcomputer. I I think remember people running BBSes on top of this.
Then there was OS9 for the Sinclair QL and the BBC Micro, of which I know little. I *think* this was one of the 80's "BASIC OSes".
Re:Full Access, My Access
pudge on 2002-09-25T17:23:01
Yeah, exactly! This is my problem with this stuff. OS9 is something else, and I quite honestly have no idea half the time when someone says "I can't get this program to work under X." Grrrrr.:-) Re:Full Access, My Access
jdavidb on 2002-09-25T18:52:37
I don't care if you think I am being overly pedantic.
:p Hehe; you're not cut from the same cloth as RMS, are you?
;) Re:Full Access, My Access
pudge on 2002-09-25T19:50:49
No, because I am not making up a name for the OS after the fact, I am using its actual name.:-) Re:Full Access, My Access
bart on 2002-09-26T10:05:20
Perhaps this problem is related to the Creator Type of the "HTML" file?Script Editor opened TextEdit (not my browser... that part was weird). I would think, MacOS-X being more Unix-like than MacOS9, that the former checks out the file's extension. But that notion is unknown under earlier MacOSes.
Re:Full Access, My Access
Sherm on 2002-10-06T22:36:22
Although, you could try PerlObjCBridge.pm, but I have no idea how to do it that way.
You'd want to use NSWorkspace, but I'm not sure if PerlObjCBridge wraps AppKit classes - I had the impression that it didn't. Here's how you'd do it in CamelBones:
NSWorkSpace->sharedWorkspace->openFile($htmlfile);Re:Full Access, My Access
Elian on 2002-09-25T17:22:59
personally write the entire thing in Perl, except that I'd have to call
to launch the user's preferred browser, and perhaps to get the temporary area if I didn't just want to usesystem 'osascript', '-e', "open $htmlfile";/tmp.
Nah. Just use Mac::AppleScript instead.Re:Full Access, My Access
pudge on 2002-09-26T12:21:35
Mac::AppleScript is not yet available, when I checked yesterday.
However, OSXMacPerl is a "port" of MacPerl.pm to Mac OS X, and includes MacPerl::DoAppleScript().
Re:Full Access, My Access
Elian on 2002-09-26T13:33:31
It's there, and has been there since the 8/29. (
http://www.cpan.org/authors/Dan_Sugalski/Mac-AppleScript-0.03.tar.gz is the current version) Not showing on search, though. Have to see why.Re:Full Access, My Access
pudge on 2002-09-26T13:36:42
D'oh! Cool.