[15588] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3001 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 10 06:10:23 2000

Date: Wed, 10 May 2000 03:10:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957953413-v9-i3001@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 10 May 2000     Volume: 9 Number: 3001

Today's topics:
    Re: Printing Arrays (Abigail)
    Re: Programmer Required <dalekh@my-deja.com>
    Re: Proper use of resources (was Re: more regexp madnes <gellyfish@gellyfish.com>
        Puzzle: DESTROY not destroying geoff_gunner@my-deja.com
    Re: re-initializing through each loop (Abigail)
    Re: re-initializing through each loop (Bart Lateur)
    Re: signal trapper <gellyfish@gellyfish.com>
        sort a two-dimensional array.... <Thomas.Wolfensberger@Siemens.ch>
    Re: Strange Characters from Perl Script (David H. Adler)
    Re: using perl to rsync (Rafael Garcia-Suarez)
    Re: using Perl's RE to do basic manipulation of a flex  (Bart Lateur)
    Re: Why are files required to return true values? (Abigail)
        windos equivalent of fork ??? itsaw@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 10 May 2000 04:47:00 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Printing Arrays
Message-Id: <slrn8hhqe4.i67.abigail@ucan.foad.org>

On Tue, 9 May 2000 10:15:51 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ In article <8f8lag$i4a$1@nnrp1.deja.com> on Tue, 09 May 2000 09:21:30 
++ GMT, Ilja <billy@arnis-bsl.com> says...
++ 
++ ...
++ 
++ > Hm-m, why you need loop to print an array ?
++ > 
++ > $, = "\n";
++ > print @block;
++ 
++ To produce the same output as the other attempts, that should be:
++ 
++   print @block, "\n";

But that prints a newline too many! Use:

     print @block, "";

instead.

++ And $, should be localized.
++ 
++ Yet another way:
++ 
++   { local $" = "\n"; print "@block\n" }

Or even:

     {local $" = "\n"; print qq {@block$"}}


Abigail


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

Date: Wed, 10 May 2000 04:29:41 GMT
From: dkh <dalekh@my-deja.com>
Subject: Re: Programmer Required
Message-Id: <8faoj8$u1s$1@nnrp1.deja.com>



Hi,

I am a freelance Perl programmer interested in your project. My project
experience has come from www.projectperl.com, where I am listed.
Recently, I did a small project(www.precisioncontacts.com) to modify a
form processor, bnbform, adding an additional function to support static
html and parsing some variables in the html. Previously, I did a project
to modify WebBBS. I am most familiar with MySQL and am comfortable using
the DBI module for interfacing the databases. I can devote enough time
in the coming month to make it worth your while.

regards,
dale henderson
dalehend@projectperl.com

In article <39170237.12385480@barbados.cc>,
  Rob@barbados.cc wrote:
> Hi,
> I am in need of a programmer to create and refine a cgi script for a
new
> site project. This project has very good potential with larger
> corporations as its target. I have a base demo almost working (hacking
> on my own)to give you a good idea of what is required before you
start.
> There is a lot of work in this but there is nothing required here that
> cannot and has not already been done with a Perl CGI script. To give
you
> and Idea of the work load I have been quoted $3000.00 to $6000.00 to
> write and customize it, and actually if I just wanted to buy a service
I
> had budgeted over $10,000.00 to get it done fully and right.
> The fact is for this project to do as well as it should or could, it
> requries a programmer as part of the business with a Full Interest it
> having it succeed. This would be so that the program would always be
on
> the go being fine tuned and perfected to keep the site as the ONLY and
> best service of its kind on the internet.
> yada yada yada...this crux here is I need more of a partner in this
than
> a hired gun. Anybody willing to take a risk with their time as their
> part of the investment. Contact me ASAP.
> The Project requires a good knowledge of DBs and their manipulation
and
> it would help if you have an easy going look on life (for working
> together).
>
> Rob Gouriluk
> Rob@Barbados.cc
>
> P.S.  If I do fail to find someone to work with here I will be needing
a
> GOOD hired gun. So if small to mid size Web DB's are your game please
> reply with some sort of E busines card ...as I might be in need of
your
> Services.
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 10 May 2000 06:55:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Proper use of resources (was Re: more regexp madness extracting data from files.)
Message-Id: <8fatkj$hu6$1@orpheus.gellyfish.com>

On 9 May 2000 00:06:23 GMT The WebDragon wrote:
> 
>                   I'd like to add to this script the ability to grab 
> these six .html files containing the data I wish to extract via http, 
> and save them locally, overwriting the previous ones, before running 
> this script on them and generating my output file of the data. (this way 
> I can daily keep my local output file up to date.)
> 
> Which modules do you recommend that would best suit this sort of thing? 
> I'm guessing one of the Net:: or HTTP:: modules? Which wuld you use? and 
> why?
> 

LWP::Simple or LWP::UserAgent depending on your requirements and the
degree of control you want over the process.  Why ?  Because they are
the only modules that do this sort of thing.  the HTTP::* modules are
part of the same distribution and provide the framework for LWP to get
things with an http: protocol scheme.  The module suite comes with a
a very good document of examples 'lwpcook.pod' that should get you 
started.

/J\
-- 
Kill my boss? Do I dare live out the american dream?
-- 
fortune oscar homer


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

Date: Wed, 10 May 2000 09:36:18 GMT
From: geoff_gunner@my-deja.com
Subject: Puzzle: DESTROY not destroying
Message-Id: <8fbaih$hk1$1@nnrp1.deja.com>

A previous posting on this seems to have dissapeared from Deja; here's
a precis and follow-up.

I had a module with a DESTROY method. That method was NOT getting
called when the object was destroyed, even on script shutdown (wierd,
huh?). Adding a dummy object with a DESTROY method showed that other
objects WERE getting destroyed. So what could be causing the DESTROY
method to not get called?

Here's where it gets wierder. I commented out a lot of stuff, added
print statements, all the usual debugging stuff. All of a sudden the
DESTROY started working again. So I uncommented and removed the print
statements. The DESTROY still worked. Huh? Here's what ended up being
changed. Which one was responsible for stopping DESTROY working?

1: a function (&ws_error) was no longer being exported via @EXPORT
2: A hash ref was being set up with {%Hash} rather than \%Hash
3: A factory method stopped keeping a second 'my' reference to the
object
4: Tabbing of comments was altered (grasping at straws here)

I'm alarmed, because none of these had any business sabotaging DESTROY,
especially for the final garbage sweep on script termination. Which
means I now have a potential hole that could reopen at any time.

Can anyone solve this Perl Voodoo for me ? Why did DESTROY start
working again?

Thanks !  Geoff



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 10 May 2000 04:36:31 GMT
From: abigail@foad.org (Abigail)
Subject: Re: re-initializing through each loop
Message-Id: <slrn8hhpqf.i67.abigail@ucan.foad.org>

On Sat, 06 May 2000 21:04:30 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
++ 
++ BTW I don't think that the speed penalty for always declaring the
++ lexical variables inside the loop isn't any reason for not doing it all
++ the time.


What speed penalty? Hopefully you know that my declares the variable
at _compile_ time; not runtime.


Abigail


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

Date: Wed, 10 May 2000 08:10:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: re-initializing through each loop
Message-Id: <391c17f0.2656282@news.skynet.be>

Abigail wrote:

>On Sat, 06 May 2000 21:04:30 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:

>++ BTW I don't think that the speed penalty for always declaring the
>++ lexical variables inside the loop isn't any reason for not doing it all
>++ the time.
>
>
>What speed penalty? Hopefully you know that my declares the variable
>at _compile_ time; not runtime.

I thought about that later, too. I'm still in some doubt.

	for (1 .. 10) {
	    my $i;
	    $i = 'foo';
	}

Now, I expect that the runtime effect of my is to undef the lexical
variable, every time in a loop. Now *that* was the speed penalty I was
thinking of, basically.

I'm not sure if 

	my $i = 'foo';
and
	my $i; $i = 'foo';

do the same thing: in the first case, does the declaration clear the
lexical before assigning the value to it, or not? It does in the second
case.

-- 
	Bart.


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

Date: 9 May 2000 22:11:25 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: signal trapper
Message-Id: <8f9utt$p1c$1@orpheus.gellyfish.com>

On Tue, 9 May 2000 18:41:25 +0100 Andy Chantrill wrote:
> Nope -- the "Sorry, Dave, I can't do that.\n"; message has to be in its own
> sub-routine ... that's mandatory  :o)
> 
> I've been playing around with signal trapping for ages, and I've never been
> able to get it work properly the way I'd like in a modular structure (see my
> example). What I really need is a goto function that can leap out of the
> signal_trapper sub-routine into the status sub-routine ...
> 

