[17052] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4464 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 28 21:05:56 2000

Date: Thu, 28 Sep 2000 18:05:08 -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: <970189508-v9-i4464@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 28 Sep 2000     Volume: 9 Number: 4464

Today's topics:
    Re: [IGNORE - OFF TOPIC] Re: Controlling line length re <nospam@david-steuber.com>
    Re: [IGNORE - OFF TOPIC] Re: Controlling line length re <nospam@david-steuber.com>
    Re: accessing global variables in another perl module <ren.maddox@tivoli.com>
    Re: Al Gore's Mother Invented Perl (Logan Shaw)
    Re: animation and annotation for GIF images under perl. (Martien Verbruggen)
        cookies <troyr@vicnet.net.au>
    Re: dereferencing an array from within a hash value (Martien Verbruggen)
    Re: Help with Unix processes. (Urgent!) (Logan Shaw)
    Re: HTTP::Response when client dies <nospam@david-steuber.com>
    Re: need help on a small cgi thank u <mtaylorlrim@my-deja.com>
        OFFTOPIC: Was: Al Gore's Mother Invented Perl <amonotod@netscape.net>
    Re: OFFTOPIC: Was: Al Gore's Mother Invented Perl <uri@sysarch.com>
    Re: OFFTOPIC: Was: Al Gore's Mother Invented Perl (Logan Shaw)
    Re: perl cookies <vioon@hotmil.com>
    Re: perl cookies <vioon@hotmil.com>
    Re: Perl on PWS on Win ME <jim@usjet.net>
    Re: Perl Regex <lr@hpl.hp.com>
    Re: Perl Regex vlad_the_impaler24@my-deja.com
    Re: Q: inverse mirror script (publish) using ftp??? (Logan Shaw)
    Re: Rounding Numbers... (Logan Shaw)
    Re: SIGALRM with NT <elephant@squirrelgroup.com>
        Sorting problem <jengland@enetis.net>
    Re: splitting lines with a regex <jeffp@crusoe.net>
    Re: splitting lines with a regex <godzilla@stomp.stomp.tokyo>
    Re: splitting lines with a regex <jaap@stack.nl>
        syntax:search and replace sujh@my-deja.com
    Re: syntax:search and replace <aqumsieh@hyperchip.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 29 Sep 2000 00:46:28 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: [IGNORE - OFF TOPIC] Re: Controlling line length read by <>
Message-Id: <m3pulo10v3.fsf@solo.david-steuber.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:

' Truth does not need to packaged and sold. Truth is
' self-evident. I have no interest in this type of debate.

Now I am really confused.  I have no idea what you are going on about
now.

' My interest is in using and enjoying this newsgroup,
' peacefully. So far, a majority of regulars here, 
' ranging from nobodys to well known authors, will
' not allow me to use this group peacefully. Inherently
' then, I have a real bad attitude about this newsgroup
' and am extracting my pound of flesh, a gram at a time.

So you attack me, an unknown person with no reputation to speak of.  I
just don't understand this.  I certainly have not attacked you.

' Although much better today due to my firm but fair
' attitude, due to my aggressively assertive attitude,
' there are still serious problems here with some
' sociopathic people.

I see.  You are doing something about the hostility on this group.
May I make a suggestion?  Could you perhaps be less hostile yourself?
That just might make some kind of difference.

' Over time, my family, myself, have been subjected
' to constant harassment, stalking, vulgarity, bigotry,
' racial slurs, attempts at deleting my articles from
' this group, pseudo criminal behavior and outright
' crime to a degree we needed to contact law enforcement
' to assist us in bringing a halt to our being victimized
' by crime perpetrated by regulars here. Are you clear
' on this? We had to contact law enforcement due to crimes
' perpetrated by regulars within this newsgroup. This is
' absolutely idiotic, absolutely beyond belief. Still,
' this is reality.

I have no idea what pseudo criminal behavior is.  I've never heard of
it before.  I do know that *I* have never attacked you in any way,
shape, or form.

' Even as recently as yesterday, a few well known regulars
' attempted break-ins at one of my sites trying to get at
' my android scripts.

You can check my NNTP headers to see which ISP I use.  You will see
that I am not someone who has ever visited your site.  Not ever.

' These types of events only serve to strengthen my bad 
' attitude and, it is highly unlikely my bad attitude
' about people here, will ever change. There are few,
' if any reasons, to not treat a majority of people here
' with contemptuous distain, deserved or not.

Perhaps your best course of action is to remove yourself from a
hostile environment such as clpm.  Just a thought.

' Nevertheless, I am not interested in pointless debates
' on what is true and what is not. I am interested in
' bringing a halt to this abhorrent abuse of which our
' family is subjected, at the hands of people here, all
' of which is well documented within archived articles.

And you expect to accomplish this by attacking me?  Where is the logic
in that?

' So my attitude is everyone here is a sociopath or a
' criminal, or both, until I personally can prove otherwise,
' such as in the case of Mr. Rosler, Mr. Berry and a handful
' of others, who are decent people. This attitude is contrary
' to our American philosophy of innocent until proven guilty.
' However, reality dictates I treat all of you as and, assume
' all of you to be sociopathic criminals until shown otherwise.

Everyone here is a criminal, sociopath or both.  You are here.  What's
the third part of the syllogism?

' Reality is a bitch much like myself.

Reality is neutral.  But I won't dispute any claims you make about
your character here.

' I will not entertain this thread any further.

Thank you.

To the group:  I apologize for quoting so much.  I wanted to be sure
that my replies were kept in the context of the post I was responding
to, and I couldn't see how to cut it down any further.

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


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

Date: Fri, 29 Sep 2000 00:48:04 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: [IGNORE - OFF TOPIC] Re: Controlling line length read by <>
Message-Id: <m3n1gs10sd.fsf@solo.david-steuber.com>

"Nicolas MONNET" <nico@monnet.to> writes:

' Please, please, please ... Could we start a gun-control thread
' instead? Oh wait, even better: an abortion thread.

I think free speach is overrated.  How's that? ;-)

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


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

Date: 28 Sep 2000 17:46:22 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: accessing global variables in another perl module
Message-Id: <m3aecsp22p.fsf@dhcp11-177.support.tivoli.com>

jason iversen <jasoniversen@my-deja.com> writes:

> thanks for your info ren, this actually explains what happening too.
> 
> pity about some of the voodoo magic one has to do with the header-file
> method. not intuitive at all, but good to know how to do it.

One more thing.  You can use package variables from the Main package
as if they were globals by simply always prefixing them with "::".

#!/usr/local/bin/perl -w
use strict;

package Alpha;
$::D = 1;             # this is really $Main::D
our $D = 2;               # this is really $Alpha::D

package Beta;
our $D = 3;               # this is really $Beta::D
print "\$D is $D\n";
print "\$::D is $::D\n";
print "\$Alpha::D is $Alpha::D\n";
print "\$Beta::D is $Beta::D\n";
__END__

Outputs:
$D is 3
$::D is 1
$Alpha::D is 2
$Beta::D is 3

Having these packages in separate files one of which uses the other
(or requires (or do-s)) still works.

HTH,
-- 
Ren Maddox
ren@tivoli.com


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

Date: 28 Sep 2000 19:48:51 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Al Gore's Mother Invented Perl
Message-Id: <8r0otj$n1m$1@provolone.cs.utexas.edu>

In article <970158224.13822.0.nnrp-01.c3ad6973@news.demon.co.uk>,
W Kemp <bill.kemp@wire2.com> wrote:
>Who's Al Gore.
>
>Remember the world doesn't take part in "the world series".

That's O.K.  Many of the registered voters in the U.S. don't take part
either.  (About 51% of them in the last election.)

By the way, we certainly hear enough about British politics and royalty
over here on this side of the pond...

  - Logan


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

Date: Thu, 28 Sep 2000 22:13:05 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: animation and annotation for GIF images under perl.
Message-Id: <slrn8t7gjd.64u.mgjv@verbruggen.comdyn.com.au>

On Thu, 28 Sep 2000 11:13:52 +0700,
	vladimir y. plotnikov <vlad@sas.nsk.su> wrote:
> Hello All!
> 
>  I have problem with subject.
>  I need in script, working under perl and Apache on unix. (linux.freebsd)
>  this script must do next:
>  1.pickup image
>  2.write lot of texts over image with animation (GIF) effects.
>  3.display it under apache.
> 
>  I can find for this only Image::Magick perl libary (PerlMagick) and
>  this one is VERY, VERY slowly on place text phase (I use freetype
>  libary for support ttf files). (about 10-15 secound per animated
>  image with 20 layers) May be anybody know another libary for this,
>  but faster?

For GIF images your only Perl solution is indeed Image::Magick. And
yes, Image::Magick can be slow, but it's also very flexible. Make sure
you have the latest version, because many speed improvements have been
put in place over the last few version. 4.2.9, which is still the
default for many linux distributions, is much slower than 5.2.x for
many things.

If you can get rid of the requirement to use GIF, you could consider
using the GD modules (potentially with the GDTextUtils stuff). That
also uses the freetype libraries, so if most of your time is spent in
font rendering, you won't gain anything. 

Rendering fonts is slow. Working with images is also slow. However, 10
to 20 seconds sounds outrageously slow. None of the stuff I've done
with Image::magick and font rendering took that amount of time. Are
you writing large amounts of text? Are you maybe running out of
memory? 

Maybe you can use mod_perl to get some more performance? I don't even
know how you're running this, as CGI or what? 

>  NB: please, replay by email or crosspost replay to my email address.

Sorry, I don't do that. It encourages continuation of the discussion
by email, and I don't have the time to become someone's personal help
desk [1]

Martien

[1] I am speaking in general here. ot accusing you personally of
anything.
-- 
Martien Verbruggen              | 
Interactive Media Division      | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd.   | no excuse - Lazarus Long
NSW, Australia                  | 


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

Date: Fri, 29 Sep 2000 11:26:19 +1100
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: cookies
Message-Id: <YkRA5.8343$O7.159809@ozemail.com.au>

Hi There...This is prob not the right place to ask this question as its more
browser related but i was hoping someone would know or point me in the right
direction.

I'm using cookies in one of my scripts and it seems to save it on all
browsers except for IE 5.5 (works well with Netscape,Mozilla and IE from
3-5)

Has anyone else encountered this problem?


--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------




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

Date: Thu, 28 Sep 2000 22:26:03 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: dereferencing an array from within a hash value
Message-Id: <slrn8t7hbo.64u.mgjv@verbruggen.comdyn.com.au>

On 28 Sep 2000 12:35:26 +0100,
	nobull@mail.com <nobull@mail.com> wrote:
> "Dave" <dprovac1@twcny.rr.com> writes:
> > 
> > %FIELDS = ('personal information' => ['Name', 'Address', 'Tele', 'Fax']);
> 
> %FIELDS is a special variable - please don't abuse it.

only when the fields pragma is used.

Hardly fair to blame the OP. The documentation is terribly silent on
this:

$ pwd
/opt/perl/lib/5.6.0/pod
$ grep FIELDS *
perl5005delta.pod:the %FIELDS hash in the type package at compile
	time.  The %FIELDS hash
perldiag.pod:the %FIELDS hash in the type package at compile time.
	The %FIELDS hash
perltodo.pod:C<magic_setisa> should be made to update %FIELDS [???]
perltoot.pod:   our %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ]);

[output wrapped for display]

Note the absence of this variable in the perlvar man page.

You have to _know_ that the fields pragma uses this, or you have to
run into the error message in perldiag (and how often do you sort of
read through that without needing to look something up?), to even be
aware of its existence. And when you read the fields man page, it even
states that the use of this variable is potentially temporary.

Abigail remarked a few days ago that perldiag maybe should contain the
error messages of a set of standard modules and pragmas. Maybe perlvar
should also mention the names these pragmas and modules reserve.

I am not saying you shouldn't warn about this, but in the case of
something as vague as this, you should probably have provided a
reference to the manual page that describes it.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: 28 Sep 2000 19:42:48 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Help with Unix processes. (Urgent!)
Message-Id: <8r0oi8$mv2$1@provolone.cs.utexas.edu>

In article <39D3663A.C3CD1614@ccc.uni-erlangen.de>,
Torsten Schindler  <Torsten.Schindler@ccc.uni-erlangen.de> wrote:
>Any suggestions to improve my simple OO version I have attached?
  :
  :
># Initialize array with workunits
>my @work_units;
>foreach my $mol (@molecule) {
>   # Build up my command line
>   my $calc = $vamprun.$flags.$mol.' >/dev/null 2>&1 ';
>   # 
>   push(@work_units,new Workunit(\$calc)); # The Workunit needs a function or a ref to
>}                                          # a SCALAR
>
># Create a work processor
>my $processor = new Workprocessor($njobs,\@work_units);
>
># And process the work
>$processor->start;

Just one suggestion:  from an OO design point of view, it'd probably be
better to have your Workprocessor object accept jobs, rathern than
handing it an array.  That would look more like this:

	my $processor = new Workprocessor ($njobs);

	foreach my $mol (@molecule)
		{
		my $command = $vamprun.$flag.$mol." >/dev/null 2>&1';

		$processor->add_work (new Workunit ($command));
		}

	$processor->start;

