Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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?

Comment on problem with Mac::Notification::NMInstall()
Download Code
Re: problem with Mac::Notification::NMInstall()
by eXile (Priest) on May 08, 2004 at 00:37 UTC
    Hi,

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://351630]
Approved by matija
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2014-11-28 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls