Net-AMQP-PP

 view release on metacpan or  search on metacpan

lib/Net/AMQP/PP.pm  view on Meta::CPAN

package Net::AMQP::PP;
use strict;
use warnings;
use JSON ();

our $VERSION = '0.01';

my $data = JSON::from_json(
q[{"domain":{"delivery tag":{"type":"longlong"},"exchange name":{"type":"shortstr"},"reply code":{"type":"short"},"consumer tag":{"type":"shortstr"},"path":{"type":"shortstr"},"class id":{"type":"short"},"access ticket":{"type":"short"},"queue name":...

sub import {
    local $INC{"XML/LibXML.pm"} = 1;
    require Net::AMQP;
    require Net::AMQP::Protocol;
    no warnings 'redefine';
    *Net::AMQP::Protocol::load_xml_spec = sub {
        %Net::AMQP::Protocol::spec = %$data;
        foreach my $key (keys %{$data->{class}}) {
            Net::AMQP::Protocol::_build_class($data->{class}{$key});
        }
        $data;
    };
}

1;

=head1 NAME

Net::AMQP::PP - Nasty hack for when you want pure perl AnyEvent::RabbitMQ

=head1 SYNOPSIS

    use Net::AMQP::PP;
    use AnyEvent::RabbitMQ; # Note - order is important!

=head1 DESCRIPTION

This module horribly monkeypatches NET::AMQP to avoid it's need
to load L<XML::LibXML>.

This code does disgusting things, and should be considered alpha quality.

It uses the flavour of the AMQP spec inlined into L<AnyEvent::RabbitMQ>
to be compatible with that module.

Note that this module depends on L<Net::AMQP>, which cannot be installed
without L<XML::LibXML>, and therefore is only useful when you're
trying to make something with L<App::FatPacker>.

=head1 AUTHOR

Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>.

=head1 COPYRIGHT

The above author

=head1 LICENSE

Perl licensed.

=cut




( run in 0.650 second using v1.01-cache-2.11-cpan-39bf76dae61 )