Another thing an OO design would probably include is Workunit as a base
class, then several subclasses that actually implement it.  So, you
might have a Workunit::UnixCommand (which would do what yours does), a
Workunit::PerlFunction (which calls a series of Perl functions), and
possibly other things.  These classes would all have similar if not
identical interfaces, so that you could put several Unix commands in
the work queue along with some Perl functions and the Workprocessor
would do blindly and happily just call start() on each one.

This last idea is probably not necessary for your immediate purposes,
but it's a good way to build expandability into your script in case you
should later decide to handle the work units differently or add another
type of them.

  - Logan


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

Date: Fri, 29 Sep 2000 00:06:48 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: HTTP::Response when client dies
Message-Id: <m3vgvg12p5.fsf@solo.david-steuber.com>

"John Wollner" <jwollner@earthlink.net> writes:

' What I need to know is whether there is a way to check that the client is
' still out there or to set a timeout on the send_response method so if the
' connection is dead, we don't hang.

If a connected() method is not available on the client connecion
object, try select().

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


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

Date: Thu, 28 Sep 2000 22:46:23 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: need help on a small cgi thank u
Message-Id: <8r0hnu$t62$1@nnrp1.deja.com>

In article <8r0chn$ojp$1@nnrp1.deja.com>,
  sendkeys@my-deja.com wrote:
> hi all here is the cgi im using
>
> #!/usr/bin/perl
<snip>
> print "</ul></body></html>";
>
> just a basic upload file cgi  it all works but my main problem is i
> can't delete the files after i make them. when i try i get a
Permission
> denied. and when i try to set to files to 777 i get a "Permission
> denied" so im guessing the script hasnt stopped running but i have no
> way to tell.if the script is running is there some why of telling? its
> on a unix server and i can use telnet. any help would be great thank
> you very much.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Quite probably the reason you are getting the Permission Denied error
is because you do not own the file.

When the script creates the file via the upload it is probably setting
the owner to the user that Apache is running as. Probably "nobody",
therefore, as part of your script, following the upload you will have
to chmod the file to 775 or chown the file to yourself.

You can check this simply by doing an ls -l on the command line, or
even using ws_ftp and looking at the Dir Info.

Just a thought...

Mark


--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


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


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

Date: Thu, 28 Sep 2000 22:40:16 GMT
From: amonotod <amonotod@netscape.net>
Subject: OFFTOPIC: Was: Al Gore's Mother Invented Perl
Message-Id: <8r0hcf$t15$1@nnrp1.deja.com>

<way off-topic>

In article <970158224.13822.0.nnrp-01.c3ad6973@news.demon.co.uk>,
  "W Kemp" <bill.kemp@wire2.com> wrote:
>
> Who's Al Gore.
Is that a serious question?

>
> Remember the world doesn't take part in "the world series".
Okay, I guess it was... Al Gore is the erstwhile Vice President of the
United States.  He has made a lot of rather loony comments about the
Internet, and has taken a lot of (deserved) media heat for them.

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


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


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

Date: Fri, 29 Sep 2000 00:20:17 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: OFFTOPIC: Was: Al Gore's Mother Invented Perl
Message-Id: <x7g0mk6oce.fsf@home.sysarch.com>

>>>>> "a" == amonotod  <amonotod@netscape.net> writes:

  a> Okay, I guess it was... Al Gore is the erstwhile Vice President of the
  a> United States.  He has made a lot of rather loony comments about the
  a> Internet, and has taken a lot of (deserved) media heat for them.

actually he was very misquoted but what else is new in the media. he was
trying to point out the work he did in converting the net from a NSF
(gus government) funded thing to a privatized one. he worked on that
legislation but it came out like he invented the internet. oh, well,
once that version came out it became gospel.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 28 Sep 2000 19:45:54 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: OFFTOPIC: Was: Al Gore's Mother Invented Perl
Message-Id: <8r0oo2$n05$1@provolone.cs.utexas.edu>

In article <x7g0mk6oce.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>actually he was very misquoted but what else is new in the media. he was
>trying to point out the work he did in converting the net from a NSF
>(gus government) funded thing to a privatized one. he worked on that
>legislation but it came out like he invented the internet. oh, well,
>once that version came out it became gospel.

