[12475] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6075 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 21 10:25:36 1999

Date: Mon, 21 Jun 99 07:00:23 -0700
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, 21 Jun 1999     Volume: 8 Number: 6075

Today's topics:
    Re: Afraid to ask about Y2K! (Chris Nandor)
    Re: ANN: Grabbing daily cartoons <sb@sdm.de>
    Re: can you split a word into letters? (Abigail)
    Re: cgi query error (Abigail)
    Re: Cure for document deficiency (Hakan Hjelmstrom)
    Re: Examples on using DBM for extracting user/fulename  (Abigail)
    Re: How to forward-declare a file handle? (Guenther Brunthaler)
    Re: how to test pl scripts.? <office@asc.nl>
    Re: Interpreting MS-ASCII - anyone have a filter? <matt.sergeant@ericsson.com>
    Re: Interpreting MS-ASCII - anyone have a filter? (Kenny McCormack)
        linux passwords <me@wavy.org>
        Matching regular expressions <bjoern.teegen@gmx.de>
    Re: mod_perl require problem <mark_cowlishaw@my-deja.com>
    Re: multiple spaces and commas <office@asc.nl>
    Re: multiple spaces and commas <Allan@due.net>
    Re: multiple spaces and commas <bjoern.teegen@gmx.de>
    Re: multiple spaces and commas <jcant@incert.com>
    Re: multiple spaces and commas (Larry Rosler)
    Re: Need help with CGI/Perl - Repost for easy viewing <uri@sysarch.com>
        Need pointer to Regular Expression or Boolean search pa <jcant@incert.com>
    Re: newbie - NT <jwilson@ic.ac.uk>
        Newbie: hashes to HTML table <yogeshhk@gsslco.com>
    Re: Newbie: hashes to HTML table <gellyfish@gellyfish.com>
    Re: Perl scripts slows down servers? <matt.sergeant@ericsson.com>
    Re: Problems with MacPerl and modules (Chris Nandor)
    Re: Search script performance (Eric Bohlman)
    Re: Server Running Perl - Resources? (Abigail)
    Re: Server Running Perl - Resources? <gellyfish@gellyfish.com>
    Re: Signature removal regex? (J. Moreno)
        Temporary file (Arnaud Limbourg)
        When is Sybperl a good choice <mboertien@my-deja.com>
    Re: Writing RTF with Perl <camerond@mail.uca.edu>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 21 Jun 1999 11:57:08 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <pudge-2106990757110001@192.168.0.77>

In article <B391D5189668601FBB@204.112.166.88>, rlb@intrinsix.ca (Lee) wrote:

# In article <pudge-1906992056320001@192.168.0.77>,
# pudge@pobox.com (Chris Nandor) wrote:
# 
# >Here, I'll do it for you.
# 
# Thanks, but I already have one. And yours didn't satisfy all of the specs.
# :)

Oops, forgot days of the week.  Well, it is an exercise left to the reader.  :)

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 21 Jun 1999 12:53:19 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: ANN: Grabbing daily cartoons
Message-Id: <7klcjv$mpj$2@solti3.sdm.de>

In comp.lang.perl.misc Steffen Beyer <sb@sdm.de> wrote:

I made many improvements in the meantime...
Now also supports Peanuts cartoons and has an overview page.
Navigation is also much smoother now.

> I made a nice little set of Perl scripts for downloading daily cartoons
> (e.g. Dilbert, UserFriendly and Calvin&Hobbes), maintaining an archive
> (sorted by date) of them and viewing the images via a CGI script.

> The grabber scripts can be started as cron jobs (see the "crontab" file
> in the distribution for an example on how to do this).

> Note that the software runs only under Unix, and the grabber scripts
> rely on "lynx" for the actual downloading. Moreover, the scripts rely
> heavily on the Date::Calc module.

> This scripts suite can be downloaded from the following URL:

>     http://www.engelschall.com/u/sb/scripts/cartoons.tools.tar.gz

> (This file is only 5762 bytes long.)

I hope you will find these scripts useful!

Best regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: 20 Jun 1999 23:21:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: can you split a word into letters?
Message-Id: <slrn7mrfec.k1b.abigail@alexandra.delanet.com>

Weborium (weborium@aol.com) wrote on MMCXX September MCMXCIII in
<URL:news:19990620225849.01980.00001937@ng-cc1.aol.com>:
;; 
;; Since a single word doesn't have any delimiter, is there a way to split it up
;; into letters, or pull out a single letter?
;; I'm trying to take the first letter off a word and store it in a variable.


