Hi, I'm not sure if this question is appropriate for this list, but I'm hoping someone here might be able to offer some advice.
I've been trying to get the perl bindings OpenOffice::UNO to work, and it seems really really close to working - it connects to the ServiceManager but fails to obtain the Desktop object. I obtained the package from here: http://search.cpan.org/~mbarbon/OpenOffice-UNO-0.07/UNO.pm As a comparison I installed the py-uno package and got a test script working fine in python, so I think the environment is ok. I'm using ubuntu packages on two different machines, with 3.2.0 on one and and 3.1.0 on the other. Results are the same. I have tried 3 different variation of the statement to create the desktop object, but they all fail with the error: terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException' my $desktop = $smgr->createInstance( "com.sun.star.frame.Desktop"); #my $desktop = $smgr->createInstanceWithContext( "com.sun.star.frame.Desktop", $rc); #my $desktop = $smgr->createInstanceWithContext( "com.sun.star.frame.Desktop", $remoteContext); Any advice would be much appreciated. The python version of the script uses the same method calls and works perfectly, and goes on to happily modify a spreadsheet document. All 3 method variations work in the python version. Here's the output of the script: <begin> m...@nova:~/OpenOffice_UNO$ ./perl_uno_test.pl Created Local Context at ./perl_uno_test.pl line 20. Got resolver at ./perl_uno_test.pl line 27. Got Remote ServiceManager at ./perl_uno_test.pl line 36. terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException' <end> and here's the source: <begin> #!/usr/bin/perl use strict; use OpenOffice::UNO; use Cwd; use Data::Dumper; our $SMGR_URL = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; # connect to the OpenOffice.org server #$uno = OpenOffice::UNO->new; my $uno = new OpenOffice::UNO(); my $localContext = get_context($uno); warn "Created Local Context"; # create the UnoUrlResolver my $resolver = $localContext->getServiceManager->createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", $localContext ); warn "Got resolver"; # connect to the running office my $remoteContext = $resolver->resolve( "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext" ); warn "Got remoteContext: " . Dumper($remoteContext); my $smgr = $remoteContext->getServiceManager(); warn "Got Remote ServiceManager"; my $rc = $smgr->getPropertyValue("DefaultContext"); # get the central desktop object my $desktop = $smgr->createInstance( "com.sun.star.frame.Desktop"); #my $desktop = $smgr->createInstanceWithContext( "com.sun.star.frame.Desktop", $rc); #my $desktop = $smgr->createInstanceWithContext( "com.sun.star.frame.Desktop", $remoteContext); warn "Got desktop"; exit; sub get_context { my ($pu) = @_; # can't make initialization with path work on Win32 if ($^O eq 'MSWin32' || $ENV{URE_BOOTSTRAP}) { return $pu->createInitialComponentContext(); } else { return $pu->createInitialComponentContext(get_file('perluno_paths.txt')); } } sub get_file { my ($file) = @_; my ($dir) = getcwd(); if ($^O eq 'MSWin32') { # getcwd returns forward slashes, which is OK in this case return 'file:///' . $dir . '/' . $file; } else { return 'file://' . $dir . '/' . $file; } } <end> Regards, Mike Tonks --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org