Mac-OSA-Notification-Tiny

 view release on metacpan or  search on metacpan

lib/Mac/OSA/Notification/Tiny.pm  view on Meta::CPAN

package Mac::OSA::Notification::Tiny;

use 5.006; use strict; use warnings; our $VERSION = '1.01';

use base 'Import::Export';

our %EX = (
	notification => [qw/all/]
);

sub notification {
	my %params = ref $_[0] ? %{ $_[0] } : @_;
	readpipe(sprintf q|osascript -e "display notification \"%s\"%s%s%s"|, $params{m} || 'No message param passed - m',
		( $params{t} ? sprintf q| with title \"%s\"|, $params{t} : ''),
		( $params{s} ? sprintf q| subtitle \"%s\"|, $params{s} : ''),
		( $params{n} ? sprintf q| sound name \"%s\"|, $params{n} : ''));
}

1;

__END__

=head1 NAME

Mac::OSA::Notification::Tiny - native mac notifications

=head1 VERSION

Version 1.01

=cut

=head1 SYNOPSIS

	use Mac::OSA::Notification::Tiny qw/all/;

	notification(
		t => 'Flat World',
		s => 'flat.world-wide.world',
		m => 'The motive for world governments concealment of the true shape of the Earth has not been ascertained.',
		n => 'Purr'
	);


=head1 DESCRIPTION

A notification is a popup that appears when an application/script wants you to pay attention.

=head1 EXPORT

=head2 notification

Trigger a native notification from a script.

	notification(
		m => $message,
		t => $title,
		s => $subtitle,
		n => $noise
	);

The following are valid options for the notifications noise:

=over

=item Basso

=item Blow

=item Bottle

=item Frog

=item Funk

=item Glass

=item Hero

=item Morse

=item Ping

=item Pop

=item Purr

=item Sosumi

=item Submarine

=item Tink

=back

=head1 AUTHOR

LNATION, C<< <email at lnation.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-mac-osa-notification-tiny at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mac-OSA-Notification-Tiny>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT



( run in 1.234 second using v1.01-cache-2.11-cpan-364913b4093 )