sub pohc (@) {
    my $r;
    foreach my $s (@_  ?
                   @_  :
                   $_) {
        $s = reverse $s;
        $r = chop    $s;
        $s = reverse $s;
    }
    $r;
}


my $your_word    = "foobar";
my $first_letter = pohc $your_word;



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Jun 1999 23:22:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi query error
Message-Id: <slrn7mrffk.k1b.abigail@alexandra.delanet.com>

Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote on MMCXX September
MCMXCIII in <URL:news:1dtpx8d.joved31sp1scgN@p7.tc8.metro.ma.tiac.com>:
@@ Jonathan Stowe <gellyfish@gellyfish.com> wrote:
@@ 
@@ > What didnt you understand about :
@@ > 
@@ > 
@@ >        Can't call method """"%s"""" without a package or object
@@ >            reference
@@ 
@@ I don't understand why there are so many quotes!


Maybe it's a piece of Python code?



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 13:26:42 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: Cure for document deficiency
Message-Id: <376e3c91.45173686@news.algonet.se>

On Sun, 20 Jun 1999 16:13:59 -0500, rlb@intrinsix.ca (Lee) wrote:
> I've been loathe to admit this, but I find on-screen documentation very
> hard to follow. You just can't beat a properly typeset and bound book, 
> so long as it has a good index.

To a certain extent. The screen tends to get very cluttered. Maybe
when we can all get 4000x3000 resolutions on our wallmounted
flatscreens and have the same physical area to work on as a proper
desk :-) 

But really, onscreen docs are the way to go. It's a bit hard to
freetext search a book...

> (unfortunately, proper indexing is a near-dead art)

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: 20 Jun 1999 23:25:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Examples on using DBM for extracting user/fulename from passwd file
Message-Id: <slrn7mrfmb.k1b.abigail@alexandra.delanet.com>

Mark Worsdall (linux@worsdall.demon.co.uk) wrote on MMCXIX September
MCMXCIII in <URL:news:uORClEA0fWb3Ew5G@worsdall.demon.co.uk>:
"" 
"" Has anyone got an example, say, of extracting data from the password
"" file on UNIX boxes (FBSD) to gain user ID and full name details etc...


And the various get* function didn't work because.... ?




Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 21 Jun 1999 12:03:30 GMT
From: gb@evis.co.at (Guenther Brunthaler)
Subject: Re: How to forward-declare a file handle?
Message-Id: <376e2aeb.279812605@news.teleweb.at>

Ignore request - problem solved!

On Mon, 21 Jun 1999 09:16:20 GMT, gb@evis.co.at (Guenther Brunthaler)
wrote:

>...
>But PERL seems to complain about "*xx{FILEHANDLE}", because it does
>not yet know that xx is a file handle at that point.

In fact this was NOT the error.

BTW, file handles need not be forward declared, even the following
works:

 ...
&openme(*OUT{FILEHANDLE}, "cool");
print OUT "my message";
close OUT;
 ...

sub openme {
 my($filehandle, $name)= @_;
 open $filehandle, $name or die;
}


mit freundlichen Gruessen

Guenther Brunthaler
Software Development

EVIS Technologies GmbH
Paniglgasse 19
A - 1040 Wien
Tel: +43 (1) 503 73 53
Fax: +43 (1) 503 22 50
WWW: http://www.evis.co.at


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

Date: Mon, 21 Jun 1999 13:46:45 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: Re: how to test pl scripts.?
Message-Id: <7kl8qj$qsu$1@zonnetje.NL.net>

>I am actually coming up with a mailer program using perl and looking for
>help in using this Perl. I would like to test it out by uploading onto a
>site. Is it possible to test it in a "testing" site .? Or are there any
>of such sites available.? And also, do i have to put my perl scripts
>under the bin/perl directory.?


i usually test scripts by running them locally

i have activeperl 5.005_2 installed (downloadable from www.activestate.com)

i have my scripts in c:\scripts

i go there and issue these commands

perl -c -w script.pl

this tests the syntax and typo's

then i just run it. as i make cgi programs the output is (almost all the
time) html , so i do this

perl script.pl > test.html

then i just doubleclick on that html file to see it's output

btw. you might want to remove the first 2 lines from that file (content-type
& other headers you may use)

