|
NAMEXML::Pastor::Generator - Module used internally by XML::Pastor for generating Perl code from a schema model.WARNINGThis module is used internally by XML::Pastor. You do not normally know much about this module to actually use XML::Pastor. It is documented here for completeness and for XML::Pastor developers. Do not count on the interface of this module. It may change in any of the subsequent releases. You have been warned.ISAThis class descends from Class::Accessor.SYNOPSISmy $parser = XML::Pastor::Schema::Parser->new(); my $model = $parser->parse(schema => '/tmp/schema.xsd'); my $generator = XML::Pastor::Generator->new(); $generator->generate ( model => $model, mode => 'offline', style => 'multiple' ); DESCRIPTIONXML::Pastor::Generator is used internally by XML::Pastor for generating Perl code from a schema model (XML::Pastor::Schema::Model) that was produced by XML::Pastor::Schema::Parser and properly resolved prior to code generation.In 'offline' mode, it is possible to generate a single module with all the generated clasess or multiple modules one for each class. The typical use of the offline mode is during a 'make' process, where you have a set of XSD schemas and you generate your modules to be later installed by the 'make install'. This is very similar to Java Castor's behaviour. This way your XSD schemas don't have to be accessible during run-time and you don't have a performance penalty. Perl philosophy dictates however, that There Is More Than One Way To Do It. In 'eval' (run-time) mode, the XSD schema is processed at run-time giving much more flexibility to the user. This added flexibility has a price on the other hand, namely a performance penalty and the fact that the XSD schema needs to be accessible at run-time. Note that the performance penalty applies only to the code genereration (pastorize) phase; the generated classes perform the same as if they were generated offline. METHODSCONSTRUCTORSnew()XML::Pastor::Generator->new(%fields) CONSTRUCTOR. The new() constructor method instantiates a new XML::Pastor::Genertor object. It is inheritable. Any -named- fields that are passed as parameters are initialized to those values within the newly created object. . OTHER METHODSgenerate()$generator->generate(%options); This is the heart of the module. This method will generate Perl code (either in a single module or multiple modules) and either write the code to module file(s) on disk or evaluate the generated code according to the parameters passed. The Perl code will be generated from the model (XML::Pastor::Schema::Model) that is passed as an argument. All the type and element definitions found in the model will have a corresponding generated Perl class. In "offline" mode, the generated classes will either all be put in one "single" big code block, or in "multiple" module files (one for each class) depending on the "style" parameter. Again in "offline" mode, the generated modules will be written to disk under the directory prefix given by the "destination" parameter. OPTIONS This method expects the following parameters:
. BUGS & CAVEATSThere no known bugs at this time, but this doesn't mean there are aren't any. Note that, although some testing was done prior to releasing the module, this should still be considered alpha code. So use it at your own risk.Note that there may be other bugs or limitations that the author is not aware of. AUTHORAyhan Ulusoy <dev(at)ulusoy(dot)name>COPYRIGHTCopyright (C) 2006-2007 Ayhan Ulusoy. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSOSee also XML::Pastor, XML::Pastor::ComplexType, XML::Pastor::SimpleTypeAnd if you are curious about the implementation, see XML::Pastor::Schema::Parser, XML::Pastor::Schema::Model
Visit the GSP FreeBSD Man Page Interface. |