Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

problem with Mac::Notification::NMInstall()

by shriken (Priest)
on May 07, 2004 at 22:30 UTC ( #351630=perlquestion: print w/replies, xml ) Need Help??
shriken has asked for the wisdom of the Perl Monks concerning the following question:

I'm not sure if this is a problem with the configuration of the Mac os X (panther, 10.3.3) system, or the way I'm using this module.

Perl v5.8.3, Mac::etc modules are up-to-date with CPAN.

The why is long; basically, I have a program I want to run periodically via cron on this Mac. Under certain conditions, I want to pop-up a dialog to notify the user. Here's the test case:
#!/usr/bin/perl use diagnostics; use strict; use Mac::Notification; my($foo) = new NMRec( nmStr => "hello world" ); NMInstall($foo); sleep(10); exit;
Runs perfectly, no whining/warnings. Dialog appears. Dialog can be dismissed, or it goes way after 10 seconds when Perl cleans up...

Next I try to run the test case from cron. I've tried this as the user who is currently logged onto the Mac, and as the 'root' user. In both cases, I'm getting the error message output via cron. Excerpt:

RegisterProcess failed (error = -50)

Now for the curveball. The Mac is using postfix for it's mail daemon and postfix (which I don't understand all) is throwing the output in a mail spool directory and it has high-ascii characters in it... So I'm not sure if there's reall a space in RegisterProcess (for example), or some other hairy detail in the error message that I just can't make out.

Since it works command line, and the modules load under cron, I'm guessing this is some sort of "security" issue where I'm not being allowed (by the mac os) to use the notification manager from cron.

Any help?

Replies are listed 'Best First'.
Re: problem with Mac::Notification::NMInstall()
by eXile (Priest) on May 08, 2004 at 00:37 UTC

    Could this have something to do with the environment being different for the cron-job and for the interactive user. What you could try to do is run this one-liner both as interactive user and from cron, redirect the output to a file and check the differences:

    perl -MData::Dumper -e'print Dumper %ENV'

    Hope this helps.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://351630]
Approved by matija
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-03-29 14:05 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (351 votes). Check out past polls.