I saw him (on T.V. -- where else do people in US get their political
information?) say he should have phrased things differently when he
said what he said on that subject.  In other words, he essentially
admitted that the way he phrased it, it did sound like he was claiming
he had invented the Internet.  (At least he admitted it...)

  - Logan


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

Date: Fri, 29 Sep 2000 01:02:18 +0200
From: "qwerty" <vioon@hotmil.com>
Subject: Re: perl cookies
Message-Id: <8r0ine$bjn$2@weber.a2000.nl>



I have run into a simular problem as well.
Problem is IE handles dates different than netscape.
09-28-00 works fine in netscape but IE requires
09-28-2000



"Troy Rasiah" <troyr@vicnet.net.au> wrote in message
news:xqwA5.7406$O7.142055@ozemail.com.au...
> Hi there,
>                 When i try to reset a cookies expire in IE it doesn't
> reset..compared to when i do it in Netscape
>
> For example...
>     my $cookie_expire='+1s' ;
>     $cookie = $query->cookie(-name=>'OPENRD',
>                          -value=>$session{_session_id},
>                          -expires=>$cookie_expire,
>                          -path=>'/',
>                          -domain=>$cookie_domain);
>
> print $query->header(-cookie=>$cookie);
>
> If the cookie was set to 10 minutes then it will expire after 10 minutes
> using IE.
> With Netscape it resets the cookie expire to 1s
>
> Anyone have any idea's?
>
> Cheers
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
>
>






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

Date: Fri, 29 Sep 2000 00:56:58 +0200
From: "qwerty" <vioon@hotmil.com>
Subject: Re: perl cookies
Message-Id: <8r0ind$bjn$1@weber.a2000.nl>



I have run into a simular problem as well.
Problem is IE handles dates different than netscape.
09-28-00 works fine in netscape but IE requires
09-28-2000



"Troy Rasiah" <troyr@vicnet.net.au> wrote in message
news:xqwA5.7406$O7.142055@ozemail.com.au...
> Hi there,
>                 When i try to reset a cookies expire in IE it doesn't
> reset..compared to when i do it in Netscape
>
> For example...
>     my $cookie_expire='+1s' ;
>     $cookie = $query->cookie(-name=>'OPENRD',
>                          -value=>$session{_session_id},
>                          -expires=>$cookie_expire,
>                          -path=>'/',
>                          -domain=>$cookie_domain);
>
> print $query->header(-cookie=>$cookie);
>
> If the cookie was set to 10 minutes then it will expire after 10 minutes
> using IE.
> With Netscape it resets the cookie expire to 1s
>
> Anyone have any idea's?
>
> Cheers
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
>
>




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

Date: Thu, 28 Sep 2000 17:43:52 -0500
From: Jim Gaasedelen <jim@usjet.net>
Subject: Re: Perl on PWS on Win ME
Message-Id: <39D3C9A8.A6F37DE3@usjet.net>

brian d foy wrote:
> 
> In article <39D39E16.7A7B9935@usjet.net>, Jim Gaasedelen
> <jim@usjet.net> wrote:
> 
> > If this is your personal computer and security is not a problem, then
> > open up
> > read, write, execute privileges on all the relevant directories
> 
> security is always a problem no matter if its your personal
> computer or not.  there is no sense in doing it wrong on
> purpose.

You can't seem to get it through your head, can you? Security is NOT
always a
problem for everyone. I know. It is NOT a problem for me!!! Just what
dire 
consequences do you expect to temporarily open up some permissions for
diagnostic
purposes.

> 
> --
> brian d foy
> Perl Mongers <URL:http://www.perl.org>
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Thu, 28 Sep 2000 15:01:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Perl Regex
Message-Id: <MPG.143d5f7c7136b9ef98add9@nntp.hpl.hp.com>

In article <8r05bi$hs5$1@nnrp1.deja.com> on Thu, 28 Sep 2000 19:15:06 
GMT, vlad_the_impaler24@my-deja.com <vlad_the_impaler24@my-deja.com> 
says...
> Here is my problem, I am working on parsing a logfile, and the logfile
> ouputs lines that have numbers like
> 1 2 3
> 
> I would like to take that and put \ in between the numbers so it ends
> up being \1\2\3\, the numbers are always different, I would guess I
> have to use Regex, but I am very new to it, does anyone know off the
> top of their heads how to do this?

How does '\1\2\3\' agree with 'put \ in between the numbers'?

Here is a very general expression that extracts all number sequences 
from a line (assumed to be in $_), no matter what they are separated by, 
then puts backslashes around them:

    join '\\' => "", /\d+/g, ""

