[17911] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 71 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 16 14:05:39 2001

Date: Tue, 16 Jan 2001 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979671907-v10-i71@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 16 Jan 2001     Volume: 10 Number: 71

Today's topics:
        bug in Win32::Internet grehom@my-deja.com
    Re: exit... a good question (BUCK NAKED1)
    Re: exit... a good question <brondsem@my-deja.com>
    Re: Fetching server's hard-disk with Perl (Anno Siegel)
        How to convert a double-spaced file to single spaced? <brannon@lnc.usc.edu>
    Re: How to convert a double-spaced file to single space <prlawrence@lehigh.edu>
    Re: Jumbling words <joe+usenet@sunstarsys.com>
    Re: Jumbling words <lmoran@wtsg.com>
    Re: More questions about pattern matching mintcake@my-deja.com
    Re: NEWBIE: need help with search spider/crawler (someone of export)
    Re: NEWBIE: need help with search spider/crawler <lmoran@wtsg.com>
    Re: Perl and AOL. How is this possible? <smerr612@mailandnews.com>
    Re: Perl and AOL. How is this possible? <roman.stawski@fr.adp.com>
    Re: Perl for Palm? <flegga@uk.ibm.com>
        Perl module for SMPP <lewtk@attglobal.net>
    Re: Putting text in an image? gls@byu.edu
    Re: Putting text in an image? <eric.kort@vai.org>
    Re: Random Numbers with a Twist <rob@frii.com>
    Re: RegEx , matching ? <ren.maddox@tivoli.com>
        Unicode conversion module wanted. <glchy@my-deja.com>
    Re: What's wrong with this (parent fork multiple childr mintcake@my-deja.com
    Re: What's wrong with this (parent fork multiple childr <davesisk@ipass.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Jan 2001 17:13:59 GMT
From: grehom@my-deja.com
Subject: bug in Win32::Internet
Message-Id: <941vgd$uoi$1@nnrp1.deja.com>

I am finding incorrect years (this year on files from last year) using
this test program:
#!perl -w
    use Win32::Internet;
    my $INET = new Win32::Internet();
    $INET->FTP($FTP, "server_name", "user_name", "password");
    $FTP->Cd("/user/cwintops/site/cis/design_docs");
    my @files = $FTP->List("*.*", 3);
    foreach my $file (@files) {
        print $file->{'name'}, " "
            , $file->{'size'}, " "
            , $file->{'mtime'}, "\n";
    }
I am running on Windows NT using latest release of Activestate's Perl
(build 623) - the module above is built into the release - could someone
try it on their machine - thanks.
Example output:
C:\perlSrcs\test>perl -w test_ftp.pl
 . 512 0,33,8,10,1,2001
 .. 512 0,0,0,17,7,2000
IDD 2048 0,33,8,10,1,2001
default.htm 990 0,6,12,14,8,2000
frame_contents.htm 3174 0,33,8,10,1,2001
frame_main.htm 651 0,0,0,12,6,2000
index3.htm 9199 0,0,0,12,6,2000
index4.htm 3484 0,0,0,12,6,2000
index5.htm 3768 0,0,0,12,6,2000
index6.htm 2670 0,0,0,12,6,2000
index7.htm 2946 0,0,0,12,6,2000
index8.htm 4101 0,51,12,11,9,2000
index9.htm 2290 0,12,5,11,1,2001

C:\perlSrcs\test>
For example file 'frame_main.htm' was last modified last june.


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 16 Jan 2001 11:08:47 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: exit... a good question
Message-Id: <12045-3A64801F-21@storefull-247.iap.bryant.webtv.net>

I understand exactly what you mean. I have the same problem on a CGI
server, and hope someone will kindly answer this. In my situation... if
someone finishes a process, then temp files get removed as they should.
However, if someone's PC crashes, they back out before finishing, etc.,
etc... then I'm left with files that do not get deleted. 

I'm hoping there is a Perl solution, instead of using something like a
JS "body onUnload" event handler. I don't want to use JS because 1) I
have no other JS in the script, 2) people sometimes have JS turned off,
3) JS fails more often than Perl, 4) JS doesn't work the same on all
browsers, etc.

Sounds like a CGI question, and maybe that's why no one is answering.
Perhaps this question should've been posted in the cgi authoring ng? :)
If you don't receive an answer, I'd suggest posting this there.

