Share

fura ( Grid Middleware )

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Api from Ubuntu 8.04 hardy

You are viewing a single message from this topic. View all messages.

  1. 2009-08-18 10:21:02 UTC
    There are libraries in perl that must be installed system-wide. That is this way because some part of the libraries are compiled and integrated with the perl installation. This could be your problem. In your post made on 27/7 you said:

    "I have these perl libraries installed in my system:

    Package: libio-stringy-perl Version: 2.110-3
    Package: libmailtools-perl Version: 2.02-1
    Package: libunicode-map-perl Version: 0.112-10
    Package: libsoap-lite-perl Version: 0.69-2
    Package: libmime-tools-perl Version: 5.425-2

    but I'm trying to use these libraries inside the ./lib folder.

    IO-stringy-2.110
    MailTools-1.1401
    MIME-tools-6.200_02
    SOAP-Lite-0.66
    Unicode-Map-0.112 "

    How did you install the libraries in ./lib? By copying some files there? If you did it so, I am afraid that this is not enough. Please, ask your system administrator to install the libraries system wide for you. The main library is MIME-tools-6.200_02. You can try to run your code after installing this one system wide.

    Find below some test code. It is certain to work. If it doesn't, you have probably some problem with your perl installation. If it fails, please provide us with the screen output.


    # Libraries
    use lib "./lib";

    # Load Binging Utils
    use PerlBindingUtils;

    # Load Kernel Binding
    use kernel;
    use ixos;
    use psweep;

    # 1 -> Show logs when there are errors
    ApiPerlClient::setActiveLog(1);

    # 1 -> Stop application any exception is received
    ApiPerlClient::setDieIfError(0); # <-----

    # Connection info, later used to create the connection object.
    my $host = "10.0.0.156";
    my $port = 9112;
    my $user = "administrator";
    my $pass = "admin";
    my $useSSL = 0; # false
    my $defconn = new DirectConnection($host,$port,$useSSL,$user,$pass);


    # TEST 1: Kernel version
    my $apiKernel = new ApiKernelManager($defconn);
    # Calling getKernelVersion
    my $versionInfo = $apiKernel->getKernelVersion();
    #Process Result: Showing the data to the user.
    my $ke = ApiPerlClient::getLastKernelException();

    print("\n\n\n\n");

    if(defined($ke)) {
    # Process error
    print("Api Error:\n");
    print($ke->toString()."\n");
    ApiPerlClient::initializeLastKernelException();
    exit(1);
    } else {
    print("The version of Kernel is ".$versionInfo->getMajor().".".
    $versionInfo->getMinor().".".$versionInfo->getRelease().
    " Release ".$versionInfo->getBuild()."\n");
    }

    # TEST 2: Create file and Upload
    #
    # Create temporal file
    my $data = "Hello World!!!!";
    open(TESTFILE, "> file.txt");
    print TESTFILE $data;
    close(TESTFILE);
    print("Created file...\n");
    #
    # Upload file to repository
    my $remoteFolder = "/tmp/file.txt";
    my $local_src = "./file.txt";
    my $datahandler = new DataHandler();
    $datahandler->setFileName($local_src);
    my $apifs = new ApiFileSystemIO($defconn);
    $apifs->uploadFile($remoteFolder, $datahandler);
    $ke = ApiPerlClient::getLastKernelException();
    if(defined($ke)) {
    print("Error Uploading File:\n");
    my $ke = ApiPerlClient::getLastKernelException();
    print($ke->toString()."\n");
    exit(1);
    }
    print("Uploaded file...\n");

    # TEST 3: Download file
    my $dhReturned = $apifs->downloadFile($remoteFolder); # <-----
    # Process error or return
    $ke = ApiPerlClient::getLastKernelException();
    if(defined($ke)) {
    print("Error Downloading File:\n");
    my $ke = ApiPerlClient::getLastKernelException();
    print($ke->toString()."\n");
    exit(1);
    }
    print("Downloaded file...\n");
    # Save file to File System
    my $filename = $dhReturned->getFileName();
    my $openOk = 1;
    open(FILE, "< $filename" ) or $openOk = 0;
    if(!$openOk) {
    print("Can not open file $filename\n");
    exit(1);
    }
    my $content = "";
    while( <FILE> ) {
    $content = $content.$_;
    }
    close FILE;
    print("Downloaded data: ".$content."\n");


< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.