NAME

DDC::Any - abstract wrapper for DDC::XS or DDC::PP

SYNOPSIS

 ##=====================================================================
 ## Preliminaries
 use DDC::Any;          ##-- use DDC::XS if available, otherwise DDC::PP
 use DDC::Any ':xs';    ##-- force DDC::XS back-end
 use DDC::Any ':pp';    ##-- force DDC::PP back-end
 use DDC::Any ':none';  ##-- don't load or bind a back-end yet (call import() yourself later)

 ##=====================================================================
 ## Package Variables
 my $which = $DDC::Any::WHICH;          ##-- either 'DDC::XS' or 'DDC::PP'
 my $xsver = $DDC::Any::MIN_XS_VERSION; ##-- currently v0.21

 ##=====================================================================
 ## Usage
 ##  ... address any DDC::(XS|PP)::* thingy as DDC::Any::*
 my $query = DDC::Any->parse("foo && bar && !baz");
 print $query->toStringFull();
 print $query->isa('DDC::Any::CQuery') ? "yup\n" : "nope\n";

DESCRIPTION

This module provides a unified API for parsing and manipulation of DDC search engine queries, using either DDC::XS or DDC::PP as a back-end. Using this package will walk the symbol table of the selected back-end namespace and recursively map variables, methods, and sub-packages to the DDC::Any namespace, thus the class DDC::Any::CQToken will be mapped to either DDC::XS::CQToken or DDC::PP::CQToken, depending on the back-end. Additionally, back-end subpackages will be modified to inherit from the associated DDC::Any subpackage, so that that you can generically test for inheritance using for exanple UNIVERSAL::isa($query,'DDC::Any::CQToken') on a $query object of an appropriate back-end type. You can specify either :xs or :pp in the argument-list to use (rsp. DDC::Any->import()) in order to force use of a particular back-end.

ACKNOWLEDGEMENTS

perl by Larry Wall.

DDC originally by Alexey Sokirko.

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT

Copyright (c) 2016-2018, Bryan Jurish. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

perl(1), DDC::XS(3perl), DDC::PP(3perl)