| 1 | # Copyrights 2007-2021 by [Mark Overmeer <markov@cpan.org>]. | ||
| 2 | # For other contributors see ChangeLog. | ||
| 3 | # See the manual pages for details on the licensing terms. | ||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||
| 5 | # This code is part of distribution XML-Compile-SOAP. Meta-POD processed | ||
| 6 | # with OODoc into POD and HTML manual-pages. See README.md | ||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||
| 8 | |||
| 9 | package XML::Compile::XOP; | ||
| 10 | use vars '$VERSION'; | ||
| 11 | $VERSION = '3.27'; | ||
| 12 | |||
| 13 | |||
| 14 | use warnings; | ||
| 15 | use strict; | ||
| 16 | |||
| 17 | use Log::Report 'xml-compile-soap'; | ||
| 18 | |||
| 19 | use XML::Compile::SOAP::Util qw/:xop10/; | ||
| 20 | use XML::Compile::XOP::Include (); | ||
| 21 | |||
| 22 | XML::Compile->addSchemaDirs(__FILE__); | ||
| 23 | XML::Compile->knownNamespace | ||
| 24 | ( &XMIME10 => '200411-xmlmime.xsd' | ||
| 25 | , &XMIME11 => '200505-xmlmime.xsd' | ||
| 26 | ); | ||
| 27 | |||
| 28 | |||
| 29 | sub new(@) { my $class = shift; (bless {})->init( {@_} ) } | ||
| 30 | |||
| 31 | sub init($) | ||
| 32 | { my ($self, $args) = @_; | ||
| 33 | |||
| 34 | $self->{XCX_xmime} = $args->{xmlmime_version} || XMIME11; | ||
| 35 | $self->{XCX_xop} = $args->{xop_version} || XOP10; | ||
| 36 | $self->{XCX_host} = $args->{hostname} || 'localhost'; | ||
| 37 | $self->{XCX_cid} = time; | ||
| 38 | $self; | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | sub _include(@) | ||
| 43 | { my $self = shift; | ||
| 44 | XML::Compile::XOP::Include->new | ||
| 45 | ( cid => $self->{XCX_cid}++ . '@' . $self->{XCX_host} | ||
| 46 | , xmime => $self->{XCX_xmime} | ||
| 47 | , xop => $self->{XCX_xop} | ||
| 48 | , type => 'application/octet-stream' | ||
| 49 | , @_ | ||
| 50 | ); | ||
| 51 | } | ||
| 52 | sub file(@) { my $self = shift; $self->_include(file => @_) } | ||
| 53 | sub bytes(@) { my $self = shift; $self->_include(bytes => @_) } | ||
| 54 | |||
| 55 | |||
| 56 | 1; |