AnyEvent-APNS
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $who = $self->_caller;
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.
If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).
lib/AnyEvent/APNS.pm view on Meta::CPAN
use Any::Moose;
use AnyEvent 4.80;
use AnyEvent::Handle;
use AnyEvent::Socket;
use AnyEvent::TLS;
require bytes;
use Carp qw(croak);
use Encode;
use Scalar::Util 'looks_like_number';
use JSON::Any;
our $VERSION = '0.10';
has certificate => (
is => 'rw',
isa => 'Str | ScalarRef',
required => 1,
);
lib/AnyEvent/APNS.pm view on Meta::CPAN
my $h = $self->handler;
$h->push_write( pack('C', 1) ); # command
$h->push_write( pack('N', $next_identifier) );
$h->push_write( pack('N', $expiry) );
$h->push_write( pack('n', bytes::length($token)) ); # token length
$h->push_write( $token ); # device token
# Apple Push Notification Service refuses string values as badge number
if ($payload->{aps}{badge} && looks_like_number($payload->{aps}{badge})) {
$payload->{aps}{badge} += 0;
}
# The maximum size allowed for a notification payload is 256 bytes;
# Apple Push Notification Service refuses any notification that exceeds this limit.
if ( (my $exceeded = bytes::length($json) - 256) > 0 ) {
if (ref $payload->{aps}{alert} eq 'HASH') {
$payload->{aps}{alert}{body} =
$self->_trim_utf8($payload->{aps}{alert}{body}, $exceeded);
}
( run in 0.427 second using v1.01-cache-2.11-cpan-64827b87656 )