Regards,
Dennis
 
sandywadkins123@my-deja.com 
> Perl 5, HTML, little java script. 
> Ok I wrote scripts making each user 
> have a temp. file (xxx.dat). When they 
> sumit it updates a file, then gets 
> deleted. 
> Question: if they don't submit and close > it the file is hanging out
there. So how 
> can I capture when they exit? 
  



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

Date: Tue, 16 Jan 2001 17:57:30 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: exit... a good question
Message-Id: <942225$17d$1@nnrp1.deja.com>

In article <12045-3A64801F-21@storefull-247.iap.bryant.webtv.net>,
  dennis100@webtv.net (BUCK NAKED1) wrote:
> I understand exactly what you mean. I have the same problem on a CGI
> server, and hope someone will kindly answer this. In my situation...
if
> someone finishes a process, then temp files get removed as they
should.
> However, if someone's PC crashes, they back out before finishing,
etc.,
> etc... then I'm left with files that do not get deleted.
>
> I'm hoping there is a Perl solution, instead of using something like a
> JS "body onUnload" event handler. I don't want to use JS because 1) I
> have no other JS in the script, 2) people sometimes have JS turned
off,
> 3) JS fails more often than Perl, 4) JS doesn't work the same on all
> browsers, etc.
>
> Sounds like a CGI question, and maybe that's why no one is answering.
> Perhaps this question should've been posted in the cgi authoring
ng? :)
> If you don't receive an answer, I'd suggest posting this there.
>
> Regards,
> Dennis
>
> sandywadkins123@my-deja.com
> > Perl 5, HTML, little java script.
> > Ok I wrote scripts making each user
> > have a temp. file (xxx.dat). When they
> > sumit it updates a file, then gets
> > deleted.
> > Question: if they don't submit and close > it the file is hanging
out
> there. So how
> > can I capture when they exit?



You need to design your perl program(s) so that if a user doesn't
finish all N steps, they can return at a later date to the correct
step.  This is not specific to any language, but is a concept that
needs to be taken into consideration given a stateless protocol.  The
easiest way (I think) to do this would have the program check the data
files on the server to deduce the current step.  It may be necessary to
create a data file that stores a step number.


--
Dave Brondsema


Sent via Deja.com
http://www.deja.com/


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

Date: 16 Jan 2001 16:54:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Fetching server's hard-disk with Perl
Message-Id: <941ubt$in8$1@mamenchi.zrz.TU-Berlin.DE>

 <-nancy-@libero.it> wrote in comp.lang.perl.misc:
>Hi
>
>I'm trying to write a perl script
>who indexes the content of a web server's hard disk
>simply by typing an URL.
>
>The script has to list all the files on the server's hard disk
>on which that URL is hosted.
>
>Is it possible to do so ? If so, do I have to use LWP ?

This has nothing to do with Perl, but since the answer is simple, I'll
give it: No.

Well, no, unless you control the server and set it up to serve this
expansive kind of request.  This would have to be discussed in a group
that talks about www servers.

Anno


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

Date: Tue, 16 Jan 2001 17:13:48 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: How to convert a double-spaced file to single spaced?
Message-Id: <lbsnmjwhbn.fsf@lnc.usc.edu>


How can I do this as a Perl one-liner? I get very confused when I try
to understand the -n -p -l -e options of perl, but I am sure I can do
this in one line if I could figure them out.

Sorry if this is a FAQ.

-- 
Terrence Brannon
Carter's Compass...
    I know I'm on the right track when by deleting code I'm adding
    functionality.


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

Date: Tue, 16 Jan 2001 11:29:54 -0600
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: How to convert a double-spaced file to single spaced?
Message-Id: <9420eh$f1i@fidoii.CC.Lehigh.EDU>


"Terrence Brannon" <brannon@lnc.usc.edu>:
> How can I do this as a Perl one-liner? I get very confused when I try
> to understand the -n -p -l -e options of perl, but I am sure I can do
> this in one line if I could figure them out.

Start by making it a non-one-liner...  Then wash repeatedly.

Phil R Lawrence
prlawrence@lehigh.edu




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

