PERL script on Solaris

My ISP is running on solaris. I have place a PERL (.pl) script which will fire a mail. He says 'Sendmail' is configured and I can create any folder and place my script and system will recognize is automatically. As we know, all the web servers will have 'cgi-bin' directory where the .pl or .cgi files will be placed for execution. My ISP tells me that he has configured the server in such a way that I can create a 'cgi' directory anywhere and can run it from the browser. I am unable to do it. Tell me how I can do it.

Unfortunately this stupid perl script isn't that
easy. It uses Rational cqperl, then some libraries
and modules I don't understand. I can't even find
the actual code it uses that uses flexlm.
That's why I was asking what is different with java
1.2 and java 1.4. Is there some way that Runtime
acts differently?Not in any fundamental way that I am aware of.
The fact that the script is running at all though tells me that the problem is on the PERL side of things. I suspect that some of those modules and libraries are not being loaded correctly or the same way on both systems.
I fear the answer is that you need to figure out what components the script needs to run and make sure that it has them under all circumstances. This is like a classpath problem except it is with your PERL script so you need to solve it as a PERL problem.
Again if it wasn't running at all that would be one concern but it is running just not finding all it's bits.. a problem of that nature strongly indicates that the issue is happening once the process has already been spawned (correctly) and so is out of the realm of the Java part of your program.