Have you seen what it says about goto &subroutine in the manpage ...

/J\
-- 
Aah! Bogeyman! You nail the windows shut, I'll get the gun!
-- 
fortune oscar homer


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

Date: Wed, 10 May 2000 11:03:40 +0200
From: Thomas Wolfensberger <Thomas.Wolfensberger@Siemens.ch>
Subject: sort a two-dimensional array....
Message-Id: <391925EC.840AA07F@Siemens.ch>

I need to sorrt a two-dimensional array. 
How can i do it?

greez!
wolfi...


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

Date: 10 May 2000 05:50:12 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Strange Characters from Perl Script
Message-Id: <slrn8hhu4h.hm2.dha@panix6.panix.com>

On Tue, 9 May 2000 15:57:03 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>I dispute your assertion that this works differently on different 
>operating systems.  It can't work right anywhere.

Ah, but it may work wrong in different ways on different osen... :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Any sufficiently advanced technology is compatible with magic.
	- The Doctor, Seeing I


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

Date: Wed, 10 May 2000 07:10:35 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: using perl to rsync
Message-Id: <slrn8hi30i.k8q.garcia_suarez@r-garcia.kazibao.net>

Brian Luethke wrote in comp.lang.perl.misc:
>hi, i am trying to use rsync to effeciently transfer files inside a perl
>script. When the perl script is running iterativly everyhitng goes fine but
>when i run a threaded version it hangs, this error is either caused by PERL
>or by rsync and i can not determine which one. below is the code, i am using
>perl 5.60. Rsync actually transfers the file but then hangs. temp_501_$ip is
>small, not over 2 or three k. When i run ps -A it has rsync still running
>and ssh( defunct ) in the process list ( same thing if i just use rsh so i
>don't think it is ssh ). when i run netstat it shows the socket having a
>time_wait flag. I have let this sit for a long time and it never finishes. I
>have to go through and manually kill each process. I think i have done
>something wrong in perl as the iterative version works.

If you want simply to run rsync asynchronously, you can try to fork and exec.
If this works, the problem is with the threads. Note that rsync can also be
a source of problems, depending on your configuration and on the version
of rsync you are using. Some versions have bugs. You can also try to remove the
-a option to rsync if you have only one file to transfer; perhaps this will
solve some problems with conceurrent update of directories by concurrent
rsync processes (I don't know -- depends on your config!) You can also try scp
instead of rsync...

My 2 cents...

-- 
Rafael Garcia-Suarez


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

Date: Wed, 10 May 2000 07:43:59 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: using Perl's RE to do basic manipulation of a flex file
Message-Id: <391a10ee.862816@news.skynet.be>

Ron Grabowski wrote:

>I want to change:
>
>[A-Za-z]{DIGIT}      {some_function(); return ALPHA_WITH_DIGIT_TOKEN;}
>{ANOTHER_TOKEN}[0-9] {   blah( )   ;  return   TOKEN2  ;  }
>
>into
>
>[A-Za-z]{DIGIT}      { printf("[ALPHA_WITH_DIGIT_TOKEN] %s",yytext); }
>{ANOTHER_TOKEN}[0-9] { printf("[TOKEN2] %s", yytext); }

I understood that. The problem that I have, and the reason why I didn't
reply before, is with the //s modifier. Apparently you want to allow
multiline code blocks. That implies that you cannot process this data
one line at a time? Ooh...

If you DO process one line at a time, try matching the last "{" instead
of the first, for example by doing /.*\{/, or specifically ask for the
pattern /^\s*\S+\s+\{/ as a start pattern.

I can't seem to fit the modified regex on one line. Imagine these to be
one line. :-)

>$flex_file =~ s#{.*return\s+(\w+).*}#{ printf("[$1] %s", yytext); }#gs;

$flex_file =~ s#(.*)\{.*return\s+(\w+).*\}#$1{ printf("[$2] %s",
yytext); }#g;

$flex_file =~ s#^(\s*\S+\s+)\{.*return\s+(\w+).*\}#$1{ printf("[$2] %s",
yytext); }#gm;