Date: 16 Jan 2001 11:30:05 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Jumbling words
Message-Id: <m3bst7xxwy.fsf@mumonkan.sunstarsys.com>

Lou Moran <lmoran@wtsg.com> writes:

> --I have been reading the "Code Breaking" thread (which deals with
> replacing letters with "something") and it got me to thinking about
> jumbling words.
> 
> --How could I take BAR and turn it into a list of all of the possible
> versions of that word?
>
> --I don't know what that process is called so finding it in the Docs
> is fairing poorly.
> 
> --please shove me in the right direction.

% perldoc -q permute

-- 
Joe Schaefer


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

Date: Tue, 16 Jan 2001 11:35:53 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Jumbling words
Message-Id: <h2u86t48d4d849n2raulh4drk12hcnk6ht@4ax.com>

On 16 Jan 2001 11:30:05 -0500, Joe Schaefer
<joe+usenet@sunstarsys.com> wrote wonderful things about sparkplugs:


>> --please shove me in the right direction.
>
>% perldoc -q permute

Perfect.  Thank you.


lmoran@wtsgSPAM.com
print "\x{263a}"


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

Date: Tue, 16 Jan 2001 15:56:04 GMT
From: mintcake@my-deja.com
Subject: Re: More questions about pattern matching
Message-Id: <941quf$qbj$1@nnrp1.deja.com>

In article <940r4m$s87$1@brokaw.wa.com>,
  "Mike McPherson" <hafateltec@hotmail.com> wrote:
> First I think that there should be a newsgroup just for perl re
alone :)  I
> think it would get the traffic LOL
>
> #!/usr/bin/perl -w
> print "\nPlease input a ip address in xxx.xxx.xxx.xxx format --->";
> $validip = <STDIN>;
>
> unless ($validip =~
> /^[0-2][0-5]{2}.[0-2][0-5]{2}.[0-2][0-5]{2}.[0-2][0-5]{2}/) {
> chomp($validip);
> print "\n$validip: Not a valid ip\n";
> }else{
> chomp($validip);
> print "\n$validip is valid\n";
> }
>
> As I read I am seeing more and more on how to do this regexp but
there are
> still some things that I am not sure on.
> For example the above will validate a number such as 111.111.111.111
yet it
> will not validate 249.249.249.249 ::

Is it because you're trying to match dots with dots. A . matches any
character in a regexp - you need \.

>
> Say for instance I wanted to eval a phone number xxx-xxxx
> #!/usr/bin/perl -w
> $phone = shift @ARGV;
> unless ($phone =~ /\d{3}-\d{4}/) {
> print "What phone number is $phone\n";
> }
> else {
> chomp $phone;
> print "What a buetifull phone number $phone\n";
> }
>
> Works great right... But what if I wanted to make sure that xxx-xxxx
>
> ^^^^ = 0001 to 3999 ???

If I undestand you right you want:

  unless ($phone =~ /\d{3}-(\d{4})/ && $1 > 0 && $1 < 4000) {...

>
> So now you can see some of my frustration.  Unfortunatly my "Mastering
> Regular Expressions by Jeffrey Friedl" is still 3 days away from
getting
> here and I need to figure this out earlier than that so all help is
> appriciated.
>
> Thank's
> Mike
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 16 Jan 2001 19:28:39 GMT
From: lashawn@rice.edu (someone of export)
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <3a649c53.237844060@news.rice.edu>

On Tue, 16 Jan 2001 22:17:27 +1000, "Jeffrey Grace"
<gracenews@optusnet.com.au> wrote:

>already posted part of this in alt.perl, but want to ensure you know not
>everyone has the same opinions and/or attitudes.
>
>http://www.stonehenge.com/merlyn/WebTechniques/col35.html
>
>Implements a fair amount of what you want to do, and he gives a good
>description of what each group of lines do, its a big script for him, and
>his explanation isn't quite as detailed as it normally is, if you get a bit
>lost, look at some of the earlier articles.
>

Thanks.  It basically does the crawling and recursing part. It looks
like I won't need to mess with access or coldfusion at all, only the
website's local files and their external links (for the search and
scheduling part).  
s.


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

Date: Tue, 16 Jan 2001 13:36:04 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <n3596t0t72ur4sjpca6muhoge26up0vcl6@4ax.com>