Similar Messages

  • Xgettext for perl and shell scripts on Solaris 9

    Hi......I have to internationalized perl and shell scripts on Linux and Solaris 9.
    I have used gettext on linux to internationalized both perl and shell scripts but on solaris i m not able to
    achieve the same.
    If we see help of xgettect on Linux, it shows input file options for Perl, Shell, C, C++ etc but help for
    xgettext on Solaris shows input file option for C only.
    Can you please provide me some way of using xgettext for perl and shell scripts on Solaris 9 or
    is there any other way of internationalizing perl and shell scripts on Solaris 9.
    Many Thanks,
    Lokesh

    Signature link blocked.
    db
    Contentprise wrote:
    Hi......I have to internationalized perl and shell scripts on Linux and Solaris 9.
    I have used gettext on linux to internationalized both perl and shell scripts but on solaris i m not able to
    achieve the same.
    If we see help of xgettect on Linux, it shows input file options for Perl, Shell, C, C++ etc but help for
    xgettext on Solaris shows input file option for C only.
    Can you please provide me some way of using xgettext for perl and shell scripts on Solaris 9 or
    is there any other way of internationalizing perl and shell scripts on Solaris 9.
    Many Thanks

  • How to launching a perl script by the "begin" script of a jumpstart

    Hi all,
    i have an urgent pb with my solaris jumpstart, let me explain to you :
    i want that the begin script launch some perl script, but i have a problem
    here is my "begin" script:
    echo "Begining ISO FLAR based jumpstart."
    echo ""
    echo "Starting Ullink Configuration"
    env > /tmp/env
    /bin/sh << EOF
    /usr/bin/perl /cdrom/.archives/admin-scripts/sethostname.pl
    EOFmy perl script use a STDIN
    with this configuration, the perl script is launching but it runs in a loop indefinitely with an error "use of uninitialized value", because (i think) a value is return to the begin scritp and not to the perl script.
    well, on a pre-installed solaris, if a launch the begin script, it happens the same thing, it runs in a loop, BUT if i comment the line "/bin/sh <<EOF" and "EOF", it works.
    at this step, i say "ok it's cool my script is working", but when i use it during the jumpstart instalaltion, the perl script does not start, without any particular error.
    here is my perl script, if you want to test :
    #!/usr/bin/perl -w^M
    # Set Hostname for Ullink Jumpstart^M
    ^M
    use strict;^M
    ^M
    sub hit_enter {^M
        print "Hit enter to continue\n";^M
        <STDIN>;^M
        print "\033[2J";^M
    }^M
    ^M
    sub get_hostname {^M
        my %towns_list = (^M
            'Paris' => 'PA',^M
            'New-York' => 'NY',^M
        );^M
    ^M
        my %sites_list = (^M
            'Office' => 'OFC',^M
            'Redbus' => 'RED',^M
            'Telehouse' => 'TLH',^M
            'DTC' => 'DTC',^M
            'iAdvantage' => 'IAD',^M
            'Nutley' => 'NUT',^M
            'Level3' => 'LV3',^M
            'Equinix' => 'EQX',^M
            'Tata' => 'TAT',^M
            'Switch-data' => 'SWI',^M
            );^M
    ^M
        my %usage_list = (^M
            'Production' => 'PRD',^M
            'UAT' => 'UAT',^M
            'DMZ' => 'DMZ',^M
        );^M
    ^M
        sub select_list {^M
            my $counter=-1;^M
            my %hash_list = @_;^M
            my @keys = keys %hash_list;^M
    ^M
            # Clear screen^M
            print "\033[2J";^M
            print "In which country this machine is hosted or will be host and will be used ?\n\n";^M
    ^M
            # Get all keys from hash^M
            my $key;
            while ($key = each %hash_list ) {^M
                $counter++;^M
                print "$counter - $key\n";^M
            }^M
    ^M
            print "\nChoose the number corresponding to your choice :\n";^M
            my $choice_number;
            chomp ($choice_number = <STDIN>);^M
    ^M
            # Verify answer^M
            if (($choice_number =~ /\d+/) and ($choice_number <= $counter)) {^M
                # Add choice to chosen hostname^M
                my $chosen=$hash_list{$keys[$choice_number]};^M
                return $chosen;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number between 0 and $counter\n";^M
                &hit_enter;^M
                &select_list;^M
            }^M
        }^M
    ^M
        sub srv_number {^M
            print "\033[2J";^M
            print "What is the server number ?\n";^M
            my $server_number;
            chomp ($server_number = <STDIN>);^M
            if ($server_number =~ /\d+/) {^M
                return $server_number;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number\n";^M
                &hit_enter;^M
                &srv_number;^M
            }^M
        }^M
    ^M
        my $full_hostname = &select_list(%towns_list).'-';^M
        $full_hostname = $full_hostname.&select_list(%sites_list).'-';^M
        $full_hostname = $full_hostname.'SRV-';^M
        $full_hostname = $full_hostname.&select_list(%usage_list).'-';^M
        $full_hostname = $full_hostname.&srv_number;^M
    ^M
        sub write_hostname2tmp {^M
            open (HOSTNAME, ">/tmp/set_hostname") or warn "Couldn't write $_[0] to temp file : $!\n";^M
                print HOSTNAME "$_[0]\n";^M
            close (HOSTNAME);^M
        }^M
    ^M
        print "\033[2J";^M
        print "Is $full_hostname the correct name for this server ? (y/n)\n";^M
        if (<STDIN> =~ /y|yes/i) {^M
            &write_hostname2tmp($full_hostname);^M
        } else {^M
            print "Would you like to retry (r) or set manually the hostname (s) ? (r/s)\n";^M
            if (<STDIN> =~ /s/i) {^M
                print "Type the full required name and hit enter when finished :\n";^M
                chomp ($full_hostname = <STDIN>);^M
                &write_hostname2tmp;^M
            } else {^M
                &get_hostname;^M
            }^M
        }^M
    }^M
    ^M
    # Start configuration^M
    print "\033[2J";^M
    print "\n########################################################\n";^M
    print "#\t\t\t\t\t\t       #\n";^M
    print "#\t\t\tULLINK\t\t\t       #\n";^M
    print '#  Solaris Environnement Installation for Datacenters  #';^M
    print "\n#\t\t\t\t\t\t       #";^M
    print "\n########################################################\n\n";^M
    print "Before starting installation, you need to enter a set of informations.\n(answer to all questions, you can Ctrl+C to stop now)\n\n";^M
    &hit_enter;^M
    ^M
    &get_hostname;^Mthank for your help
    Edited by: ullink on Jun 25, 2009 6:05 AM

    Hi Manju,
    You can try the following command and check if any helps:
    Get-Exchangeserver |where-object{$_.AdminDisplayVersion -like "Version 15*"} |Get-MailboxStatistics | Ft -auto -wrap DisplayName,database,servername,*size*,*time*
    Best regards,
    Niko Cheng
    TechNet Community Support

  • Shell or perl script from OS command_Sender File Channel

    Hi All,
    I am trying to execute a perl script from the File Sender Channel(NFS), OS command Before Message Processing. The script works fine if i run it from the shell. But when PI calls the script,  the script does not get executed. The audit logs mention that the OS command has been called.
    I tried using:
    1) /<fullpath>perlScript.pl /<fullpath>filename.dat
    2) perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    Both these commands work fine when i execute them on the shell.
    I am on solaris and PI 7.0. The permission for the perl script and input files are all 777.
    FYI.. i am using this perl script to transpose a complex file and make it # delimited file.
    I have already read the blogs for OS command and executed some sample scenarios successfully.
    I tried to call a shell script that does the same functionality as the perl script. Even that does not work.
    Also, wrote a shell script to call the perl script inside it. No luck.
    eg:
    touch /fullpath>/create_before.dat
    perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    touch /<fullpath>/create_after.dat
    In this case, the create_before.dat and create_after.dat is getting created but the perl is not called. I know this because i cant see the output files of the perl script.
    Regards,
    Balaji
    Edited by: Balaji M on Oct 30, 2008 2:36 PM

    Hi,
    The problem is fixed. The shell or perl both have logic to transpose a non industry starndard file to the delimited file which PI can use an FCC to pick up.
    This was the fix:
    we need to mention the shell the script is going to be run in.
    In the shell script we mentioned --> *#!/usr/bin/bash* as the first line
    normally, when we use the command -- which bash on the unix command prompt, it tells us the path for the bash used.
    another option --> #!/usr/bin/ksh
    again, on the command prompt -- which ksh command will tell us what ksh is being used.
    If the script is a simple one that does copy or move commands, i believe we need not use the commands above. But is a good practice to have them in the script.
    Regards,
    Balaji
    Edited by: Balaji M on Nov 3, 2008 4:38 PM

  • Perl performance on solaris 10

    hi all,
    i executed this (http://www.metacard.com/perlbench.html) script on solaris 10 and linux machine. Solaris box took around 15sec to complete the test where as linux box took only 8 seconds.
    Is there any way to increase the perfomance of perl on solaris 10.
    Regards,
    uttam

    Yes, I doubt this has much to do with the OS unless they are exactly the same machines with equally good device support.
    ultra5 333mhz ultrasparc 2gb ram sol10= 45 seconds
    2x750 ultrasparc 2gb ram blade1000 sol10= 22 seconds
    3200 amd 1gb ram fedora= 18 seconds
    ultra20m2 1.8 ghz opteron 2gb ram sol10= 9 seconds
    x2200m2 2x2.8ghz opterons 12gb ram sol10= 6 seconds
    I like how the ancient blade1000 is not to far from the much more modern fedora box. Such a lovely machine.

  • Recovering Permissions on /usr/lib - pkgchk or perl script?

    We have a SUN 280R running solaris 8 which accidently had a 'chmod-R 644 /usr/lib' run on it. The result was that on reboot, the system could not 'execute' or 'find' specific libraries such as ld.so.1 and some files associated with the veritas volume software we have installed on the system. We have been able to chmod most of /usr/lib 755 including ld.so.1. We would like to restore permissions to prevent any system stablity problems. so what is the better method to use here?
    1.) do a grep /usr/lib on /var/sadm/install/contents, pull out all the package names with an awk statement and then run them in a loop with pkgchk -fa?
    2.) Run a perl script which parses /var/sadm/install/contents, pulls out all the individual files in /usr/lib, and run a chmod <perm> $file on each file name?
    Which method would be less destructive? My concern is that running pkgchk on all packages associated with /usr/lib may 'fix' something, or modify something which would prevent the system from coming up.
    What key files in /usr/lib would prevent the system from coming back up, if permissions were incorrect? (i.e 644)? Should a chmod <perm> <file> for each file in the contents file for all files in /usr/lib resolve this problem completely?
    Any advice would be appreciated.

    If you don't already have a current backup, back up all data, then reinstall the OS. You don't need to erase the startup volume, and you won't need your backup unless something goes wrong. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it.

  • How to run NMS perl scripts in SunONE 6.1

    Any one have info on running the NMS perl scripts with the perl compiler shipped with 6.1? Particularly interested in nms FormMail. I need to get it running in on windows xp and Sun Solaris.
    WebServer is reporting the following error.
    failure: for host dbmrpm41.deluxe.com trying to POST /cgi-bin/FormMail.pl, cgi_s
    can_headers reports: HTTP4044: the CGI program C:\Sun\WebServer6.1\bin\https\per
    l\perl.exe did not produce a valid header (program terminated without a valid CG
    I header. Check for core dump or other abnormal termination)
    When I run FormMail.pl in a command prompt, I receive the following:
    Can't locate auto/POSIX/autosplit.ix in @INC (@INC contains: C:/Sun/WebServer6.1
    /bin/https/perl/lib/MSWin32-x86 C:/Sun/WebServer6.1/bin/https/perl/lib) at C:/Su
    n/WebServer6.1/bin/https/perl/lib/AutoLoader.pm line 146.
    at C:/Sun/WebServer6.1/bin/https/perl/lib/MSWin32-x86/POSIX.pm line 5
    Edited by: garyb on Mar 18, 2008 9:04 AM

    The Perl you found in the bin/https/perl directory is a private copy of Perl used to implement parts of the Web Server Administration Server. You shouldn't try to use it to run CGI scripts.
    Instead, you can download your own Perl distribution. ActiveState has a Perl distribution called ActivePerl. You can get it for free from http://www.activestate.com/Products/activeperl/. Other options are listed at http://win32.perl.org/.

  • Perl Scripts in Sybase to oracle 8

    Wondering what type of libraries do I need to load onto my Sun
    OS and Perl system to make database calls to our new Oracle 8
    database system.
    Librabies to invoke?
    Sample Perl script calls?
    Thanks
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Oracle Migration Workbench Team:
    Mikael,
    The Oracle Migration Workbench migrates from Sybase to Oracle. For further information see http://technet.oracle.com/tech/migration .
    The Oracle Migration Workbench can be run on NT and use ODBC network connections to Sybase on (for example) solaris and Oracle sqlnet connections to Oracle on solaris.
    Turloch
    Oracle Migration Workbench Team<HR></BLOCKQUOTE>
    Thanks....
    Does The Oracle Migration Workbench migrate from Sybase ASE v.12?
    /Mikael

  • In Web Server 6.0 during the execution of a Perl Script, the software send the error "Cannot execute CGI script......unable to sewt group".

     

    Hi Pablo,
    Its bcos Your web server has been misconfigured. It doesn't know that it should execute your Perl program, so it's just returning the error to the browser.
    Assuming that u use solaris 2.8. Generally the path for the perl in solaris is #!/usr/bin/perl .make sure u have included this in ur first line of the perl programs.[if not enter the exact location of the perl interpretor]
    Now follow these steps:
    *First Part
    First create a cgi folder mycgi-bin( follow this example please) say u create mycgi in /usr folder (solaris). so the path becomes '/usr/mycgi-bin'. set
    appropriate permissions say set chmod to 755. to make it executable. Then
    (1)Goto Programs tab in IWS (iplanet web server) .
    (2)choose cgi-directory drom left frame.
    (3)CGI Directory Add another CGI Directory
    URL prefix: mycgi-bin
    CGI directory: /usr/mycgi-bin
    (4) click 'OK' and click 'apply' to save changes and restart the server.
    * Second Part:
    1.In the Server Administrator, click Server preferences, then select 'MIME Types' from the frame on the left.
    2.If you want to use .pl as the extension for Perl scripts, find and remove the application/x-perl MIME type (this is mapped to .pl by default). (remove it).
    3.Add a new MIME Type with 'magnus-internal/mycgi-bin' (type this exactly ie magnus-internal/cgidirectory url prefix) as the Content Type, and pl as the File Suffix.
    4.Save and apply these changes, then re-start the server.
    5 .Put a sample perl file in mycgi-bin directory say sample.pl and access http://yourserver:port/mycgi-bin/sample. pl
    *If you are having trouble running Perl scripts on your iPlanet server, check the following:
    * Ensure that the script is readable by the account used by the iPlanet service.Generally, this means you should make the script readable by the Everyonegroup.
    * Ensure that all supporting files, like the perl binary files, the perl library files, and the modules that you use, are all readable by the account used by the iPlanet service (i.e., the Everyone group).
    It should work now,
    Regards,
    T.Raghulan

  • Execute a shell or perl script

    Is it possible to execute a unix(solaris) shell script or perl script from a stored procedure. If so, a short example would be great.
    Thanks,
    John

    External Procedure Source Code
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    void sh(char *);
    void sh( char *cmd )
    int num;
    num = system(cmd);
    Issue the following commands to compile the code and generate the shared
    object in Solaris:
    cc -G -c shell.c
    ld -r -o shell.so shell.o
    You can also use the demo_rdbms.mk makefile to build shared libraries for use in external procedures. Using this method insulates you from any Operating System specific dependencies (e.g., which flags to use
    for ld).
    For example:
    In 8.0.X,
    $ make -f demo_rdbms.mk extproc_nocallback \
    SHARED_LIBNAME=shell.so OBJS=shell.o
    In 8.1.X,
    $ make -f demo_rdbms.mk extproc_no_context \
    SHARED_LIBNAME=shell.so OBJS=shell.o
    Library Definition
    CREATE LIBRARY shell_lib is '/u11/home/lsupport/proc/shell.so';
    Note: The directory in quotes is the current of location of the library that
    was created in the steps above.
    PL/SQL Wrapper Procedure
    create or replace procedure shell(cmd IN char)
    as external
    name "sh"
    library shell_lib
    language C
    parameters (cmd string);
    Execution
    SQL> exec shell('ls');
    cli.trc exe_prba.sql prueba.mk shell.c.old
    core listener.old prueba.o shell.o
    dec2bin.c listener.ora prueba.so shell.so
    dec2bin.c.old nena.lst prueba.sql shell.sql
    dec2bin.o p.sql sal.1 shell.sql.old
    dec2bin.so pepito.lst sal.2 sqlnet.log
    dec2bin.sql prb sal.3 tnsnames.ora
    dec2bin.sql.old prb.c salida.lst tnsnames.ora.old
    envoltorio.sql prueba.c shell.c uno.sql
    PL/SQL procedure successfully completed.

  • OCI NLS errors in Perl script

    I'm using Perl to access an Oracle DB, using Activestate Perl and pre-built DBI and DBD::Oracle modules.
    I'm running the scripts on a Windows XP laptop, connecting to an Oracle DB running on Solaris 10, Oracle versions are 10.2 in both cases.
    I can connect to the database successfully with sqlplus, run from the command line, using the 'easy connect' method.
    The script fails to connect, generating this error:
    DBI connect('host=host.domain.com;sid=mydb;port=1522','myusername',...)
    failed: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
    Check ORACLE_HOME and NLS settings etc. at C:\Perl\bin/esrch line 249
    My ORACLE_HOME points to the Oracle installation directory which was used to build the module, so I believe it's OK.
    Line 249 in the script is the dbi->connect(...) method.
    I have no idea which NLS variable would need to be set or changed, if that's what's needed.
    I also know that OCI_NLS_CHARSET_ID is a #define, found in oci.h. This file is included by the header file for my code.
    Any suggestions on how to get this working are much appreciated.
    Bob

    Hmm, there seems to be some confusion on my part regarding my login. I just used one which I swear I tried previously without success.
    In any case, I'm the original poster. Sorry for any confusion this causes.
    As for the questions asked.
    1. Oracle home access: yes, not only did the same user do the install of Oracle, I've verified that the user can access all files.
    2. I've run with NLS_LANG set and unset. The value used is the one stored in the registry:
    AMERICAN_AMERICA.WE8MSWIN1252
    3. I did a 'print "$ENV{NLS_LANG}\n"' from the perl script and got the expected output, as set above.
    4. As I understand it, the PerlSetVar function is a mod_perl feature, not part of the base language. I'm using batch files to run perl on my perl scripts, started from a command prompt.
    Thanks,
    Bob

  • Perl script using perldap under unix

    Hi,
    I've got a perl script (used by a UTC instance) which runs on windows NT and which use the perldap API.
    I'm trying to install it on Solaris with the Directory Server 5.1 SP2 and the Meta Directory 5.1 installed.
    When i use the nsperl located in ../iplanet/servers/lib/nsPerl5.005_03, the script works.
    But when i use it with the nsperl located in sunone/servers/bin/utc50/admin/bin (which is used by the UTC instance) it doesn't work.
    The error message is :
    Can't locate loadable object for module Mozilla::LDAP::API in @INC (@INC contains: /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/site_perl/sun4-solaris /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/site_perl . /LOCAL/nsPerl5.004_04/lib/sun4-solaris /LOCAL/nsPerl5.004_04/lib /LOCAL/nsPerl5.004_04/lib/site_perl/sun4-solaris /LOCAL/nsPerl5.004_04/lib/site_perl .) at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Utils.pm line 29
    BEGIN failed--compilation aborted at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Utils.pm line 29, <GEN0> chunk 26.
    BEGIN failed--compilation aborted at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Conn.pm line 32, <GEN0> chunk 26.
    Does anybody know how to do to avoid this problem ?
    Thanks a lot.

    The message indicates PerLDAP is not installed into that Perl library. You could install, but do you need to really? If you need to run PerLDAP Metadirectory scripts, then maybe this would be the only way. But I would check with support - this may not be supported - changing the Perl install with Metadirectory. But they should be able to tell you how. If you don't need to run the PerLDAP Meta-scripts, then just use a seperate Perl install from the ones that come with the Sun servers. We use #!/usr/local/bin/perl.

  • Folder Action to Launch Perl Script

    Hello.
    I wrote a perl script which I wanted to execute when a file was dropped into a folder. I added a folder action with a very simple applescript:
    on adding folder items to this_folder after receiving added_items
    do shell script ¬
    ("perl /Users/Alexander/Library/Scripts/gte2.pl")
    end adding folder items to
    The folder action didn't do anything, any thoughts on what I'm doing wrong? Note, the perl script works fine when I run it from the terminal.
    thanks.

    Thanks Camelot, I appreciate the help. My script below is trying to read data from a file in folder in my system. So I will try your suggestion, I didn't realize the environment and path my be different.
    Regards Alex
    #!/usr/bin/perl -w
    #This program is to convert files from gamin running GPS watch to text file which can be loaded into excel.
    # To make executable, remember to set: chmod u+x <file>
    #set all the flags. Note the flags are used to stop the matching
    $i = 1; $k = 0; $start = "no";
    #Open data file and find values
    open(DATA,"/Users/Alexander/Alex's Misc/Health/Garmin_Conversion/run.tcx") || die "Couldn't open file*\n";
    #read in the data line by line until "end of file"
    while (<DATA>){
    #start parsing for information to keep
    if (/.<Id>./) {
    @Idline=split(/>/);
    @Idbeat=split(/T/,$Idline[1]);
    $Id=$Idbeat[0];
    if (/.<Track>./){
    $start = "yes";
    if ($start eq "yes"){
    if (/.<Time>./) {
    @timeline=split(/T/);
    @timebeat=split(/Z/,$timeline[2]);
    $Time[$i]=$timebeat[0];
    elsif (/.<LatitudeDegrees>./) {
    @HRline=split(/>/);
    @HRbeat=split(/</,$HRline[1]);
    $Latitude[$i]=$latbeat[0];
    elsif (/.<LongitudeDegrees>./) {
    @longline=split(/>/);
    @longbeat=split(/</,$longline[1]);
    $Longitude[$i]=$longbeat[0];
    elsif (/.<AltitudeMeters>./) {
    @altline=split(/>/);
    @altbeat=split(/</,$altline[1]);
    $Altitude[$i]=$altbeat[0];
    elsif (/.<DistanceMeters>./) {
    @distline=split(/>/);
    @distbeat=split(/</,$distline[1]);
    $Distance[$i]=$distbeat[0];
    elsif (/.<Value>./) {
    @HRline=split(/>/);
    @HRbeat=split(/</,$HRline[1]);
    $HR[$i]=$HRbeat[0];
    $i++;
    } #string matching
    } #if start flag is yes
    } #while data loop
    close (DATA) || die "couldn't close file.\n";
    #write all data to file in space delimited format
    open (NEWFILE, ">/Users/Alexander/Alex's Misc/Health/Garmin_Converted/$Id run") || die "can't create file.\n";
    $Time[0]="Time"; $Latitude[0]="Latitude"; $Longitude[0]="Longitude"; $Altitude[0]="Altitude"; $Distance[0]="Distance"; $HR[0]="HR";
    print NEWFILE "0 $Time[0] $Latitude[0] $Longitude[0] $Altitude[0] $Distance[0] $HR[0]\n";
    for ($j = 1; $j <= $i; $j++) {
    $k=$j+1;
    print NEWFILE "$j $Time[$j] $Latitude[$j] $Longitude[$j] $Altitude[$j] $Distance[$j] $HR[$j]\n";
    } #for j loop
    close (NEWFILE) || die "couldn't close newfile.\n";
    #This is the end of the program

  • Runtime.exec("Perl Script writing and reading on I/O"), handling Streams

    Hi all !!
    In a first place : sorry for my english if it's not really understandable but I try to do as good as possible !
    I'm writing a GUI with Swing that will allow (in one of my multiple tables) the user to run a Perl Script.
    This Perl Script ask the user to choose a Folder ... then read all the files in this folder and for each file (xml File), extract the datas and put them in a database. But when a file that has to be inserted in the database contains this line : <Template_Used name="ST1.mtt"> and if the Template table in my database doesn't have the "ST1.mtt" stored ... the Perl Script ask to the user to give him the path of the file "ST1.mtt" so that the script can put the "ST1.mtt template" datas in the database.
    This script runs well when it is from a windows console.
    But I need a graphic interface !!!
    So I created a JButton "Process a folder".
    When the button is pressed, a JFileChooser appears and ask the user which Folder has to be processed.
    Then a Process is created with the command : ("cmd.exe /C \"C:\\Program Files\\Fluke\\Ansur\\ProcessFolder.bat\").
    The BatFile :
    {code}cd C:\Documents and Settings\tsd\Desktop\Gael-Project\Project_Files
    perl Process.pl
    exit{code}
    At this moment everything is working well.
    But my Process.pl (which is 300 lines long ... and that you don't even want to hear about), ask in a first time the Path of the folder to process and sometimes ask the path to a file (a template file).
    So I need to read and wirte on the STDIN/STDOUT during the exec of the Process.
    In order to handle this I created two different threads : one reading the Process.getInputStream with a BufferedReader and one other writing on the Process.getOutputStream with a PrintWrinter.
    What I need to do is :
    When I read a line from the InputStream saying "I need the path of the ST1.mtt file", I should run a JFileChooser ... the user find the file in the computer ... and I write in the OutputStream the path of the file, so that my Perl Script doesn't have un Unitialised value on <STDIN> and can continue to process !!
    I'm pretty sure it's possible ... because at the moment I just used a trick :
    When the user push the "process a folder" button, I write the paths in the OutputStream before than the script needs it and it works !
    But I need to write in the OutputStream only when it is time !!!
    Any idea ??
    Here are some parts of my code :
    {code}
    String filename = File.separator+"tmp";
              JFileChooser fc = new JFileChooser(new File(filename));
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
              // Show open dialog; this method does not return until the dialog is closed
         fc.showOpenDialog(null);
         Folder = fc.getSelectedFile();
              new GoodExec(cmd);
    {code}
    {code}
    public class GoodExec {
         public static Process proc;
         public static StreamGobbler errorGobbler;
         public static StreamGobbler inputGobbler;
         public static StreamGobbler outputGobbler;
         public GoodExec(String cmd)
         try
                   Runtime rt = Runtime.getRuntime();
              proc = rt.exec(cmd);
         // any error message?
         errorGobbler = new
         StreamGobbler(proc.getErrorStream(), "ERROR");
         // any input?
         inputGobbler = new
         StreamGobbler(proc.getInputStream(), "INPUT");
         // any output?
              outputGobbler = new
              StreamGobbler(proc.getOutputStream(), "OUTPUT");
         // kick them off
         errorGobbler.start();
         inputGobbler.start();
         outputGobbler.start();
         // any error???
         int exitVal = proc.waitFor();
         System.out.println("ExitValue: " + exitVal);
         } catch (Throwable t)
         t.printStackTrace();
    {code}
    {code}
    public class StreamGobbler implements Runnable
    InputStream is;
    OutputStream os;
    String type;
    Thread thread;
    public static String chaine;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.os=null;
    this.type = type;
    StreamGobbler(OutputStream os, String type)
    this.os = os;
    this.is=null;
    this.type = type;
    public void start () {
         thread = new Thread(this);
         thread.start ();
    public void run()
    try
    if (is == null){
         PrintWriter toProgram = new PrintWriter(os);
         File FolderToProcess = ProcessFolder.Folder;
    String Folder = FolderToProcess.getPath();
    toProgram.write(Folder);
    toProgram.close();
    else {
         if (os == null){
         InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    String comp = "Please enter the exact path of the directory that contains the files you want to process.";
    while ( (line = br.readLine()) != null){
         if (type.equals("INPUT")){
              chaine+=line+"\n";
         if (line.equals(comp)) {
              System.out.println("give directory");RUN A JFILECHOOSER AND GIVE THE DIRECTORY TO THE OUTPUTSTREAM
    System.out.println(type + ">" + line);
    is.close ();
    catch (IOException ioe){
         ioe.printStackTrace();
    {code}
    And here is an example of a simple perl script that could be used (it s a simple one !!) :
    {code}
    #!/usr/bin/perl -w
    use strict;
    print "Please enter the exact path of the directory that contains the files you want to process.\n";
    my $dir= <STDIN>;
    chomp ($dir);
    print "titallala $dir";
    if (the template of the file is not in the database){
    print "Please give me the template so that I can put it in the database";
    $dir= <STDIN>;
    chomp ($dir);
    {code}
    Thank you for your help ... if it's possible to help me !!
    Gael

    BalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
    Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
    SomeObject someObject = null; // The someObject reference is null.
    someObject.doSomething(); // Invoking a reference which is null would throw NPE.

  • How to call a perl script from an apple script

    Hi All,
    How to Call a perl Script from an apple script.
    Pls Give Your comments.
    Thanx & Regards,
    Esther

    Applescript to call a perl script named "/tmp/x.pl" passing an argument "world"
    do shell script "/usr/bin/perl /tmp/x.pl world"
    or if the script is given the executable atttribute (chmod +x /tmp/x.pl),
    do shell script "/tmp/x.pl world"
    Perl script "/tmp/x.pl" that prints a string using a passed argument
    #!/usr/bin/perl
    print "Hello $ARGV[$1]\n";

Maybe you are looking for

  • External disk not seen after sleep on Yosemite

    My sleep/wake issue on Yosemite affects the external disk (USB 3 connection) and the printer (HP 8600 all-in-one): On wake, after a long sleep, my iMac late 2012 shows an error message saying that the disk was not properly ejected and, in fact, the d

  • Spatial Index Problem in View

    Hello everyone. I have a table (A) that stores point locations (X,Y) and contains the following fields: ID NUMBER(10,0) No 1 CD_CODIGO_EMA VARCHAR2(10 BYTE) Yes 2 TX_NOMBRE_EMA VARCHAR2(50 BYTE) Yes 3 CD_PROVINCIA_EMA NUMBER(5,0) Yes 4 CD_MUNICIPIO_E

  • Standard MSS screen for bulk approvals

    Hi Forums, In MSS, is there any screen for approvals (also bulk approval). Currently ESS requests like swipe in swipe out are coming to UWL as work item. Thanks and Regards Sudhir

  • Header of a Descriptive Flexfield

    Hi all, I've created a descriptive flex in my page but the text I set in Prompt property doesn't appear in runtime. The user wants to have a header saying "Additional Shipment Information" before their custom attributes. Do I have to create a header

  • When I make a comp a 3d Layer, it goes crazy!

    I've made a comp consisting of three layers. It's just a dotted line (with trim paths) and two arrowheads following the line. I've brought that comp into my main comp and it looks great. But now I want that dotted line comp to "follow" the background