or

    join '\\' => "", split(/\D+/), ""

Doing it all in a regex:

    s/^|\D+|$/\\/g

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 29 Sep 2000 00:12:55 GMT
From: vlad_the_impaler24@my-deja.com
Subject: Re: Perl Regex
Message-Id: <8r0mq3$1bh$1@nnrp1.deja.com>

In article <8r05bi$hs5$1@nnrp1.deja.com>,
  vlad_the_impaler24@my-deja.com wrote:
> Here is my problem, I am working on parsing a logfile, and the logfile
> ouputs lines that have numbers like
> 1 2 3
>
> I would like to take that and put \ in between the numbers so it ends
> up being \1\2\3\, the numbers are always different, I would guess I
> have to use Regex, but I am very new to it, does anyone know off the
> top of their heads how to do this?
>
> Thanks
> Vlad
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Thanks for your help, but I think I got it worked out, I bought a book
on regex :), For anyone who cares it is:
$_ =~ s/([0-9]*) ([0-9]*) ([0-9]*)/\\$1\\$2\\$3\\/;

Vlad


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


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

Date: 28 Sep 2000 18:05:19 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Q: inverse mirror script (publish) using ftp???
Message-Id: <8r0irf$krj$1@provolone.cs.utexas.edu>

In article <8r0a9p$clf$1@sunburst.ccs.yorku.ca>,
Michael Friendly <friendly@hotspur.psych.yorku.ca> wrote:
>I have a number of web sites I maintain from my local machine
>using nsf mounts to the target real hosts.  I wrote a perl script
>to compare directories/files here vs. there, and update any file
>on the real host which had changed on my machine.  Because the 
>remote host was mounted on my local file system, the script used
>the standard unix/perl tools to
>- make directories on the remote (mkdir)
>- check filestamps
>- compare file content s (cmp)
>- copy newer files (cp)
>
>The script is run nightly by cron, so I never had to worry...
>
>Until now... that I will no longer be able to nsf mount the remote
>hosts.

So rdist, rcp, tar/rsh, cpio/rsh, scp, and rsync are all not options?

Although FTP works, it's really not the most efficient way to transfer
files since a separate TCP stream has to be started for each file that
differs.

  - Logan


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

Date: 28 Sep 2000 19:51:03 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Rounding Numbers...
Message-Id: <8r0p1n$n2k$1@provolone.cs.utexas.edu>

In article <36u6tss5tkosbfnu0hho5ctk0s767pkbj4@4ax.com>,
Lou Moran  <lmoran@wtsg.com> wrote:
>--I have looked in perldoc, but I'm not very god at it yet... viva la
>html in activestate... anylou...
>
>--I don't want any rounding on numbers.  even if the number is
>9.999999 I want it to be 9, not 10.

What if it's -9.999999?  Do you then want it to be -10 or -9?
Depending on your answer, you should either use int() or
POSIX::floor().

  - Logan


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

Date: Fri, 29 Sep 2000 11:55:30 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: SIGALRM with NT
Message-Id: <MPG.143ea1a1260274c9897dd@localhost>

stilgar_too@my-deja.com wrote ..
>In article <MPG.143d3396997828ee9897d0@localhost>,
>  jason <elephant@squirrelgroup.com> wrote:
>
>> go and read the documentation .. then you'll see the unsupported
>> functions - and where applicable - the workarounds for getting
>> similar functionality
>>
>> assuming you're using the standard ActiveState Perl the documentation
>> has been converted to lovely HTML and there's a shortcut to it on
>> your Programs menu
>>
>> --
>>   jason -- elephant@squirrelgroup.com --
>>
>
>I'd also like to know the answer to this.  I've been looking through
>the perl docs on the activestate site for about 45 minutes now and
>still haven't found the workarounds.  Can you be more specific please?
>This is the closest "answer" I could find...(from the FAQ)
>
>   Why doesn't signal handling work on Windows?
>   Signals are unsupported by the Win32 API. The C Runtime provides
>   crude support for signals, but there are serious caveats, such as
>   inability to die() or exit() from a signal handler. Perl itself does
>   not guarantee that signal handlers will not interrupt critical
>   operations such as memory allocation, which means signal invocation
>   may throw perl internals into disarray. For these reasons, signals
>   are unsupported at this time.
>
>I don't consider avoiding signal traping a workaround :)

