Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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
[ambrus]: choroba: heh heh... I have such a doc bug report somewhere. fixed by now.
[Corion]: Once upon a time I had automatic tests for checking the synopsis, but I stopped doing that because the setup was too fragile on CPAN testers for extracting code from the SYNOPSIS.
[Corion]: Maybe I should move the extraction of the code from the SYNOPSIS section into the author tests, or something like that...
[choroba]: Corion Sounds reasonable

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-02-27 12:10 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (383 votes). Check out past polls.