cul8r
--
Bastiaan v/d Berg ; aka buZz
Internet Specialist
Account Software Consultancy
-[ http://www.asc.nl/ ]-[ office@asc.nl ]-
-[ http://huizen.ddsw.nl/bewoners/buzz/ ]-[ buzz@ddsw.nl ]-




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

Date: Mon, 21 Jun 1999 12:35:08 +0100
From: Matt Sergeant <matt.sergeant@ericsson.com>
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <376E236C.29ADC998@ericsson.com>

Abigail wrote:
> 
>      s/([\x80-\x9F])/exits $t{$1} && $t{$1}/eg;
> 
> would be more efficient.

Especially if accompanied by:

sub exits {
	exit(0);
}

;-)

Matt.


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

Date: 21 Jun 1999 08:27:41 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <7klekd$i1e$1@yin.interaccess.com>

In article <MPG.11d73890a9208038989c0a@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn7mqgou.k1b.abigail@alexandra.delanet.com> on 20 Jun 1999 
>14:38:11 -0500, Abigail <abigail@delanet.com> says...
>...
>> s/([\x80-\x9F])/$t{$1} || ""/eg;  # Replace all characters in the range
>>                                   # 0x80 - 0x9F with their translation,
>>                                   # squish it if there's no translation.

Maybe I missed a post or two (I am reading this in comp.lang.awk -
maybe Abigail posted only to comp.lang.perl.misc?), but the point is
not "How to write a program to do the translations".  Anybody can
write such a program; it is trivial.

The real point of my post is: What *are* the translations?
There is probably a document at microsoft.com that explains their
weird creation and tells what each funny characters means.  I was
hoping that someone somewhere had already done that work.


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

Date: Mon, 21 Jun 1999 14:13:21 +0100
From: David Stringer <me@wavy.org>
Subject: linux passwords
Message-Id: <LWG$YKAxpjb3Ews1@wavy.org>

Hi,

  I would like to change Linux user passwords in a Perl script, what
would be the easiest way of doing this?

Cheers
-- 
David Stringer


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

Date: Mon, 21 Jun 1999 15:14:26 +0200
From: =?iso-8859-1?Q?Bj=F6rn?= Teegen <bjoern.teegen@gmx.de>
Subject: Matching regular expressions
Message-Id: <376E3AB1.DC7A1EC4@gmx.de>

Does anyone know the algortihm(s) that perl uses for matching regular
expressions?

Bjvrn



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

Date: Mon, 21 Jun 1999 10:34:58 GMT
From: Mark Cowlishaw <mark_cowlishaw@my-deja.com>
Subject: Re: mod_perl require problem
Message-Id: <7kl4gi$6sr$1@nnrp1.deja.com>



Running httpd with the -X switch is recommended for debug purposes ONLY.
The other problem is that this only spawns one httpd which cant possibly
be efficient for a webserver.

Is there another solution to this problem? (I am experiencing this exact
same thing).



In article <7jujgk$hqu$1@nnrp1.deja.com>,
  Jason Eggleston <jason@eggnet.com> wrote:
> With further investigation, this did not solve the problem (the -X
> option isn't a good solution for me).  However, I figured out a better
> symptom:
>
> 1.  All of my scripts "require" the same code.
> 2.  As long as I only have executed 1 perl script since httpd started,
> the code always runs.
> 3.  When I execute multiple perl scripts that "require" the same code
> (a script that contains functions I wrote), the code, about half the
> time, no longer works.
> The error message I get is:
>
> [Sat Jun 12 14:17:32 1999] [error] Uncaught exception from user code:
>         Undefined subroutine
> &Apache::ROOT::chUserOptions_2epl::PrintHeading called
> at /home/httpd/html/chUserOptions.pl line 12.
>         Apache::ROOT::chUserOptions_2epl::handler('Apache=SCALAR
> (0x853581c)') called at /usr/lib/perl5/site_perl/5.005/i386-
> linux/Apache/Registry.pm line 135
>         eval {...} called at /usr/lib/perl5/site_perl/5.005/i386-
> linux/Apache/Registry.pm line 135
>         Apache::Registry::handler('Apache=SCALAR(0x853581c)') called
> at /dev/null line 0
>         eval {...} called at /dev/null line 0
>
> The function "PrintHeading" does exist in the file I include.
>
> This leads me to believe that in some cases, mod_perl will think
> a "required" file is loaded when in fact it is not.
>
> Any ideas?
>
> In article <37611792.43938682@dwc.ch>,
>   Christoph Wernli <cw@dwc.ch> wrote:
> > [posted and mailed]
> >
> >
> > It looks like you've run into the "compile once, run multiple times"
> pitfall (indicated by
> > "works about 1 out of every two tries).
> >
> > Try this:
> >
> > - run your httpd with the -X switch (daemon won't fork)
> > - replace the BEGIN{}-block with
> > 	use lib '/home/httpd/html/';
> > 	require 'stdinc.pl'
> >
> > Cheers,
> >
> > -werns
> >
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 21 Jun 1999 13:42:25 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: Re: multiple spaces and commas
Message-Id: <7kl8ig$qlg$1@zonnetje.NL.net>

>I'm very new to perl.  My only background in programming is a few semesters
>learning pascal and cobol at night school.
>
>I have read the perlfaq6 but most of it went over my head.
>
>Pete
check this site (print it if you can) :
http://www.netcat.co.uk/rob/perl/win32perltut.html

cul8r
--
Bastiaan v/d Berg ; aka buZz
Internet Specialist
Account Software Consultancy
-[ http://www.asc.nl/ ]-[ office@asc.nl ]-
-[ http://huizen.ddsw.nl/bewoners/buzz/ ]-[ buzz@ddsw.nl ]-





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

Date: Mon, 21 Jun 1999 08:30:18 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: multiple spaces and commas
Message-Id: <7klapv$s52$1@nntp9.atl.mindspring.net>

Peter Lavender wrote in message
<01beba65$049fd740$090aa8c0@winnie.sspl.net.au>...
:Hi everyone,
:I wish to take a like like:
:06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18, 0.14,
:0.16
:
:that has multiple spaces with commas to finish looking like:
:
:06/19/99,10:33pm,up,12 days,4:23,6,users,load average:, 0.18,0.14,0.16

Well one problem is that in your example sometimes you seem to want to split
on a single space and sometimes you don't.  Anyway, another problem we have
is you want to split on commas and spaces but not both.  If we wanted to
split on either one we could just use:

my $string = '06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average:
0.18, 0.14,0.16';
my $out = join(',',split(/\s+|,/,$string));
print $out;

which will split on one or more spaces or a comma.  The join puts it back
together with your desired commas as seperators.  The problem with solution
is those instances where we have both a comma and a space together.  In
those cases the above would produce two splits where we only want one.

One way to deal with this might be to first split on the spaces then split
on the commas:

$out = join(',',map{split(/,/)}split(/\s+/,$string));

This way we first split into an array using spaces and then feed that array
to the map which splits the elements of the first split this time using
commas.  We then join it back up again using join.  Now the problem is how
many spaces to split on.  If we split on one or more space (using the above)
we get:

06/19/99,10:33pm,up,12,days,4:23,6,users,load,average:,0.18,0.14,0.16

Which is close to what you asked for but has more splits than requested.  If
we want to only split on 2 spaces we could use:
my $out = join(',',map{split(/,/)}split(/\s{2}/,$string));

which gives:
06/19/99,10:33pm,up 12 days,4:23,6 users,load average: 0.18, 0.14,0.16
also close but not quite the spec.  Anyway, hopefully this will give you
enough to get you started.  As always, TIMTOWTDI.

HTH

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Imagination is more important than knowledge.
 - Albert Einstein




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

Date: Mon, 21 Jun 1999 15:14:30 +0200
From: =?iso-8859-1?Q?Bj=F6rn?= Teegen <bjoern.teegen@gmx.de>
To: Peter Lavender <plaven@idl.net.au>
Subject: Re: multiple spaces and commas
Message-Id: <376E3AB5.E816BB57@gmx.de>

Hallo Peter!

> I wish to take a like like:
>
> 06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18, 0.14,
> 0.16
>
> that has multiple spaces with commas to finish looking like:
>
> 06/19/99,10:33pm,up,12 days,4:23,6,users,load average:, 0.18,0.14,0.16

I have tried to solve your problem:

# assign string and print
$s = '06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18,
0.14, 0.16';
print "$s\n";
# replace (substitute) each space, comma or colon followed
# by at least one whitespace character by one single comma
# and print
$s =~ s/[ ,:]\s+/,/g;
print "$s\n";

This prints:

06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18, 0.14, 0.16

06/19/99,10:33pm,up 12 days,4:23,6 users,load average,0.18,0.14,0.16

Words that are separated by only one single space are not split, for example
'up 12 days', '6 users' or 'load average'. I hope that effect does not annoy
you. I also hope that it does not matter that colons are "eaten up" ;-)

Using the split function you can create an array of the strings separated by
comma.

Greetings,
Bjvrn



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

Date: Mon, 21 Jun 1999 09:46:42 -0400
From: Jim Cant <jcant@incert.com>
Subject: Re: multiple spaces and commas
Message-Id: <376E4242.3BA5AC8@incert.com>

If what you want is a new string where all the spaces are replaced by commas
while making sure an existing comma is not duplicated, try


    $originalString =
    "06/19/99  10:33pm  up 12 days,  4:23,  6 users, load average: 0.18, 0.14,
0.16";

    $fixedString = $originalString;

    # This regular expression replace any number of commas (,*) followed by
    # a space, followed by any number of spaces ( *) with a comma and does it
for
    # each occurrence found.  Note: there are 2 spaces between he *.s
    $fixedString =~ s/,*  */,/g;

    print "$fixedString\n";

Good Luck,

jim cant

Peter Lavender wrote:

> Hi everyone,
>
> I wish to take a like like:
>
> 06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18, 0.14,
> 0.16
>
> that has multiple spaces with commas to finish looking like:
>
> 06/19/99,10:33pm,up,12 days,4:23,6,users,load average:, 0.18,0.14,0.16
>
> I'm very new to perl.  My only background in programming is a few semesters
> learning pascal and cobol at night school.
>
> I have read the perlfaq6 but most of it went over my head.
>
> Pete



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

Date: Mon, 21 Jun 1999 06:48:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: multiple spaces and commas
Message-Id: <MPG.11d7e28081fb1416989c0d@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <01beba65$049fd740$090aa8c0@winnie.sspl.net.au> on Mon, 21 
Jun 1999 10:40:17 GMT, Peter Lavender <plaven@idl.net.au> says...
 ...
> 06/19/99  10:33pm  up 12 days,  4:23,  6 users,  load average: 0.18, 0.14,
> 0.16
> 
> that has multiple spaces with commas to finish looking like:
> 
> 06/19/99,10:33pm,up,12 days,4:23,6,users,load average:, 0.18,0.14,0.16
 ...
> I have read the perlfaq6 but most of it went over my head.

You'll find this in perlre, not perlfaq6.  Allan M. Due struggled with 
splits, but your requirements are IRregular enough to require a regular 
expression.

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

$_ = '06/19/99  10:33pm  up 12 days,  4:23,  6 users,' .
     '  load average: 0.18, 0.14, 0.16';

s/(\S+)\ +      # $1 date
  (\S+)\ +      # $2 time
  up\ +
  (\d+\ \S+)\ + # $3 up-time
  (\S+)\ +      # $4 used
  (\d+)\ +      # $5 number of
  (\S+)\ +      # $6 users,
  (\S+\ \S+)\ + # $7 load average:
  (\S+)\ +      # $8
  (\S+)\ +      # $9
  (\S+)         # $10
 /$1,$2,up,$3$4$5,$6$7, $8$9$10/x;

print "Right on!\n" if $_ eq
  '06/19/99,10:33pm,up,12 days,4:23,6,users,' .
  'load average:, 0.18,0.14,0.16';
__END__

I split the data lines to foil the linewrapping of the newsreader.

I've never had occasion to use $10 before, so this is a first!

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


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

Date: 21 Jun 1999 09:38:46 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Need help with CGI/Perl - Repost for easy viewing
Message-Id: <x7hfo18yhl.fsf@home.sysarch.com>


as brian said, throw it out and use lwp. you are reinventing the wheel,
the inclined plane, the lever and all sorts of stuff.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 21 Jun 1999 09:30:44 -0400
From: Jim Cant <jcant@incert.com>
Subject: Need pointer to Regular Expression or Boolean search package
Message-Id: <376E3E84.D294ABC8@incert.com>


I need to find a library, tool kit, or such for regular expressions to
incorporate into an application.  Any pointers to same will be much
appreciated.

Ability and perform searches on Boolean or 'natural expressions' such as

        (ice cream or chocolate) and not broccoli

is especially desired.  In fact, support  for this and not full
regular expressions might be sufficient.

Having source code would be a plus.

Another thought. Is it possible to link Perl in some incarnation into
an application and use its capabilities as an under the covers engine?

Thanks in advance

jim cant
cant@world.std.com


Jim Cant
cant@world.std.com
617-244-1792



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

Date: 21 Jun 1999 13:22:04 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: newbie - NT
Message-Id: <01bebbe9$0e5fdc50$d53ec69b@leicester>

The command line should be something like ...

	c:\perl\bin\perl.exe your_script.pl

					... but this can be changed after using the assoc and ftype dos
commands. 

See assoc /? and ftype /? in a command window.

You can also add an Open to a mouse right-click menu for a perl script by
using the File Type dialogue options in an explorer window.

The shebang line is unnecessary in WinNT.

Let me know if you still have a problem.

                             Jeff Wilson
                             London UK

Kim Crompton <xxkcrompton@compuhelp.net> wrote in article
<NlGa3.885$yE1.72513@monger.newsread.com>...
> I have purchased several books on Perl 5 and cannot figure out how to
> execute a perl script from the command line of my browser.  I receive the
> error:
> 
> %1 is not a valid Windows NT application.
> 
> I can run perl scripts from the command line.  I'm fairly certain that
Perl
> is installed correctly.  All of the documentation that I have found is
for
> UNIX or Apache.  I don't even know what the shebang line should look like
or
> if I even need one.  I have tried #!perl and #!d:/Perl/bin/perl.exe.  I
get
> the same results for both.
> 
> I am trying to interface to the UPS online system.  The sample code they
> have given is in written in Perl.  I've tried using PerlScript with
active
> server pages but it doesn't work (it doesn't give me an error either). 
So,
> as a last resort I need to use either a .pl file or a .cgi file.  Can
anyone
> help me?
> 
> I am running windows NT server, IIS 4.0, and Perl build 5.15.
> 
> Please email me at kcrompton@compuhelp.net
> 
> Thanks
> 
> 
> 
> 


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

Date: Mon, 21 Jun 1999 14:06:13 +0530
From: Yogesh Kulkarni <yogeshhk@gsslco.com>
Subject: Newbie: hashes to HTML table
Message-Id: <376E7F2B.281242CD@gsslco.com>

This is a multi-part message in MIME format.
--------------FC47031AA9706E0DE76E4176
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,

I have hashes of hashes.
like:

%HoH = (
       "flintstones" => {
           "lead"    => "fred",
           "pal"     => "barney",
       },
       "jetsons"     => {
            "lead"   => "george",
            "wife"   => "jane",
            "his boy"=> "elroy",
        }
       "simpsons"    => {
            "lead"   => "homer",
            "wife"   => "marge",
            "kid"    => "bart",
     );

I would like them to put them in HTML Table format

like:

Name    flintstones    jetsons    simpsons
lead        fred                george      homer
wife         -                    jane            marge
pal           barney           -                -
his boy    -                    elroy          -
kid            -                     -                bart



Please let me know (also at yogeshhk@gsslco.com)

Yogesh




--------------FC47031AA9706E0DE76E4176
Content-Type: text/x-vcard; charset=us-ascii;
 name="yogeshhk.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Yogesh Kulkarni
Content-Disposition: attachment;
 filename="yogeshhk.vcf"

begin:vcard 
n:Kulkarni;Yogesh
x-mozilla-html:TRUE
org:GSSL
adr:;;;;;;
version:2.1
email;internet:yogesh@email.com
title:http://www.yogesh.org
x-mozilla-cpt:;-6656
fn:Yogesh Kulkarni
end:vcard

--------------FC47031AA9706E0DE76E4176--



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

Date: 21 Jun 1999 14:18:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie: hashes to HTML table
Message-Id: <376e3b88@newsread3.dircon.co.uk>

Yogesh Kulkarni <yogeshhk@gsslco.com> wrote:
> This is a multi-part message in MIME format.
> --------------FC47031AA9706E0DE76E4176
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 

You should turn off this vCard stuff - the vast majority of real newsreaders
dont have any use for it whatsoever ..

> 
> I have hashes of hashes.
> 

<SNIP>

> I would like them to put them in HTML Table format
> 

Have you read what it says abaout printing aout these kind of data structures
in the perldsc manpage ;-}

/J\
-- 
"Nourishes at the root and penetrates right to the tip" - Pantene
Advertisement


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

Date: Mon, 21 Jun 1999 14:50:14 +0100
From: Matt Sergeant <matt.sergeant@ericsson.com>
Subject: Re: Perl scripts slows down servers?
Message-Id: <376E4316.4FC9DFD@ericsson.com>

Danny Aldham wrote:
> 
> :        250 MHz    400 MHz       Lines of
> :        R10000     Pentium II   source code
> : Java   4.9 sec    9.2 sec         105
> : Perl   1.8 sec    1.0 sec          18
> : A good book (as you can see :-)!
> 
> Huh?! Moving from the R1000 to the Pentium, Perl runs faster while
> Java runs slower? Why do they not at least both move in the same
> direction?

Sun. They optimised their JVM to run on Suns. Shocking huh?

--
Matt.


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

Date: Mon, 21 Jun 1999 11:25:50 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Problems with MacPerl and modules
Message-Id: <pudge-2106990725530001@192.168.0.77>

In article <376DDB3D.5F26E5B6@h2net.net>, mjohnson@h2net.net wrote:

# I had tried previously to get this, but it never worked because Netscape was
# complaining about the archive being corrupt.  I switched to Fetch and it
# downloaded fine.  It installed and worked flawlessly!

As an aside, a recent version of Netscape *shouldn't* have problems with
it.  If it does, well, FTP always works properly (in binary mode).  :)

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Mon, 21 Jun 1999 11:41:21 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Search script performance
Message-Id: <ebohlmanFDoDsx.52C@netcom.com>

rumple1000@my-deja.com wrote:
: I have a Perl search script which takes a long time to find keywords in
: a bunch of files.
: 
: The html files are about 3000 (about 2-3k each) and are stored a very
: complicated and deep structure of nested subdirectories.
: 
: Would this structure of subdirectories affect the performance of the
: script which uses find.pl inside it to recurse all the subdirectories?
: 
: Would this search be faster if all the files were stored in one
: directory?

I'd suggest that you first disable the actual searching of the file 
contents and then time how long your script takes.  I suspect that the 
time spent traversing directories is going to be a lot less than the time 
spent reading and searching each file, and that trying to "optimize" it 
will result in minimal speedup.  If that's the case, then the best path 
to take is to generate some sort of index file and search it rather than 
the individual files.



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

Date: 20 Jun 1999 23:50:26 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Server Running Perl - Resources?
Message-Id: <slrn7mrh4d.k1b.abigail@alexandra.delanet.com>

Troy Knight (troyknight@troyknight.eurobell.co.uk) wrote on MMCXX
September MCMXCIII in <URL:news:7kk23r$p3r$1@aub.eurobell.net>:
<> This isn't the best place to ask about servers but I guess your all pretty
<> knowledgable about servers seeing as most people set them up when they
<> program in perl.

You must see a lot of things that aren't there! Or perhaps, you don't
see a lot of things that are there! Tons of people run Perl on a daily
basis without using web servers or ilk like that.

<> What kind of a system would be needed to run a server online for one large
<> website which uses up alot of cgi resources. A pop, smtp, nntp server would
<> also be running on the same machine with a couple of hundred users. The site
<> would be getting about 5000 visitors a day. I have a p166mmx with 64meg of
<> ram and an average speed hd.

You need a system that can handle "alot".

<> Any ideas then anyone on whether this could cope with all that load?

What load? You haven't told us anything. Of course, it's totally 
off topic in this group.

Call Sun. Call HP. Call SGI. Call Intel if you want to go that way.
See who gives you the best deal.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 21 Jun 1999 13:42:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Server Running Perl - Resources?
Message-Id: <376e3333@newsread3.dircon.co.uk>

Troy Knight <troyknight@troyknight.eurobell.co.uk> wrote:
> This isn't the best place to ask about servers but I guess your all pretty
> knowledgable about servers seeing as most people set them up when they
> program in perl.

I  wouldnt make that assumption - the vast majority of the Perl programs
that I write have nothing to do with a server of any sort ...

/J\
-- 
"The teenage masturbators of today are the television executives of
tomorrow" - Melissa Cabriolet, Drop the Dead Donkey


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

Date: Mon, 21 Jun 1999 09:59:01 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Signature removal regex?
Message-Id: <1dtqsvm.kjwqjmibf9kvN@roxboro0-0021.dyn.interpath.net>

I.J. Garlick <ijg@connect.org.uk> wrote:

> planb@newsreaders.com (J. Moreno) writes:
> > I.J. Garlick <ijg@csc.liv.ac.uk> wrote:
> > 
> > 
> > Complain to the newsreaders authors -- I do.
> 
> I would if we were talking news readers here. Unfortunately this is email
> and we are vastly outnumbered by M$ sheep who don't have the first clue
> about proper signature form. I can forgive them this as they don't know
> any better, but even worse are the programmers of mail clients who
> perpetuate the problem by not taking what the sheep do and sticking a '-- '
> on a single line before their 24 line sig.

Oh, I complain to email authors to, just not as much.

> > Huh?  I don't seem to be understanding you -- that should remove the
> > last sig in a message and nothing else.  If you've got two, or three or
> > more shouldn't make a difference:
> 
> I knew I hadn't explained that right. :-( I agree with you totally John but
> as I said things are nowhere near as simple as I first thought.
> 
> > 
> > I'm still not clear on what you're looking for, what kind of failure modes
> > do you forsee for that regex?
> 
> Ok suppose they want to reply to a message that has someone else's quoted
> rfc legal signature in it eg.
> 
> >> some quoted message to reply to
> >>
> >> -- 
> >> there sig
> 
> They enter some text and then decide to suspend editing and save till later.
> Now if their sig is appended when they save I want to strip it out when they
> re-edit or at least detect it's there so I don't add another. Easy your regex
> works fine.
> 
> But what if they didn't save their sig? Not sure but yours may catch that
> quoted one. Doesn't matter though as it should be trivial to detect the
> quoted sig and not remove it. NOT. If everyone quoted the same great but
> they don't (see Abigail's posts) so this isn't as easy as it sounds.
> 
> The potentially worse scenario is if they try to forward a message of theirs
> to someone else. The sig stripping could then potentially strip the sig from
> this forwarded message if they save it then re-edit and the saved version
> only has the forwarded messages version of their signature.
> 
> God this gets worse. I think I am begging to see why Tom C's answer was so
> complicated. It will probably take some form of semi-intelligent script to
> accomplish what I want. Me thinks a re-think is in order.

The regex I gave ONLY strips out a "proper" sig -- that is the 5
characters: newline hyphen hypen space newline followed by whatever (as
long as it doesn't contain another sigdash).

So it doesn't matter what their quote prefix is as long as they do have
one, as long as they don't use the AOL "<<quoted>>" style then the above
scenario should be handled just fine (and if you're worried about that
you'll have to look for it before applying that regex).

Now, there could be some problems with forwarding if it's of the:
--- begin forwarded text
unquoted text
--- end forwarded text
style, and you'll have to handle that separately (which I know probably
isn't that easy, but shouldn't be that difficult either, at least not
enough to be usable).

> > And just what kind of information are you
> > going to have on this "sig"?
> 
> I know they're sig exactly to the character at the time of re-editing, the
> script can read their sig file gauranteed. Only problem is they could have
> changed it in between the save and re-edit, so it don't help me much.

Hmn, could you embed a null in the sigdash?  That'd take care of finding
it.

> Thanks for answering John, I probably mislead you with my original post
> and appologise if so. I was under the impression that this would be easy
> too but I didn't think it through properly. Ah well I seem to do a lot of
> that in this news group.

Well, it still doesn't seem that complicated to -- which probably means
I'm not grasping the problem...

-- 
John Moreno


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

Date: Mon, 21 Jun 1999 12:40:14 GMT
From: haytounet@my-dejanews.com (Arnaud Limbourg)
Subject: Temporary file
Message-Id: <376e3126.20484411@news.bull.fr>

Hello,

i wrote a little script which purpose is to send a form content to an
email.

To achieve this i need to write the info into a file then send the
file's content via wSendmail.

I need to make a temporary file for each process, because two users
can run the script at the same time i can't use a unique file.

I tried using 

$fh = IO::File->new_tmpfile(">")
       or die "unable to make temp file: $!");

i also tried, form the perl documentation

use Fcntl;
    use POSIX qw(tmpnam);

    # try new temporary filenames until we get one that didn't already
    # exist;  the check should be unnecessary, but you can't be too
careful
    do { $name = tmpnam() }
        until sysopen(FH, $name, O_RDWR|O_CREAT|O_EXCL);

    # install atexit-style handler so that when we exit or die,
    # we automatically delete this temporary file
    END { unlink($name) or die "Couldn't unlink $name : $!" }


The first function doesn't crash but t doesn't work because it doesn't
send any email.

I call wSendmail by

$mail_command = "$dosmail_path$dosmail_prog -C \"-sMail devis\"
-f$mail_from $mail_to $fh";

where $fh is to be the file to send.


The second function to know the name of the file, doesn't work at all.

I'm lost, i am really trying to make this thing work.

Thank you for your help.


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

Date: Mon, 21 Jun 1999 12:26:40 GMT
From: Nostradamus <mboertien@my-deja.com>
Subject: When is Sybperl a good choice
Message-Id: <7klb1n$8sc$1@nnrp1.deja.com>

At the moment i am investigating whether or not it is usefull to start
using perl and sybperl to write some scripts with. Before i programmed
things in shell scripts which just called isql. Problem with this was
that it was quite difficult to get multiple values back.....so now i am
looking into perl together with sybperl.....could anyone give me some
advice on this?

Thanks in advance


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 21 Jun 1999 08:50:15 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: NewtronBoy@aol.com
Subject: Re: Writing RTF with Perl
Message-Id: <376E4317.299603A0@mail.uca.edu>

[cc'd to n]

NewtronBoy@aol.com wrote:
> 
> Does anyone know of a specification
> of Rich Text Format so I can create RTF files
> with perl?
> 
> I'd appreciate any feedback.

The easiest way would be to grab a copy of M$ Word and control it
through Win32::OLE. Since M$W2000 is now out, I figure you should be
able to snag M$W97 for a pittance (especially from somebody who has
decided to get 2000, but do this before they have found the bugs in 2000
(not speaking from personal experience) and reinstall 97).

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 6075
**************************************

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