On 16 Jan 2001 08:56:18 GMT, abigail@foad.org (Abigail) wrote
wonderful things about sparkplugs:

>Abigail
>-- 
>print 74.117.115.116.32;
>print 97.110.111.116.104.101.114.32;
>print 80.101.114.108.32;
>print 72.97.99.107.101.114.10;

This one is way cool...  I can't wait to figure out how it works.

lmoran@wtsgSPAM.com
print "\x{263a}"


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

Date: Tue, 16 Jan 2001 16:37:58 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Perl and AOL. How is this possible?
Message-Id: <941td4$sjf$1@nnrp1.deja.com>

In article <3a641ddf.4767407@news.newsguy.com>,
  usad1@gadnet.com (G.A.D.Miles) wrote:
> On 14 Jan 2001 00:40:14 GMT, abigail@foad.org (Abigail) wrote:
>
> >G.A.D.Miles (usad1@gadnet.com) wrote on MMDCXCII September MCMXCIII
in
> ><URL:news:3a605397.7747790@news.newsguy.com>:

<OP has a script which redirects a browser to an advertised page. It
works for Netscape and IE, but not AOL Browser>

> >.. How can this be possible since it is the server, not the browser
that
> >.. is running the code?

Hint:  If  your program is returning the exact same output to three
different browsers and it is producing different results on different
browsers, then it may be the way the browser is interpreting the
response from your program.

> I am asking here because, in a nutshell, a Perl script is operating in
> different ways under different browsers.

Nope.  The Perl script is always doing exactly the same thing.  You
would be well served to check up on how these different browsers
intrepret redirects and possibly put a little version-checking code in
your script so it sends the right form of response to the right browser.

> Are you always so rude?

Abigail is very curt with her answers.  But if you look at what she
says, she's usually addressing the core of the problem.  Abigail is kind
of like Unix manpages.  Nearly worthless at first glance, but solid gold
after you have attained a certain level of knowledge.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 16 Jan 2001 17:22:45 +0100
From: Roman Stawski <roman.stawski@fr.adp.com>
Subject: Re: Perl and AOL. How is this possible?
Message-Id: <3A647555.6C9FB79C@fr.adp.com>

Tad McClellan wrote:
> 
> Perl does not operate "under a browser" in ANY circumstance.
> 

Err, ActiveState _do_ have this thing called PerlScript which 
works "under a browser". Granted, it's nothing to do with the 
OP and even blatant nit-picking..., but we do want to be
accurate ;-)

-- 
Roman Stawski - ADPgsi


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

Date: Tue, 16 Jan 2001 15:56:00 +0000
From: Andrew Flegg <flegga@uk.ibm.com>
Subject: Re: Perl for Palm?
Message-Id: <3A646F10.2DF74EED@uk.ibm.com>

"allNIC.net" wrote:
> 
> Does anyone know of any PDAs which have decent Perl ports?

EPOC (which runs on - amongst many other devices - the Psion S5, S7,
NetBook and Revo; Diamond Mako; Ericsson MC218; ....) has a decent
port of 5.6.0, maintained by Olaf Flebbe, see:
    http://www.science-computing.de/o.flebbe/perl/perl5.html

You may also want a decent shell, see:
    http://www.deja.com/=dnc/getdoc.xp?AN=702556412

> If so, please email me at: joshwa@sonic.net

I won't if it's all the same ;-)

HTH,

Andrew

-- 
Andrew Flegg -- my opinions are my own, not my employer's.


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

Date: Wed, 17 Jan 2001 00:27:26 +0800
From: Lew Teck Kheng <lewtk@attglobal.net>
Subject: Perl module for SMPP
Message-Id: <3A64766E.9666B83B@attglobal.net>

hi all:

Does anybody come across Perl module for the SMPP protocol (Short
Message Peer to Peer ) protocol for SMS. ?

TIA.

Cheers



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

Date: 16 Jan 2001 10:39:31 -0700
From: gls@byu.edu
Subject: Re: Putting text in an image?
Message-Id: <uu26zmm5o.fsf@SNOW.i-did-not-set--mail-host-address--so-shoot-me>

"Eric" <eric.kort@vai.org> writes:

