XML::XSH2::Compile - Create modules with built-in XSH commands


XML-XSH2 documentation Contained in the XML-XSH2 distribution.

Index


Code Index:

NAME

Top

XML::XSH2::Compile - Create modules with built-in XSH commands

SYNOPSIS

Top

   package Foo;

   # perl code

   use XML::XSH2::Compile;

   # XSH Language commands (see L<XSH>)

   no XML::XSH2::Compile;

   # perl code
   1;

DESCRIPTION

Top

With this module one can efficiently embed XSH2 scripts into Perl modules. In this respect, it is similar to XML::XSH2::Inline, but with XML::XSH2::Compile, all XSH2 blocks are compiled into Perl code the first time the module is run. This makes them execute faster any later time. The compiled result is cached in a ".pmc" file.

See Module::Compile for more details.

REQUIRES

Top

Module::Compile, XML::XSH2

EXPORTS

Top

None.

AUTHOR

Top

Petr Pajas, pajas@matfyz.cz

SEE ALSO

Top

Module::Compile, xsh, XSH, XML::XSH2, XML::XSH2::Inline


XML-XSH2 documentation Contained in the XML-XSH2 distribution.

# $Id: Compile.pm,v 1.2 2007-01-02 22:03:22 pajas Exp $

package XML::XSH2::Compile;
use Module::Compile -base;

use vars qw($VERSION);

use strict;
  $VERSION='2.1.1'; # VERSION TEMPLATE

sub pmc_compile {
  my ($class, $source) = @_;
  require XML::XSH2;
  my $dump='';
  $XML::XSH2::Functions::DUMP=\$dump;
  XML::XSH2::set_compile_only_mode(1);
  XML::XSH2::set_quiet(1);
  XML::XSH2::xsh($source);
  return $dump;
};

1;