I haven't checked if the //m modifier does wht I hope it does.

   HTH,
   Bart.


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

Date: 10 May 2000 05:07:33 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Why are files required to return true values?
Message-Id: <slrn8hhrkl.i67.abigail@ucan.foad.org>

On Fri, 5 May 2000 21:19:48 -0700, Tom Phoenix <rootbeer@redcat.com> wrote:
++ 
++ Because that's not true. :-)  But if you're feeling playful, here are some
++ alternative values instead of the traditional 1. Some are cooler than
++ others:

I sometimes do:

<<'=cut'

Manual goes here....

=cut

++ Of course, if you're using h2xs to create the skeleton for your module, it
++ takes care of the return value for you. And if you're not using h2xs,
++ you're not being lazy enough.


I only use h2xs if I make something for CPAN. And then I've to do much 
work in figuring out which options to use, and afterwards deleting all
the junk h2xs "helpfully" (not!) inserts for me.

vi Module.pm is many times faster.



Abigail


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

Date: Wed, 10 May 2000 05:59:54 GMT
From: itsaw@my-deja.com
Subject: windos equivalent of fork ???
Message-Id: <8fatsl$3gn$1@nnrp1.deja.com>

is there a fork for windows in perl ??? I am trying to create child
process under windows , i know i can do it under linux using fork but i
am not sure is there for windows .......can anyone help me with this
problem .... thanks in advance


Sent via Deja.com http://www.deja.com/
Before you buy.


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

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 V9 Issue 3001
**************************************


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