> Is there a perl module to help with placing text on an image?  For example,
> I am writing a program to generate a histogram of an image (thus creating a
> tiff), and I would like to be able to put numbers on the x axis scale.  Must
> I draw the numbers pixel by pixel, or is there a simpler way?

Not everything needs to be a module, Perl works great as a glue
language controling other programs.  If what you want is a histogram,
why not have your script pass the data to a program that specializes
in creating histograms? 

see:
http://www.r-project.org/
for a good, free one.

-- 
---------------------------------------------------------------------
 Dr. Gregory L. Snow         |  Inertia makes the world go round,
     (Greg)                  |   Love makes the trip worth taking.
   gls@byu.edu               |
---------------------------------------------------------------------



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

Date: Tue, 16 Jan 2001 13:45:11 -0500
From: "Eric" <eric.kort@vai.org>
Subject: Re: Putting text in an image?
Message-Id: <9424l2$26vq$1@msunews.cl.msu.edu>


<gls@byu.edu> wrote in message
news:uu26zmm5o.fsf@SNOW.i-did-not-set--mail-host-address--so-shoot-me...
> "Eric" <eric.kort@vai.org> writes:
>
> > Is there a perl module to help with placing text on an image?  For
example,
> > I am writing a program to generate a histogram of an image (thus
creating a
> > tiff), and I would like to be able to put numbers on the x axis scale.
Must
> > I draw the numbers pixel by pixel, or is there a simpler way?
>
> Not everything needs to be a module, Perl works great as a glue
> language controling other programs.  If what you want is a histogram,
> why not have your script pass the data to a program that specializes
> in creating histograms?
>
> see:
> http://www.r-project.org/
> for a good, free one.

Ah, R an perl.  Great thought.

Thanks,
Eric




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

Date: Tue, 16 Jan 2001 11:56:01 -0700
From: Rob Greenbank <rob@frii.com>
Subject: Re: Random Numbers with a Twist
Message-Id: <jc596tk9jgi681dk5hro12iou84a5ljiej@4ax.com>

OK, I'm gonna bite on this one.  

This sort of reminds me of the old maze game that came out in the 70's
book "101 Basic Computer Games", or something like that.  The solution
kept picking random points from the entire set of possible points, and
just went on if a point had been used.  The problem was with several
hundred points, on the average it took half that many random numbers
to get the very last point.  

I would propose a solution where a set of all possible points is
created.  Now when a point is randomly chosen, all points within 30 of
that point are removed from the set of possible points.  The next
point is then chosen from the new set.  This has the advantage that
you don't have to check a random choice to see if it's valid -- since
all invalid pionts are eliminated, it *will* be valid.  

The hard part here will be managing the points.  I'm not going to
spend a bunch of time on this, but the path I'd start down would be to
use a hash for the set of possible points.  For instance, point 3,45
would be:
	$point{"3,45"}

It's value isn't important -- set them all to 1 if you like.  

To eliminate a point simply:
	under $point{"$x,$y"};

Now chosing a point randomly from the has is a bit trickier, but I'd
probably assign the keys to an array and randomly pick from that.  

