0

I want to create pdf using XSLT, ApacheFOP use in PERL. Can anyone Help me?

    use 5.010;
use warnings;
use strict;
use XML::ApacheFOP;
my $Fop = XML::ApacheFOP->new();
$Fop->fop( xml => "math.xml", xsl => "math.xsl", outfile => "temp.pdf" ) or die "cannot create pdf: " . $Fop->errstr;

Error showing in cmd line can't locate XML/ApacheFOP.pm

Sam
  • 841
  • 1
  • 5
  • 15
  • Looks like the perl module ```XML::ApacheFOP``` is not installed in your system. – vkk05 Nov 06 '19 at 13:42
  • @vinodk89 I have run for this command cpanm XML::ApacheFOP but not install this module. How can I install this Module? – Sam Nov 06 '19 at 13:48
  • The documentation [SETUP](https://metacpan.org/pod/XML::ApacheFOP#SETUP) says you need java2 to be installed first before installing this module. – vkk05 Nov 06 '19 at 14:10

2 Answers2

1

This is almost certainly because XML::ApacheFOP isn't installed. In a comment, you say that you have tried to install the module using cpanm, but it hasn't installed successfully. It would be useful to see the error messages that are displayed.

The SETUP section of the documentation says that you will need FOP installed before installing the module. If you're on Ubuntu, then that might be as easy as running sudo apt-get install fop. You should then try the module installation again. If it still fails, then ask a new question here, making sure to include the text of the error messages you get from cpanm.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • Sir, if i am run the command "cpan install XML::ApacheFOP" in cmd prompt then last messasge showing "You can't run these tests unless JavaServer is running\n" Do you want to continue? (Y/n) if i m given the Y then show "Stopping: 'install' faild for 'Java'". I have already install Java my system. – Sam Nov 07 '19 at 07:18
  • And if i am another 2nd command "cpanm XML::ApacheFOP" then showing the message "Building and testing Java-4.7 ...." stop not continue. – Sam Nov 07 '19 at 07:26
  • The SETUP section that I linked to in my answer says that the FOP JavaServer needs to be running in order to use (or, obviously, test) the module. Just installing FOP isn't enough, you need to start it. – Dave Cross Nov 07 '19 at 08:04
  • Sir, i have Download fop-2.4-bin.zip and extract the file after that move the file in C:\fop-2.4 but this avalon-framework-cvs-20020806.jar file missing in lib folder. how to add the classpath in System and afterthat run my perl script? – Sam Nov 07 '19 at 11:39
  • @Sandy: I'm afraid I know almost nothing about Java, FOP or developing on a Windows machine. I don't think I can be any more help here. – Dave Cross Nov 07 '19 at 12:31
  • Sir, how to use this command =====/path/to/java -classpath \ /path/to/JavaServer.jar\ :/usr/local/xml-fop/build/fop.jar\ :/usr/local/xml-fop/lib/avalon-framework-cvs-20020806.jar\ :/usr/local/xml-fop/lib/batik.jar\ :/usr/local/xml-fop/lib/xalan-2.4.1.jar\ :/usr/local/xml-fop/lib/xercesImpl-2.2.1.jar \ com.zzo.javaserver.JavaServer ========= for the server is connect? – Sam Nov 08 '19 at 13:06
  • @Sandy: I know nothing about this area. I can't be any more help to you. – Dave Cross Nov 08 '19 at 13:33
0

The error indicates that your perl distro does not include XML::ApacheFOP module.

The module can be installed in several ways:

cpan install XML::ApacheFOP

or

cpanm XML::ApacheFOP

or

perl -MCPAN -e install XML::ApacheFOP

or download module extract it and run makefile.

It was pointed out that this particular module has java as pre-requisite and should be installed as well.

How to install CPAN modules

FAQ installing CPAN perl modules

How to install perl modules

What's the easiest way to install perl module?

Polar Bear
  • 6,762
  • 1
  • 5
  • 12