On Nov 5, 2005, at 6:18 PM, Bill Stephenson wrote:

First, how hard is it to create an "Mac OS X Installer" that can set this up on any mac to run without an internet connection? I played around with this a little a long time ago, but had trouble getting file permissions set-up right and turning on apache, and never even tried to install perl modules.

It's not all that hard - although Apple's PackageMaker.app ain't the greatest. I prefer Stéphane Sudre's Iceberg:

        <http://s.sudre.free.fr/Software/Iceberg.html>

The trick to making installers for Perl modules is separating out the files that belong to the module you want to install. One easy way to do that is to start with a "clean" /Library/Perl directory, install everything your app needs, and then make an installer package that installs the whole shebang.

A finer-grained method, supported by Perl 5.8.x and newer, is to use the "DESTDIR" option when installing. You need to download and build the modules by hand, beginning with the normal recipe - "perl Makefile.PL; make; make test".

But, for the last step include an additional parameter that specifies a location under which the files will be installed: "make install DESTDIR=/tmp/foo" for instance. This directory will be prepended to the actual file path, so if a file's real location is supposed to be / Library/Perl/foo.txt, using this example it would be copied to /tmp/ foo/Library/Perl/foo.txt.

If your Perl modules depend on external libraries, you'll need to be sure to include those, one way or another - either build static libraries and link against those, or include the dynamic libraries with your installer. The DESTDIR option for "make install" is worth trying for libraries that build with the common "configure; make" sequence - it's widely supported.

Whether Apache is started is governed by the WEBSERVER entry in /etc/ hostconfig. You could edit that in a postflight script included in your installer package, and then run "apachectl start" to start Apache.

Second, is it possible create a way to run my content in a native MacOS X Window instead of the web browser? If this could be done, and I could connect the window and "main menu bar" at the top of the screen to my perl CGI script, then I'd almost have a native Mac OS X "Look and Feel" with little additional effort.

I'm not sure I agree with the premise that a web form with an app wrapper around it would have a native l&f... but whatever.

One possibility - Include an Apache config file in your app bundle that configures Apache to listen to a "high" port - i.e. >1024. Have your app start its own copy of httpd, using the -f option to tell it to use your custom config file. Because your app might get moved, don't hard-code the path to the included CGIs - instead, use NSBundle methods to get the location of the bundle, and use that with the -C option to httpd.

The other half of the equation, a web browser container to connect to your embedded server, is simple to do with WebKit.

It seems that maybe Sherm's stuff (CamelBones and FatCamel) might already provide much of what is need to do these things.

Maybe... maybe not. FatCamel is old, and I don't plan to update it - Apple is doing better now about keeping up with reasonably current Perls, and for folks who want pre-compiled binary modules, there's ActivePerl.

Your CGI stuff is in Perl, but you probably wouldn't be using CamelBones for that.

The WebKit "container" app could be written in Perl using CamelBones, but there's no particular reason you'd *need* to write that in Perl, and not much benefit in terms of easier maintenance, code reuse, etc. in doing so.

CamelBones would be most helpful if you want to refactor your app into an MVC design. You could re-use your model classes in both the web and GUI versions of your app, with different view and controller layers for each.

Finally, Does this make any sense to anyone else

In general, I'm fairly skeptical about the current trend to "webify" everything in sight. Web forms just aren't well-suited to some kinds of tasks. Take Google Groups for instance - as a search engine it's great, but as a general news reader it's horrid. I'd take Unison, Thoth, or Gnus over that, any day.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Reply via email to