[22908] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5128 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 24 00:05:54 2003

Date: Mon, 23 Jun 2003 21:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 23 Jun 2003     Volume: 10 Number: 5128

Today's topics:
    Re: check/get variable type? <coo_t2-NO-LIKE-SPAM@yahoo.com>
    Re: check/get variable type? <abigail@abigail.nl>
    Re: chomp (@filecontents = <HANDLE>); slows down <bart.lateur@pandora.be>
        comparing arrays (perl user)
    Re: DBD, arrays, placeholders & Null's <thepotplants@yahoo.com>
    Re: Help with XML::Simple <jacqui.caren@ntlworld.com>
    Re: How to read and write serial port using PERL in RED (David Efflandt)
    Re: How to read and write serial port using PERL in RED (Bryan Castillo)
    Re: Loading perl modules / Caching when it shouldn't -  <jacqui.caren@ntlworld.com>
        Matching Problems (Christopher Boyce)
    Re: Matching Problems <krahnj@acm.org>
    Re: Matching Problems (Tad McClellan)
    Re: Matching Problems (Tad McClellan)
    Re: Matching Problems <mgjv@tradingpost.com.au>
        Newbie help with LWP <law3@NOSPAM.hotmail.com>
        Please help with a script, knoledge needed! <estrunk @ home.nl>
    Re: Please help with a script, knoledge needed! <mbudash@sonic.net>
        Problem with "system" call - multiple invocations (Newb <anthony@no_spam.movielink.net.au>
    Re: Problem with "system" call - multiple invocations ( <anthony@no_spam.movielink.net.au>
        Problem with calling an vb6 executable from perl script <magpie@optonline.net>
    Re: soap::lite hellp needed with sms (Bryan Castillo)
    Re: unicode in Image::Magick (hex values and braces pro <flavell@mail.cern.ch>
    Re: unicode in Image::Magick (hex values and braces pro <bigj@kamelfreund.de>
    Re: unicode in Image::Magick (hex values and braces pro <emschwar@pobox.com>
    Re: using SOAP::Lite to call other services. <eric-amick@comcast.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 24 Jun 2003 00:42:52 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Re: check/get variable type?
Message-Id: <m47ffvgjplub8mfupeic4q87jalktv39qu@4ax.com>

On 23 Jun 2003 07:38:24 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>
>I'll bet these are all covered in Abigail's module Regexp::Common.
>
Yeah it looks like Regexp::Common would take care of it..  I also
found Data::Types, which may be useful.

--ed



------------------------------

Date: 24 Jun 2003 01:29:08 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: check/get variable type?
Message-Id: <slrnbffab4.el.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMDLXXXIII
September MCMXCIII in <URL:news:bd6apg$40j$1@mamenchi.zrz.TU-Berlin.DE>:
##  ed  <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote in comp.lang.perl.misc:
##  
## > At any rate I think I found the regex's you were talking about here:
## > http://www.perldoc.com/perl5.8.0/pod/perlfaq4.html#How-do-I-determine-wheth
## > 
## > Maybe I'll create my own little simple module for all the is_a_*
## > operations I may ever need
## > using those regex's in the faq. 
##  
##  I'll bet these are all covered in Abigail's module Regexp::Common.


They are, but you are giving me too much credit. Damian created
Regexp::Common, including the regexes for integer/float, etc.

I only maintain the module.


Abigail
-- 
perl -wlpe '}{*_=*.}{' file  # Count the number of lines.


------------------------------

Date: Tue, 24 Jun 2003 00:05:52 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: chomp (@filecontents = <HANDLE>); slows down
Message-Id: <ae5ffvctmho86ul76ub9cu1jbvg4tubn8q@4ax.com>

Tad McClellan wrote:

>> Now I have the 21 day book on
>> order through the library.  
>
>
>You are expected to _learn_ from your experiences...
>
>
>> After that, maybe "Learn Perl in only
>> one year" is next  :-)
>
>
>... so why are you still throwing money away on "formula titles"?

He did say he ordered it in the library. He didn't say he spent money on
it.

-- 
	Bart.


------------------------------

Date: 23 Jun 2003 19:40:57 -0700
From: r230sl55@yahoo.com (perl user)
Subject: comparing arrays
Message-Id: <588b17a9.0306231840.ed63c1f@posting.google.com>

i was just wondering if it is possible to compare 3 or more rows in an
multidimensional array?

thanks... i actually needed to compare 2 rows in a multi-dimensional
array and did that fine, but am just seeing if i could compare 3+
rows...


mike


------------------------------

Date: Tue, 24 Jun 2003 14:09:50 +1200
From: "ThePotPlants" <thepotplants@yahoo.com>
Subject: Re: DBD, arrays, placeholders & Null's
Message-Id: <qpOJa.47153$JA5.827808@news.xtra.co.nz>

> > Can anyone tell me how to force the array to accept trailing NULL's?
> "perldoc -f split" can tell you.

> > any other suggestions or alternatives would be greatly appreciated.
> split /PATTERN/,EXPR,LIMIT

Thank you. that pointer was all I needed. cheers

> use warnings, use strict, and read the fine documentation.
I was... it was just the wrong stuff thats all... :)





------------------------------

Date: Tue, 24 Jun 2003 03:08:44 +0100
From: Jacqui Caren <jacqui.caren@ntlworld.com>
Subject: Re: Help with XML::Simple
Message-Id: <Xns93A4229F4DE1Djacquicntlworldcom@195.8.68.209>

grehom@ntlworld.com (Graham Smith) wrote in 
news:98eb7f13.0306100912.1bcc753d@posting.google.com:

> As a (lazy) windows user not ever going near a C++ compiler or make
> commands, things are a little bit more restricted, I'm using
> Activestate build 806 of Perl and rely on the modules that download
> elegantly using a tool called 'PPM', the perl package manager, and
> unfortunately a lot of XML packages just aren't available - even
> XML::DOM is missing from the list of modules that I can simply install
> now!


But there are modules from other servers accessible via PPM.

You are not just stuck with whatever As decide they can bother to attempt
to compile (often badly).

Also quite a few CPAN modules are available from authors (or porters)
in ppm format.


------------------------------

Date: Mon, 23 Jun 2003 23:34:47 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to read and write serial port using PERL in REDHAT 8.0
Message-Id: <slrnbff3kn.mi4.efflandt@typhoon.xnet.com>

On 23 Jun 2003 03:43:40 -0700, Mathachan <matts@1-net.com.sg> wrote:
> Hi,
> Could someone provide me with a simple sample PERL script in LINUX on
> how to read and write some data to the serial port (COM1, COM2). I did
> read the FAQ8 in perldoc.com but that does not help me much. I do not
> have any devices attached to the COM PORT, I just wanna write some
> data to the port and read it back, something like a loop back. If
> somebody has got some working piece of script sample, please do send
> it to me at matts@1-net.com.sg

Look for Device::SerialPort module on a CPAN mirror.  It is a Linux/Unix 
port of Win32::SerialPort.  There is more to do than simply reading or 
writing the serial port (speed, parity, stopbits).  Examples are included.  
I used it to chat AT commands with a modem.

But in order to write and read a serial port, there has to be something on 
it.  Not sure how you would wire a loopback plug or how writing and 
reading that would work if the buffer got full.  If you have access to 
another computer and null modem cable, you could run minicom (or 
Hyperterminal in Windows) on that, so you have something to communicate 
with.

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


------------------------------

Date: 23 Jun 2003 19:09:17 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: How to read and write serial port using PERL in REDHAT 8.0
Message-Id: <1bff1830.0306231809.6c5bb2d5@posting.google.com>

matts@1-net.com.sg (Mathachan) wrote in message news:<a5c9f92f.0306230243.66ec8963@posting.google.com>...
> Hi,
> Could someone provide me with a simple sample PERL script in LINUX on
> how to read and write some data to the serial port (COM1, COM2). I did
> read the FAQ8 in perldoc.com but that does not help me much. I do not
> have any devices attached to the COM PORT, I just wanna write some
> data to the port and read it back, something like a loop back. If
> somebody has got some working piece of script sample, please do send
> it to me at matts@1-net.com.sg
> 
> Thanks in advance .... Matts

You will at least need a null-modem cable to connect you 2 serial
ports together.

I don't have an example but there is some documentation you might want
to cruise through if you run into trouble.

(Serial programming on Linx - mostly C Code examples)
(personally I don't think it is too hard to translate the C examples
 to perl, but thats me.)
http://en.tldp.org/HOWTO/Serial-Programming-HOWTO/

(POSIX::Termios is the module you would probably use to control
 and set options on the serial port devices)
http://www.perl.com/doc/manual/html/lib/POSIX.html#POSIX_Termios

If you are programming on Linux you might want to refer to the devices
as
ttyS0 and ttyS1 instead of COM1 and COM2.


------------------------------

Date: Tue, 24 Jun 2003 03:05:42 +0100
From: Jacqui Caren <jacqui.caren@ntlworld.com>
Subject: Re: Loading perl modules / Caching when it shouldn't - HELP!
Message-Id: <Xns93A4221B8781Ajacquicntlworldcom@195.8.68.209>

david.gavini@digitallook.com (David Gavini) wrote in 
news:8dbc4bcc.0306230742.418971cb@posting.google.com:

>  
> The same is true when switching from B to A,
> Can't locate A/Test.pm
> 
> Do you know how I would solve this problem?

Yes replace your use libs qw() with

an unshift @INC etc.

Jacqui


------------------------------

Date: 23 Jun 2003 17:07:13 -0700
From: cboyce45@yahoo.com (Christopher Boyce)
Subject: Matching Problems
Message-Id: <c67657ff.0306231607.41ec65db@posting.google.com>

## This code works correctly

$string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";

$string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;

sub callsub {
        my($input) = shift;

        print $input."\n";
        ## Do something

        return "value";
}


## This does not because of the <table>

$string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";
$string .= "<!!BreadCrumb2(arg1, <table>, arg3)/>";


$string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;

sub callsub {
        my($input) = shift;

        print $input."\n";
        ## Do something

        return "value";
}


Is there anyway to make [^>] match more than one character?

Thanks,

Chris


------------------------------

Date: Tue, 24 Jun 2003 00:17:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Matching Problems
Message-Id: <3EF7987C.B17DD2B0@acm.org>

Christopher Boyce wrote:
> 
> ## This code works correctly
> 
> $string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";
> 
> $string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;
> 
> sub callsub {
>         my($input) = shift;
> 
>         print $input."\n";
>         ## Do something
> 
>         return "value";
> }
> 
> ## This does not because of the <table>
> 
> $string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";
> $string .= "<!!BreadCrumb2(arg1, <table>, arg3)/>";
> 
> $string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;
> 
> sub callsub {
>         my($input) = shift;
> 
>         print $input."\n";
>         ## Do something
> 
>         return "value";
> }
> 
> Is there anyway to make [^>] match more than one character?

Yes.   [^>]{2,}


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Mon, 23 Jun 2003 19:26:04 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Matching Problems
Message-Id: <slrnbff6ks.2lu.tadmc@magna.augustmail.com>

Christopher Boyce <cboyce45@yahoo.com> wrote:

> $string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;
                                             ^^^
                                             ^^^

You shouldn't just throw modifiers on whilly nilly.

m//s only affects dot, it is a no-op when there is no dot in the pattern.

m//i affects letters, it is a no-op when there are no letters in the pattern.

m//x allows you to embed spaces and comments, it is a no-op when
there are no spaces or comments in the pattern.


Exclamation points are not meta, they do not need to be backslashed.

You probably don't want the ampersand on your function call either.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 23 Jun 2003 19:33:03 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Matching Problems
Message-Id: <slrnbff71v.2lu.tadmc@magna.augustmail.com>

Christopher Boyce <cboyce45@yahoo.com> wrote:

> ## This does not because of the <table>
> 
> $string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";
> $string .= "<!!BreadCrumb2(arg1, <table>, arg3)/>";
> 
> 
> $string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;


> Is there anyway to make [^>] match more than one character?


Yes, but what does that have to do with solving the problem you presented?

The problem is that [^>] will not match the < in <table>, so you
don't need it to match more than one character, you need it to
match an angle bracket character.

If [^>] does not match what you want to match, then use a different pattern.


   $string =~ s# <!! (.*?) /> # callsub($1) #exg;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 24 Jun 2003 03:20:15 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Matching Problems
Message-Id: <slrnbffgri.am9.mgjv@verbruggen.comdyn.com.au>

On Mon, 23 Jun 2003 19:33:03 -0500,
	Tad McClellan <tadmc@augustmail.com> wrote:
> Christopher Boyce <cboyce45@yahoo.com> wrote:
> 
>> ## This does not because of the <table>
>> 
>> $string  = "<!!BreadCrumb(arg1, arg2, arg3)/>";
>> $string .= "<!!BreadCrumb2(arg1, <table>, arg3)/>";
>> 
>> 
>> $string =~ s/<\!\!([^>]*)\/>/&callsub($1)/esixg;
> 
> 
>> Is there anyway to make [^>] match more than one character?
> 
> 
> Yes, but what does that have to do with solving the problem you presented?
> 
> The problem is that [^>] will not match the < in <table>, 
                                              ^
ITYM '>' -------------------------------------|

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | values of Beta will give rise to dom!
                        | 


------------------------------

Date: Tue, 24 Jun 2003 01:38:02 GMT
From: "Law Barstow" <law3@NOSPAM.hotmail.com>
Subject: Newbie help with LWP
Message-Id: <_XNJa.9773$C83.962550@newsread1.prod.itd.earthlink.net>

Hello,

I am fairly new to perl and have run into problem and seek some help.

Here's what I am trying to do:
1. Login to my homefirewall
2. Pull up thepage with my WAN IP and save to a file (will worry about
parsing later)
3. Send the WAN IP to my work email.

I have gotten #3 to work but am having problems with #1 and #2.

my script is:

# Routine to open browser page
sub open_page{
        my $browser = LWP::UserAgent->new;
        my $pass ="XXXXX";
        my $url = 'http://192.168.2.1:88';        #This is the login page
        my $response = $browser->post(
        $url,
        [
                'pws' => $pass,                        #variables explained
below
                'Login'=>'Login'
        ],
);
        die "Can't get $url: ", $response->status_line
          unless $response->is_success;

    my $status = getstore('http://192.168.2.1:88/status.HTM','info');  #This
is the page I want
    die "Error $status on url" unless is_success($status);

}

The main page, 192.168.2.1:88 has a textbox and two buttons.  Textbox is to
input the password, buttons are"login" and "cancel",

If it helps, the HTML coding for the page is:
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0022)http://192.168.2.1:88/ -->
<HTML><HEAD><TITLE>Login</TITLE>
<META http-equiv=content-type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY bgColor=#0000ff>
<FORM name=tF action=login.htm method=post><INPUT type=hidden value=login
name=page>
<TABLE height=184 cellSpacing=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD align=middle width="100%" colSpan=2 height=103><A
      href="http://www.smc.com/"><IMG height=59
src="Login_files/SMClogo.gif"
      width=155 border=0></A> </TD></TR>
  <TR>
    <TD align=middle width="100%" colSpan=2 height=19>
      <H2><FONT face="Arial, Helvetica, sans-serif" color=#ffffff>Login
      &nbsp;Screen</FONT></H2></TD></TR>
  <TR>
    <TD align=right width="50%" height=19><FONT
      face="Arial, Helvetica, sans-serif" color=#ffffff
      size=2>Password&nbsp;&nbsp;&nbsp;:</FONT></TD>
    <TD align=left width="50%" height=19><INPUT type=password maxLength=12
      size=9 name=pws></TD>
    <P></P></TR>
  <TR>
    <TD width="50%" height=19>&nbsp;</TD>
    <TD width="50%" height=19>&nbsp;</TD></TR>
  <TR>
    <TD align=right width="50%" height=19><INPUT type=submit
value=Login><IMG
      height=1 src="Login_files/PIXEL.gif" width=6> </TD>
    <TD align=left width="50%" height=19><INPUT class=button
onclick=window.close(); type=button value=Cancel>
    </TD></TR></TBODY></TABLE></FORM></BODY></HTML>"

===

Now the problem I am having is getting the login to work, the script runs
and produces a 404 error when trying to pull the status page, which is the
same error I get when manually trying to get to the status without logging
in.  Leads me to believe the loging isn't working.

How do I get the scipt to send the password and a carriage return?  Or send
the password and send the login= true?

Any help is appreciated.

THank you,
Law Barstow




------------------------------

Date: Tue, 24 Jun 2003 02:41:40 +0200
From: Eric Strunk <estrunk @ home.nl>
Subject: Please help with a script, knoledge needed!
Message-Id: <nf7ffv47h4efaiu3ps50u80s5vsdv62nih@4ax.com>

Hello all,

I don't have any knoledge of perl but i have a script what is running
on the server and doesn't do his job.

It has to search along a lot of files and find a word in a line.
If it finds the word only this line has to be displayed on the screen.
Then it has to search for the next same word in the same file.
If it doesn't find the next word in a line it has to go to the next
file and do the same again.

Until the first word in the file it works nice and even the printing
is fine. But it never find the next line what contain the same search
querie, instead it goes to the next file and find there the first word
and so on.

This is the search file with printing,
-------------------------------------------------------------
#!/usr/bin/perl  

use strict;
use warnings;
use CGI;
use CGI::Carp ("fatalsToBrowser");
my $q = CGI->new;
my $zoek = $q->param("zoek");
chdir "/www/xxx.xxx.xxxxxx.xx/xxxx";
my @data_files = glob "*.*";

print CGI::header();
print CGI::start_html(" my searchengine");

print <<EOT;
<P><UL><BR><FONT SIZE=+1><B><I>Legenda:</I></B></FONT><P>
1 = Recordnummer<BR>
2 = Geslacht<BR>
3 = Naam en voornamen<BR>
4 = Geboorteplaats<BR>
5 = Geboortedatum<BR>
6 = Overlijdensdatum<BR>
7 = Recordnummer vader<BR>
8 = Recordnummer moeder<BR></UL><P><HR WIDTH=33% ALIGN=LEFT>
EOT


my $hits = 0;
foreach my $file ( @data_files ) {
    if ( !open F, "<$file" ) {
        warn "Could not open $file ($!)\n";
        next;
    }

    my $found = 0;
    while (<F>) {
        if ( /$zoek/i ) {
            $hits++;
            print
"<pre><b>Bestandsnaam</b><br>\n<i>$file</i></PRE><br>\n";
            print "<pre>    1  2      3
4                                                     5          6
7       8</pre>" ; \
		print "<pre>$_\n<br></PRE>";
            last;
        }
    }
    close F;
}

print "<h3>", $hits ? $hits : "Geen", " bestanden gevonden</H3>";

--------------------------------------------------------------------
This is it, can anyone help me please to get all the lines in one file
and go to the next file after that.

Kind regards 
Eric.


------------------------------

Date: Tue, 24 Jun 2003 00:49:56 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Please help with a script, knoledge needed!
Message-Id: <mbudash-7A6549.17495523062003@typhoon.sonic.net>

In article <nf7ffv47h4efaiu3ps50u80s5vsdv62nih@4ax.com>,
 Eric Strunk <estrunk @ home.nl> wrote:

> Hello all,
> 
> I don't have any knoledge of perl but i have a script what is running
> on the server and doesn't do his job.
> 
> It has to search along a lot of files and find a word in a line.
> If it finds the word only this line has to be displayed on the screen.
> Then it has to search for the next same word in the same file.
> If it doesn't find the next word in a line it has to go to the next
> file and do the same again.
> 
> Until the first word in the file it works nice and even the printing
> is fine. But it never find the next line what contain the same search
> querie, instead it goes to the next file and find there the first word
> and so on.
> 
> This is the search file with printing,
> -------------------------------------------------------------
> #!/usr/bin/perl  
> 
> use strict;
> use warnings;
> use CGI;
> use CGI::Carp ("fatalsToBrowser");
> my $q = CGI->new;
> my $zoek = $q->param("zoek");
> chdir "/www/xxx.xxx.xxxxxx.xx/xxxx";
> my @data_files = glob "*.*";
> 
> print CGI::header();
> print CGI::start_html(" my searchengine");
> 
> print <<EOT;
> <P><UL><BR><FONT SIZE=+1><B><I>Legenda:</I></B></FONT><P>
> 1 = Recordnummer<BR>
> 2 = Geslacht<BR>
> 3 = Naam en voornamen<BR>
> 4 = Geboorteplaats<BR>
> 5 = Geboortedatum<BR>
> 6 = Overlijdensdatum<BR>
> 7 = Recordnummer vader<BR>
> 8 = Recordnummer moeder<BR></UL><P><HR WIDTH=33% ALIGN=LEFT>
> EOT
> 
> 
> my $hits = 0;
> foreach my $file ( @data_files ) {
>     if ( !open F, "<$file" ) {
>         warn "Could not open $file ($!)\n";
>         next;
>     }
> 
>     my $found = 0;
>     while (<F>) {
>         if ( /$zoek/i ) {
>             $hits++;
>             print
> "<pre><b>Bestandsnaam</b><br>\n<i>$file</i></PRE><br>\n";
>             print "<pre>    1  2      3
> 4                                                     5          6
> 7       8</pre>" ; \
> 		print "<pre>$_\n<br></PRE>";
>             last;

^^^^^^^^^^^^^^^^^^^
remove this line

>         }
>     }
>     close F;
> }
> 
> print "<h3>", $hits ? $hits : "Geen", " bestanden gevonden</H3>";
> 
> --------------------------------------------------------------------
> This is it, can anyone help me please to get all the lines in one file
> and go to the next file after that.
> 
> Kind regards 
> Eric.

hth-

-- 
Michael Budash


------------------------------

Date: Tue, 24 Jun 2003 11:20:28 +1000
From: "Tony" <anthony@no_spam.movielink.net.au>
Subject: Problem with "system" call - multiple invocations (Newbie)
Message-Id: <pan.2003.06.24.01.20.28.773936@no_spam.movielink.net.au>


Newbie question,

Hi guys,

I need to invoke a perl script from another perlscript
with different parms passed to the second perl script.

Code snippet
==============
my ($no1,$no2) = (0,1)
my $num = "single digit var from other part of program";
my $file = "/some/path/file_"
my $perl_script = "/some/path/perl_program";

if ($num == 1) {
  system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script once
  exit(0);
if ($num == 2) {
  system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script 2 times
  system "$perl_script" , "$file$no2" , "&";   # with different file name.
  exit(0);

# My "$perl_script" program takes the
# file name and processes it in a process that never
# will return, that is why I use "&" so the invoking
# perl script can start the next invocation when there are
# 2 different file names.

The above does not work as expected.  With $num = 2 the first
invocation of "$perl_script" runs but not the second one.  Killing
the first one using kill PID allows the second one to start, in other
words the "&" does not seem to do what it is supposed to do, let
the calling script continue with the next item on the list.

What am I doing wrong here?

I have tried various combinations of `` '' "" but nothing gives. 

Tony

-- 
--------------------------------------------------------------
To reply directly send to: anthony AT movielink DOT net DOT au
Replace AT and DOT with @ and . and mail will get through.



------------------------------

Date: Tue, 24 Jun 2003 13:49:37 +1000
From: "Tony" <anthony@no_spam.movielink.net.au>
Subject: Re: Problem with "system" call - multiple invocations (Newbie)
Message-Id: <pan.2003.06.24.03.49.37.217423@no_spam.movielink.net.au>

On Tue, 24 Jun 2003 11:20:28 +1000, Tony wrote:

> 
> Newbie question,
> 

Replying to my own post...:-))

> Hi guys,
> 
> I need to invoke a perl script from another perlscript
> with different parms passed to the second perl script.
> 
> Code snippet
> ==============
> my ($no1,$no2) = (0,1)
> my $num = "single digit var from other part of program";
> my $file = "/some/path/file_"
> my $perl_script = "/some/path/perl_program";
> 
> if ($num == 1) {
>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script once
>   exit(0);
> if ($num == 2) {
>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script 2 times
>   system "$perl_script" , "$file$no2" , "&";   # with different file name.
>   exit(0);

After searching even more "igh and low" it would seem that what
I was trying is simply not possible!

Instead I inserted fork statements before every required
invocation of the $perl_script with an "exec" call in every
child process while placing an exit in the last parent process.

That seems to have acheived what I wanted, not pretty but works...

Any other coments on this approach?

Tny
> 
> # My "$perl_script" program takes the
> # file name and processes it in a process that never
> # will return, that is why I use "&" so the invoking
> # perl script can start the next invocation when there are
> # 2 different file names.
> 
> The above does not work as expected.  With $num = 2 the first
[...]

-- 
--------------------------------------------------------------
To reply directly send to: anthony AT movielink DOT net DOT au
Replace AT and DOT with @ and . and mail will get through.




------------------------------

Date: Mon, 23 Jun 2003 18:15:40 -0400
From: "magpie" <magpie@optonline.net>
Subject: Problem with calling an vb6 executable from perl script on IIS 5
Message-Id: <bd7u5s$lb0$1@slb2.atl.mindspring.net>

Hi, perhaps you can help solve this mystery.

I call an exe from a perl script on windows 2k web server unning IIS 5.0,
but the script will not run when called from a web page.  The script calls
an executable that creates a jpg (a small vb6 app). So when called from the
web page , it does not seem to launch on the webserver, display the form and
then export the map back properly to an html so users can see.  I even
tested the vb6 app with a message box prompt, and it will not display.  IS
there a setting in IIS that prevents the program from running so we can see
output?

The script works fine from direct perl and the exe works from command line.
(ps.  i know the script works and rights are fine because the jpg is
actually generated and sent to the user, just a partial jpeg (incomplete as
if the vb6 form was never able to display properly).  I think the form needs
to genereate totally before export to jpg and IIS is not allowing.

activestate perl is on the web server.

Thanks




------------------------------

Date: 23 Jun 2003 18:37:06 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: soap::lite hellp needed with sms
Message-Id: <1bff1830.0306231737.57a897c8@posting.google.com>

mike solomon <mike_solomon@lineone.net> wrote in message news:<3EF70B29.3050106@lineone.net>...
> I am trying to send sms messages using a SOAP interface
> 
> I think the way to go is to use soap::lite
> 
> I have had a look at the documentation and I must admit that I don't 
> understand what I need to do
> 
> the XML example I have been given is as follows:
> 
> POST /secure/messenger/soap/SendService.asmx HTTP/1.1
> Host: www.esendex.com
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> SOAPAction: "com.esendex.ems.soapinterface/SendMessageFull"
> 
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Header>
>      <MessengerHeader xmlns="com.esendex.ems.soapinterface">
>        <Username>USERNAME</Username>
>        <Password>PASSWORD</Password>
>        <Account>ACCOUNT</Account>
>      </MessengerHeader>
>    </soap:Header>
>    <soap:Body>
>      <SendMessageFull xmlns="com.esendex.ems.soapinterface">
>        <originator>ORIGINATOR</originator>
>        <recipient>RECIPIENT</recipient>
>        <body>test message</body>
>        <type>Text</type>
>        <validityperiod>int</validityperiod>
>      </SendMessageFull>
>    </soap:Body>
> </soap:Envelope>
> HTTP/1.1 200 OK
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> 
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>      <SendMessageFullResponse xmlns="com.esendex.ems.soapinterface">
>        <SendMessageFullResult>string</SendMessageFullResult>
>      </SendMessageFullResponse>
>    </soap:Body>
> </soap:Envelope>
> 
> Any help to achieve this would be gratefully received
> 
> sorry I haven't posted any code but I am getting nowhere with this at 
> present and the gateway I am using don't know any Perl so they can't 
> give me any pointers
> 

I'm really don't know SOAP too well, but here is my shot at it.  

use strict;
use warnings;
use SOAP::Lite;

# change the host to the correct one!
my $host  = 'www.esendex.com';
#my $host  = 'localhost:6060';

my $proxy = "http://$host/secure/messenger/soap/SendService.asmx";
my $uri   = "http://$host/com.esendex.ems.soapinterface";

#The name of the module
my $soap = SOAP::Lite->uri($uri);
print "soap = $soap\n";

#The url for the request
$soap = $soap->proxy($proxy);
print "soap = $soap\n";

# send the request w/ header
my $response = $soap->SendMessageFull(

  # HEADER
  SOAP::Header->name(Username => 'bryan'),
  SOAP::Header->name(Password => 'monkeyman'),
  SOAP::Header->name(Account  => '0099'),

  # PARAMETERS FOR BODY
  SOAP::Data->name(originator     => 'Bank One'),
  SOAP::Data->name(recipient      => 'me'),
  SOAP::Data->name(body           => 'give me the dough'),
  SOAP::Data->name(type           => 'USD'),
  SOAP::Data->name(validityperiod => 99)

);

print "response = $response\n";

# get the result and print the error message if it failed
if (defined (my $result = $response->result)) {
  print "result = $result\n";
}
else {
  print "Fault: ", $response->faultstring, "\n",
        "Detail:\n", $response->faultdetail, "\n";
}




I had the request sent to my system and I saved the request using
netcat.
(http://www.codetalker.com/downloads/nc11nt.zip)
(c:\nc -l -p 6060 > request.xml)
The request looks like this (I formatted the xml though).



POST /secure/messenger/soap/SendService.asmx HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Accept: text/xml
Accept: multipart/*
Host: localhost:6060
User-Agent: SOAP::Lite/Perl/0.55
Content-Length: 934
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://localhost:6060/com.esendex.ems.soapinterface#SendMessageFull"

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Header>
    <Username xsi:type="xsd:string">bryan</Username>
    <Password xsi:type="xsd:string">monkeyman</Password>
    <Account xsi:type="xsd:int">0099</Account>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <namesp1:SendMessageFull 
        xmlns:namesp1="http://localhost:6060/com.esendex.ems.soapinterface">
      <originator xsi:type="xsd:string">Bank One</originator>
      <recipient xsi:type="xsd:string">me</recipient>
      <body xsi:type="xsd:string">give me the dough</body>
      <type xsi:type="xsd:string">USD</type>
      <validityperiod xsi:type="xsd:int">99</validityperiod>
    </namesp1:SendMessageFull>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


It looks pretty close, but I don't think it will work.  I tried
sending it w/ bogus data and got:

soap = SOAP::Lite=HASH(0x1c6ed50)
soap = SOAP::Lite=HASH(0x1c6ed50)
response = 1
Fault: System.Web.Services.Protocols.SoapException: Server did not
recognize the value of HTTP Header SOAPAction:
com.esendex.ems.soapinterface#SendMessageFull.
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type
type, HttpContext context, HttpRequest request, HttpResponse response,
Boolean&abortProcessing)
Detail:


You should see that the SOAPAction is different between what I
generated and the xml you posted.  I tried removing the http and
hostname from the uri method, however I still received the same error.
 I don't know why the xml you showed had a '/' while mine had a '#',
but then again I don't really know SOAP.

I hope this gets you going in the right direction though.

I would also ask the company, if they had example client code in other
languages.


> Thanks
> 
> Regards
> 
> 
> Mike Solomon


------------------------------

Date: Mon, 23 Jun 2003 23:53:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: unicode in Image::Magick (hex values and braces problem?)
Message-Id: <Pine.LNX.4.53.0306232335220.31161@lxplus014.cern.ch>

On Mon, Jun 23, Bert Balcaen inscribed on the eternal scroll:

> yup, i am creating $text like this:
>
> my $text="";
> for(my $uni=25000;$uni<25100;$uni++) {
> 	$text .= chr(hex($uni));
> 	$uni ++;
> }
>
> and this works like a breeze!

It does?  I don't understand what the hex() is doing in there.
You intended, I thought, to produce characters starting at
hex 61A8 (decimal 25000).

Without the hex, i.e just chr($uni), I get plausible Chinese-looking
characters, presumably from the "CJK unified ideographs" area (4e00 to
9fff hex).

But _with_ the hex(), what will happen is that it'll take your decimal
number e.g 25000, treat it as a string of hexadecimal digits, and get
the decimal equivalent of that, which isn't at all what you intended,
surely?  As it happens, _hex_25000 is in the "CJK Unified ideographs
extension B" area (from 20000 to 2a6df in the reference I'm looking at
- Unicode 3.2.0), so I suppose there's a chance that you might be
seeing some CJK glyphs (they're not in my fonts, I don't think).

Have fun (I can't read Chinese anyway...)


------------------------------

Date: Mon, 23 Jun 2003 21:20:01 +0200
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: unicode in Image::Magick (hex values and braces problem?)
Message-Id: <pan.2003.06.23.19.20.00.246125@kamelfreund.de>

Bert Balcaen wrote at Mon, 23 Jun 2003 21:28:16 +0000:

> my $text="";
> for(my $uni=25000;$uni<25100;$uni++) {
> 	$text .= chr(hex($uni));
> 	$uni ++;
> }

That seems only to be a long version of

my $text = join "" map chr, (0 .. 25_000);


Greetings,
Janek


------------------------------

Date: 23 Jun 2003 16:17:55 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: unicode in Image::Magick (hex values and braces problem?)
Message-Id: <etosmq0tp4c.fsf@wormtongue.emschwar>

"Janek Schleicher" <bigj@kamelfreund.de> writes:
> Bert Balcaen wrote at Mon, 23 Jun 2003 21:28:16 +0000:
> > my $text="";
> > for(my $uni=25000;$uni<25100;$uni++) {
> > 	$text .= chr(hex($uni));
> > 	$uni ++;
> > }
> 
> That seems only to be a long version of
> 
> my $text = join "" map chr, (0 .. 25_000);

You appear to have misspelled

my $text = join "", map chr, (25000 .. 25099);

(Note comma after join's 1st arg, and correct indices.)

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


------------------------------

Date: Mon, 23 Jun 2003 23:36:30 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: using SOAP::Lite to call other services.
Message-Id: <sggffvgs5bsmcglsc49ojrvqlvl5oem4k0@4ax.com>

On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
wrote:

>Hi,
>
>  I'm using SOAP::Lite to write a few services.  I managed to get a
>  few clients/server running correctly.
>
>  I'm having trouble getting SOAP::Lite to call external, non-Perl
>  services, however.  The service I am interested in is
>  'ValidateEmail' (see
>  http://www.webservicex.net/ValidateEmail.asmx).
>
>  According to the SOAP::Lite documentation, it is perfectly valid to
>  do:
>
>          print "RESULT: ", SOAP::Lite
>            -> uri('http://www.webserviceX.NET')
>            -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
>            -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
>            -> IsValidEMail($email) . "\n";

None of their examples use both proxy() and service().  Try eliminating
the proxy().

-- 
Eric Amick
Columbia, MD


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5128
***************************************


home help back first fref pref prev next nref lref last post