Once you have an x/y value, randomly chosen, you then go through the
range of indexes that are too close and undef the hash element (if it
hasn't been already).  

This also has the advantage that if a solution isn't possible, either
because it's mathmatically impossible to get enough points with the
grid size chosen or because the spacing of the points worked out such
that it can't be done, you will have an empty array of keys.  Very
easy to detect that an not loop around forever.  

Anyway, this is one solution that I think will work.  I'm sure there's
probably better ones out there, and I'll be interested in seeing them!

	Rob


On Mon, 15 Jan 2001 10:53:08 -0800, "Shawn Coppock"
<coppocks@bellsouth.net> wrote:

>I can yank random numbers from ranges etc. all day. But now, I need a little
>more and I am tripping to solve this one.
>
>#Problem:
>
>Lets say I need to generate 60 random pairs of numbers ($x,$y) ... where $x
>is from a range of 1..1200 and $y is from a range of 1..800. Consider these
>pairs as a random point or coordinate on a grid of 1200x800.
>
>In addition to this, each pair must be unique, in that
>1. no pair can be the same
>2. no pair can be within 30 of another
>
>#Example:
>
>Pair 1: 50,100
>Pair 2: 32,135
>Pair 3: 31,130
>etc..
>
>Assuming that the pair numbers are checked before being added to a final
>list...
>
>Pair 2 is ok because only one number is within 30 of Pair 1. But, Pair 3 is
>NOT ok, because both numbers are within 30 of another pair (Pair 2).
>
>
>I don't want the pairs/coordinates to be perfectly spaced by 30. There's no
>need because at 1200x800 there are 960k available points... and if no two
>are within 30 of another, there are still 320k possibilities.
>
>Any assistance here would be greatly appreciated!
>
>Shawn
>
>
>
>



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

Date: 16 Jan 2001 11:08:55 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: RegEx , matching ?
Message-Id: <m3puhn5src.fsf@dhcp11-177.support.tivoli.com>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:

> Ricky wrote in comp.lang.perl.misc:
> > I've just read a post on regex that made curios about the following thing:
> > 
> > Suppose I have :
> > $string = 'abc ab abcde abcDef abc 123 ab';
> > 
> > the regex : /([A-Za-z]+)/ returns me ($1) 'abc' which is 3 char long.
> > Imagine now I want that regexp to return me 'abcDef' which is 6 char long.
> 
> Ok -- I imagine that you want the longest substring that matches.
> You need to extract all substrings that match and find the longest. This
> can't be done with a single regexp.

Well, I suppose that depends on what you allow in your regex.  If
experimental features are allowed, then use something like:

$_="abc ab abcde abcDef abc 123 ab";
/(\w+)(?:\W+(\w+)(?(?{ length $+ > length $1 })(?!)))*$/
    and print "$1\n"

I haven't thoroughly tested this, but it seems to behave as I would
expect.  As is, it finds the *first* longest match.  Changing ">" to
">=" switches this to the *last* longest match.

Oh, and I switched to \w from [A-Za-z] out of laziness....  The
important point is that the \W used needs to be the compliment of
whatever the word-pattern is.  So if [A-Za-z] is used, then [^A-Za-z]
would also need to be used.

A quick explanation is that it matches a word followed by any number
of non-word/word pairs, as long as such word is not longer than the
already matched word.  If it is longer, then the pattern fails and
back-tracks all the way back to the first-matched word.  Since there
is no beginning anchor, it ends up skipping that word (though I
believe there is an inefficiency there that could be fixed by adding a
\b at the beginning) and tries the whole thing again with the next
word.  Eventually, the longest word is matched as the first word
matched, and everything else then matches as well.  Anchoring at the
end is required or the match wouldn't be forced to keep retrying.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 16 Jan 2001 18:34:44 GMT
From: GC <glchy@my-deja.com>
Subject: Unicode conversion module wanted.
Message-Id: <942484$3gl$1@nnrp1.deja.com>

Hi,

I need a module to convert a string in any codeset to Unicode.

Ive just installed Text-Iconv-1.1 and am running Perl, version 5.005_03
built for sun4-solaris.

Make process went well without any error message. However it seems that
all conversions are unsupported.

#!/usr/local/bin/perl

use Text::Iconv;
$converter = Text::Iconv->new("iso8859-1", "utf-8");
$converted = $converter->convert("Text to convert");

print "$converted\n";

Output is:
Unsupported conversion: Invalid argument at test.pl line 4.

And even $converter = Text::Iconv->new("iso8859-1", "US-ASCII"); the
output is still the same.

Actually my objective is to convert some string in any code set (e.g
jis) to Unicode. But i dont know what to replace the "tocode" to get
Unicode.

Am i missing some other modules?

Thanks,

G.C.


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 16 Jan 2001 17:02:05 GMT
From: mintcake@my-deja.com
Subject: Re: What's wrong with this (parent fork multiple children)?
Message-Id: <941uq6$tu8$1@nnrp1.deja.com>

In article <c4_86.27209$W82.4113189@typhoon.southeast.rr.com>,
  "David Sisk" <davesisk@ipass.net> wrote:
> I've also tried this:
>
> $ppid = $$;
> for ($i = 1; $i = 2; $i = $i + 1) {
>   if ($ppid == $$) {
>      if (!defined($cpid = fork())) { die "cannot fork: $!" };
>      }
> }

It may not solve your problem but == in the conditional of the for loop
usually works better than =

>
> Here I'm attempting to say "if my process_id is the same as the
original
> process, then fork".  This doesn't seem to work as intended either.
Any
> ideas?
>
> Regards,
> Dave
>
> David Sisk <davesisk@ipass.net> wrote in message
> news:5IZ86.27204$W82.4100088@typhoon.southeast.rr.com...
> > $children = 2;
> > $cpid = -1;
> > for ($i = 1; $i = $children; $i = $i + 1) {
> >   if ($cpid !=0) {
> >      if (!defined($cpid = fork())) { die "cannot fork: $!" };
> >      }
> > }
> >
> >
> > What I want to do is have the parent fork x children (in this case
2).
> > Instead, I get the parent forking children and the children forking
more
> > children (essentially, a forking infinite loop) [pun intended].  I'm
> trying
> > to prevent the children from forking more children with the "if
($cpid
> > !=0)", but that doesn't seem to work.  Can anyone point me in the
right
> > direction?  What am I doing wrong here?
> >
> > Best regards,
> > Dave
> >
> >
> >
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Tue, 16 Jan 2001 17:27:11 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Re: What's wrong with this (parent fork multiple children)?
Message-Id: <Pv%86.27582$W82.4157301@typhoon.southeast.rr.com>

Duh.  Thanks!  That typo was the infinite loop problem!

With that now corrected,  if I comment out part 1, I only get output from
one child and no parent in part 3.  If I comment out part 2, I get output
from one parent and no children in part 3.  I'm still confused about how to
do this, so if anyone has an example (or knows where I can find one), please
post.

# part 1
#$cpid = -1;  #not a good think to do, because the psuedo-process id could
theoretically be -1.
#for ($i = 1; $i == 2; $i = $i + 1) {
#  if ($cpid !=0) {
#     if (!defined($cpid = fork())) { die "cannot fork: $!" };
#     }
#}

# part 2
$ppid = $$;
for ($i = 1; $i == 2; $i = $i + 1) {
  if ($ppid == $$) {
     if (!defined($cpid = fork())) { die "cannot fork: $!" };
     }
}

#part 3
if ($cpid == 0) {
        # fork returned 0, so this branch is the child
        sleep 1;
        exec("echo I'm the child process $$\n");
        # if the exec fails, fall through to the next statement
        die "can't exec echo: $!";
} else {
        print "I'm the parent process $$ waiting\n";
        wait;
        print "I'm the parent process $$ finished waiting\n";
}


<mintcake@my-deja.com> wrote in message news:941uq6$tu8$1@nnrp1.deja.com...
> In article <c4_86.27209$W82.4113189@typhoon.southeast.rr.com>,
>   "David Sisk" <davesisk@ipass.net> wrote:
> > I've also tried this:
> >
> > $ppid = $$;
> > for ($i = 1; $i = 2; $i = $i + 1) {
> >   if ($ppid == $$) {
> >      if (!defined($cpid = fork())) { die "cannot fork: $!" };
> >      }
> > }
>
> It may not solve your problem but == in the conditional of the for loop
> usually works better than =
>
> >
> > Here I'm attempting to say "if my process_id is the same as the
> original
> > process, then fork".  This doesn't seem to work as intended either.
> Any
> > ideas?
> >
> > Regards,
> > Dave
> >
> > David Sisk <davesisk@ipass.net> wrote in message
> > news:5IZ86.27204$W82.4100088@typhoon.southeast.rr.com...
> > > $children = 2;
> > > $cpid = -1;
> > > for ($i = 1; $i = $children; $i = $i + 1) {
> > >   if ($cpid !=0) {
> > >      if (!defined($cpid = fork())) { die "cannot fork: $!" };
> > >      }
> > > }
> > >
> > >
> > > What I want to do is have the parent fork x children (in this case
> 2).
> > > Instead, I get the parent forking children and the children forking
> more
> > > children (essentially, a forking infinite loop) [pun intended].  I'm
> > trying
> > > to prevent the children from forking more children with the "if
> ($cpid
> > > !=0)", but that doesn't seem to work.  Can anyone point me in the
> right
> > > direction?  What am I doing wrong here?
> > >
> > > Best regards,
> > > Dave
> > >
> > >
> > >
> >
> >
>
>
> Sent via Deja.com
> http://www.deja.com/




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 71
*************************************


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