hence my use of the carefully worded caveat "where applicable" .. there 
are some things that there is just no way of doing in Perl on Win32 .. 
ActiveState and (dare I say it) Microsoft are apparently working to 
resolve these holes - but for the moment there are still some holes

BUT .. all that having been said - it wasn't really the lack of reliable 
support for signalling that I was talking about .. a far larger problem 
for the originator awaits in the list of unsupported functions (which 
was actually what I said in my original)

in the standard HTML documentation - the first entry in the first 
section of the Quirks document (ActivePerl-Winfaq5.html) provides a 
gloomy outlook

the workarounds that I was talking about (where applicable) are in the 
perlport section of the documentation (referred to in the above Quirks 
document) .. but they're workarounds to "unsupported functions" - as I 
said originally .. not workarounds to unsupported features

HTH

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 28 Sep 2000 16:09:05 -0600
From: Justin England <jengland@enetis.net>
Subject: Sorting problem
Message-Id: <Pine.SUN.4.05.10009281530180.15764-100000@mail.enetis.net>

I have a database table such as the following:
year	int,
month	int,
day	int,
foo	int,
bar	int

I am doing a simple read of that data and adding up all the totals for each
month, then print the data:

use DBI;
use strict;

# open database
 
my $dbh = DBI->connect("FOO:stuff:etc") || die
        "Unable to open database:\n $DBI::errstr\n";

printdata();

sub printdata {

   my %data;
   my @sum;
   my($year, $month);

   my $cmd = "select * from fooTable";
   my $sth = $dbh->prepare($cmd);
   my $rv  = $sth->execute;

   while(@sum = $sth->fetchrow_array) {
	$data{$sum[0]}{$sum[1]}{foo} += $sum[3];
	$data{$sum[0]}{$sum[1]}{bar} += $sum[4];
   }

   foreach $year ( sort { $data{$::a} <=> $data{$::b} } keys(%data) ) {
	foreach $month ( sort { $data{$year}{$::b} <=> $data{$year}{$::a} }
		keys(%{$data{$year}})) {
		
		print "$year $month $data{$year}{$month}{foo}\n";
		print "$year $month $data{$year}{$month}{bar}\n\n";
	}
   }

}

It does not sort correctly, and gives output similar (it changes
sometimes) to the following:

2000 4 576012
2000 4 109034
 
2000 3 340696
2000 3 59239
 
2000 8 238906
2000 8 37899
 
2000 7 430945
2000 7 76427
 
2000 6 660393
2000 6 126300
 
2000 5 698447
2000 5 138822

Can anybody tell me what I am doing wrong?????

Thanks.

Justin England				jengland@enetis.net
Network Administrator			
E-Net Information Services		http://www.enetis.net
Tel: 605-341-3638			Fax: 605-341-8880




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

Date: Thu, 28 Sep 2000 19:08:03 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: splitting lines with a regex
Message-Id: <Pine.GSO.4.21.0009281859480.5957-100000@crusoe.crusoe.net>

On Sep 28, Godzilla! said:

>> If this does not produce the proper output, oops on me.

>A reader is left with a task of figuring out what your
>Perl 5 Egyptian Hierogylphics mean and do.  A reader
>is also left with trying to figure out my second good
>reason; your script produces zero output. It does not
>work. I would say these are both rather valid reasons.

Formats existed in Perl LONG before Perl 5.  They're not hieroglyphics
any more than $ and @ and % are.  If you take the time to learn Perl,
you'll understand them.  And formats are well-documented in the 'perlform'
section of the standard docs, and they should be explained in good Perl
tutorials and references.  

As for no output, I mis-wrote.  The program, to the best of my knowledge,
places a properly formatted string into $newstr.  It produces the proper
result, and displaying the output is up to the person to figure out.

>I am here to help others learn. You, like all Perl 5
>Cargo Cultists, are here to masturbate your ego with
>selfish disregard for the principle of newsgroups;
>helping each other through sharing of knowledge.

I'm introducing the topic of formats, which are an INTEGRAL part of a
language that was orginally developed for practical extraction and
REPORTING of data.  Formats offer very nicely styled reportation of data.

>You have made a stereotypical Perl 5 Cargo Cultist
>assumption; all readers use a command line screen.

I did not state that my code is a stand-alone program, nor is it logical
to expect people to test Perl programs through a web browser.  If a person
does not know enough to print a variable, or print an HTTP header if
needed, the person should spend more time learning the basics of
programming, not the basics of Perl.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Thu, 28 Sep 2000 17:07:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: splitting lines with a regex
Message-Id: <39D3DD40.B9283108@stomp.stomp.tokyo>

Jeff Pinyan wrote:
 
> Godzilla! wrote:
 
> >> If this does not produce the proper output, oops on me.
 
> >A reader is left with a task of figuring out what your
> >Perl 5 Egyptian Hierogylphics mean and do.  A reader
> >is also left with trying to figure out my second good
> >reason; your script produces zero output. It does not
> >work. I would say these are both rather valid reasons.

 
> Formats existed in Perl LONG before Perl 5.  They're not hieroglyphics
> any more than $ and @ and % are.  If you take the time to learn Perl,
> you'll understand them.  And formats are well-documented in the 'perlform'
> section of the standard docs, and they should be explained in good Perl
> tutorials and references.

Oh. I get it. Post gibberish code and have the reader
spends hours, perhaps days, trying to figure it out,
if this can be done, figuring it out this is.

Logical.

 
> As for no output, I mis-wrote.  The program, to the best of my knowledge,
> places a properly formatted string into $newstr.  It produces the proper
> result, and displaying the output is up to the person to figure out.

Really and truly? Have you tested your code? Usually
a good practice to test code before posting. I always
do and, even after exhaustive testing, sometimes my
code is still buggy. Have you tested your code?

*laughs*

 
> >I am here to help others learn. You, like all Perl 5
> >Cargo Cultists, are here to masturbate your ego with
> >selfish disregard for the principle of newsgroups;
> >helping each other through sharing of knowledge.

 
> I'm introducing the topic of formats, which are an INTEGRAL part of a
> language that was orginally developed for practical extraction and
> REPORTING of data.  Formats offer very nicely styled reportation of data.

I read no introduction. I read a few personal insults
followed by a lot of techno-geekster gibberish. Why
are you so motivated to initiate your articles with
personal insults? Personality problem? Sociopath?

 
> >You have made a stereotypical Perl 5 Cargo Cultist
> >assumption; all readers use a command line screen.
 
> I did not state that my code is a stand-alone program, nor is it logical
> to expect people to test Perl programs through a web browser.  If a person
> does not know enough to print a variable, or print an HTTP header if
> needed, the person should spend more time learning the basics of
> programming, not the basics of Perl.

Yeah, and programmers should test their
code before proclaiming it a masterpiece.

My presumption is you either don't know how 
to write programs or couldn't be bothered
with helping someone by offering a program
which is a stand alone, as a courtesy. You
know, like anyone who doesn't have a command
line screen, is a blithering idiot. Why bother
with such idiots, huh?

Gosh, you are a rather sociopathic rude dude.

Teenager right? 

I understand. Older people are such dolts.
We just don't know-it-all like teenagers.
 

Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Thu, 28 Sep 2000 18:49:45 GMT
From: "Jaap" <jaap@stack.nl>
Subject: Re: splitting lines with a regex
Message-Id: <dpMA5.15409$Sb1.237580@nlnews00.chello.com>

You might want to get rid of all the carriage returns and linefeeds and the
split it up after 60 characters.

Teun




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

Date: Thu, 28 Sep 2000 22:20:45 GMT
From: sujh@my-deja.com
Subject: syntax:search and replace
Message-Id: <8r0g7l$s1t$1@nnrp1.deja.com>

I need to search "production/xml" and replace it
with "xmlbuild/production/xml". but I'm getting syntax error at the
substitute command line probably because of the wrongly placed escape.
I'd appreciate it if someone could fix the line.

open(targetfile, "myfile") or die "$!";
while($targetline=<targetfile>)
{
 $targetline =~ s/production//xml/xmlbuild//production//xml/;
 print "$targetline";
}
close(targetfile);


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


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

Date: Thu, 28 Sep 2000 22:35:26 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: syntax:search and replace
Message-Id: <7ar96487rj.fsf@merlin.hyperchip.com>


sujh@my-deja.com writes:

> I need to search "production/xml" and replace it
> with "xmlbuild/production/xml". but I'm getting syntax error at the
> substitute command line probably because of the wrongly placed escape.

The escape character is a backslash \ not a forward slash.

> I'd appreciate it if someone could fix the line.
> 
> open(targetfile, "myfile") or die "$!";
> while($targetline=<targetfile>)
> {
>  $targetline =~ s/production//xml/xmlbuild//production//xml/;
                              ^             ^           ^
                              ^             ^           ^
                              ^             ^           ^

--Ala


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

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


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