[9351] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2946 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 23 11:22:33 1998

Date: Tue, 23 Jun 98 08:00:27 -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           Tue, 23 Jun 1998     Volume: 8 Number: 2946

Today's topics:
    Re: after 5 hrs, the beginner beats the s/// <quednauf@nortel.co.uk>
    Re: argc and argv <psdspss@execpc.com>
    Re: Binmode ("Mark Morgan Lloyd ")
    Re: Comparing conditional ? with if..else construct dgris@rand.dimensional.com
    Re: Comparing conditional ? with if..else construct (Larry Rosler)
    Re: Comparing conditional ? with if..else construct <quednauf@nortel.co.uk>
    Re: Flames.... birgitt@my-dejanews.com
    Re: Flames.... (Chris Nandor)
    Re: Flames.... <upsetter@ziplink.net>
    Re: how do I get directory structure disk space used? (Tad McClellan)
    Re: How to find last modified date of a file? <rootbeer@teleport.com>
        How to test perl on my windows95 home computer...? <mouwend@casema.net>
    Re: How to test perl on my windows95 home computer...? <quednauf@nortel.co.uk>
    Re: MD5 and Perl4 <rootbeer@teleport.com>
    Re: MD5 and Perl4 (Pel Lxberg)
    Re: MD5 and Perl4 (Mark-Jason Dominus)
    Re: number search <barnett@houston.Geco-Prakla.slb.com>
    Re: Pat space doesn't change in nested whiles <rootbeer@teleport.com>
    Re: pattern and variable question <barnett@houston.Geco-Prakla.slb.com>
    Re: Please help with this script <rootbeer@teleport.com>
    Re: Q: Can I run Perl program regularly? (Joe McMahon)
        Reading POD files in a browser... <featheredfrog@geocities.com>
    Re: Remove blank  too much lines from a text file (Larry Rosler)
    Re: Remove blank  too much lines from a text file <quednauf@nortel.co.uk>
    Re: Remove blank  too much lines from a text file <perlguy@inlink.com>
    Re: Remove blank  too much lines from a text file <rootbeer@teleport.com>
    Re: RTF parsing pverdret@sonovision-itep.fr
    Re: RTF parsing pverdret@sonovision-itep.fr
    Re: Running commands <mike@newfangled.com>
    Re: Warnings from environment variables under -w <rootbeer@teleport.com>
    Re: Weekdays <-> Dates <quednauf@nortel.co.uk>
    Re: What "mini" database (text?) to use? (Gabor)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 23 Jun 1998 13:21:19 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: after 5 hrs, the beginner beats the s///
Message-Id: <358F9DBF.93CA1495@nortel.co.uk>

Michael J Gebis wrote:
> 
> sowmaster@juicepigs.com (Bob Trieger) writes:
> }$line =~ s/^\s*(.*)\s*$/$1/;
> 
> }That is what you are looking for and if you checked the FAQs, you wouldn't
> }have wasted 5 hours.
> 
> I personally find it funny that it took SEVEN (at this count) people
> to show this guy up. ...[more]...

Yeah, it was quite intersting to watch ! But everyone's got to make that
experience that 2 of the 5 hours would have been better spent reading some of
the available documentation.  So next time, I am sure that Brent will do as
'recommended' :) 
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 23 Jun 1998 09:21:07 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: argc and argv
Message-Id: <358FB9D3.72E3DAD0@execpc.com>

Robert Rehammar wrote:

> Hi !!
>
> I'm writning a perlscript to use with CGI and the POST method. Now  I
> need to read the argc and argv (don't know if this is the perl name of
> it, but I'm sure that everybody knows what I mean, the parameters sent
> to the program...). My question is how do I do this ???
>
> \\Robert Rehammar

Command line parameters are passed in @ARGV array.As far as I know, there
is nothing directly like argc, but you
can get the count like this

$argc = @ARGV;  # In scalar context, an returns its length or number of
elements.

Another important point is :
Name of the pgm/script is not in @ARGV, *unlike* in C.
You can get this from the special variable : $0.

Look at the following example.
#!/usr/bin/perl

$argc = @ARGV;

print "\nUsing for loop:\n";
for ($i =0; $i < $argc; $i++)
{
   print "Cmd line parm $i is $ARGV[$i]\n";
}

print "\nUsing foreach loop :\n";

foreach $arg (@ARGV)
{
   print "Cmd line parm is  $arg\n";
}

print "\nThe name of the script is : $0\n";

You should have read perl faq for a better understanding :
http://language.perl.com/faq/index.html

Hope that helps.
Deva




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

Date: 23 Jun 1998 15:02:03 +0100
From: mark_tbu@cix.co.uk ("Mark Morgan Lloyd ")
Subject: Re: Binmode
Message-Id: <6mocgr$sn5$1@plutonium.compulink.co.uk>

In article <Pine.GSO.3.96.980622164015.3398K-100000@user2.teleport.com>, 
rootbeer@teleport.com (Tom Phoenix) wrote:

> > How do I use binmode on a DOS file? 

> Both of those are using the line-input operator to read a line at a 
> time. Of course, a file with lines of text is a text file - you don't 
> want to
> use binmode on that! 
> 
> > The problem is that I've got a simple script to get rid of embedded
> > nulls in a text file which is getting messed up by DOS Perl's default
> > handling of \r\n. 
> 
> binmode won't tamper with nulls; it signals that you're working with a
> binary file, not a text file, and that therefore no translation to "\n"
> (newline character) should be performed. (It also keeps the DOS
> end-of-text character from being interpreted.) 

Thanks for the comment, I've just been checking over some examples. In 
actual fact, \0 is being handled exactly as expected, i.e. appears 
(apparently) in the middle of a line... if it's not then it's getting an 
implicit /\0/\n/g which is exactly what I want anyway :-) also \r by 
itself is unchanged which isn't too bad. The problem is a spurious 
expansion of \n (by itself) to \r\n, and I was assuming from the 
description of binmode in the camel book that this would prevent it; \n\r 
becomes \r\n which again is in line with binmode's description.

I'll take a look at tr/// but I think that it won't see \n by itself since 
despite the fact that I'm using DOS-style Perl ports they will simply 
assume that \n is a line written by somebody sane in the midst of a whole 
lot of others written by escapees from a home for retired CP/M programmers 
:-)

Mark Morgan Lloyd
mark_tbu@cix.co.uk

[Opinions above are the author's, not those of his employers or 
colleagues]

** Internet feed may be unreliable- please cc anything important by email 
**


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

Date: Tue, 23 Jun 1998 13:07:50 GMT
From: dgris@rand.dimensional.com
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <6mo8le$og7$1@rand.dimensional.com>

[posted and mailed to the cited author]
In article <MPG.ff93e411c90fce99896eb@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:

>Why are you blaming this mistake on C++, or C for that matter?  The 
>precedences are exactly the same as in Perl.
>
#include <stdio.h>

/*  If this is named test.c it will fail to compile.
    If it is named test.C it will compile and provide
    an answer of 10.  Only difference it whether gcc
    compiles it as C or C++
*/
void main(){
    int a = 5;
    a % 2 ? a += 5 : a += 2;
    printf ("this is a: %d\n", a);
    exit(0);
}

>  Even overloading the 
>operators cannot change the precedences.
>
Yes, but C++ has different precedence rules, take a look at
Stroustrup 3rd edition.  This bit me hard a couple of months
ago (fortunately Tom helped me figure out what I was doing
wrong :-)).

>Larry Rosler

Regards,
Daniel


-- 
Daniel Grisinger           dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                           Dave Clark


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

Date: Tue, 23 Jun 1998 06:07:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <MPG.ff94876d6ec7e409896ec@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <6mo6vc$pvd$11@csnews.cs.colorado.edu>, Tom Christiansen 
<tchrist@mox.perl.com> says...
> In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
> :Why are you blaming this mistake on C++, or C for that matter?  The 
> :precedences are exactly the same as in Perl.  Even overloading the 
> :operators cannot change the precedences.
> 
> Because it in fact *is* different in C++ than it is in C.
> In C, it's illegal without parens, because C and Perl have
> the same precedence.  But in C++, prececence *differs*, and the
> parens are implicitly supplied for you anyway.

#include <stdio.h>
int main()
{
	int a, b = 1, c, d = 2, e = 3;
	a = b ? c = d : c = e;
	printf("a = %d\n", a);
	printf("c = %d\n", c);
}

C gave a syntax error:  "Modifiable lvalue required for assignment 
operator.".  C++ compiled and ran, and the output was:

a = 3
c = 3

So I agree on the illegality in C (and wish Perl would barf also).  But I 
don't see the implicit parens in the C++ result (which is the same if b 
== 0).  If they were there, a and c would == 2.

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


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

Date: Tue, 23 Jun 1998 13:40:27 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <358FA23B.54B46813@nortel.co.uk>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc,
>     "F.Quednau" <quednauf@nortel.co.uk> writes:
> :  $args->{subjectline} ? $subject = $args->{subjectline} : $subject = ".*";
> 
> Man, yet another C++ mistake.  Why does this keep happening?
> It's a simple matter of precedence.  You have to parenthesize
> the assignments, just as you do with
> 
>     if ( ($x = f()) || ($y = g()) ) { ..... }
> 

Thanks for all the responses!
BTW - I DON'T come from a C++ background. You can blame that n - headed,
multidimensional hydra called thoughtlessness and its little brother, the
'overlooker'...:)

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 23 Jun 1998 12:55:49 GMT
From: birgitt@my-dejanews.com
Subject: Re: Flames....
Message-Id: <6mo8kl$5ns$1@nnrp1.dejanews.com>

In article <6mn1a0$hlf$1@csnews.cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>
>
> In comp.lang.perl.misc, birgitt@my-dejanews.com writes many things.
>
> I suggest that you draft you proposed daily postings regarding what
> people should know.

I can make a try and do a draft - though I think I am not a native
speaker and come therefore with a different set of sensibilities and
points of views than people who have been raised in the U.S.

> I expect that it shall make no difference at all.

There is a good thing about giving it a try.

If you are right with your expectations, I have learned an important
lesson and you might be happy to have taught me one.

If I am right with my expectations, you might have learned a lesson
and I am happy to have made the only useful contribution I am
capable of making to this group at the stage I am at.

Then I also stop writing *many things* in c.l.p.m. :-)

(I guess I can't ignore my own suggestions, can I ?)

Birgitt Funk




-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 23 Jun 1998 13:10:39 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Flames....
Message-Id: <pudge-2306980907530001@dynamic52.ply.adelphia.net>

In article <ltk968u2us.fsf@asfast.com>, Lloyd Zusman <ljz@asfast.com> wrote:

# However, the rules of the newsgroup change over time, as the make-up
# of the participants change.  For example, about 4 or 5 years ago, the
# people in the comp.lang.perl newsgroup were quite happy to answer "how
# to" questions from novices, even repeated questions.  This is back in

Sure, back when the FAQ was not around.


# the days when the Perl community seemed to be more eager to let the
# world know how useful and powerful Perl is.  I even remember that Perl

Oh, please.


# > Be offended.  Go right ahead.  But realize it is not "newbies" who are
# > flies, it is "clueless newbies who would rather waste someone else's time
# > than their own."
# 
# It has not been established that each person who gets a condescending
# or insulting response here is someone who "would rather waste someone
# else's time than their own."

Pretty much it is the case, yes.  They ask dumb questions that are easily
answerable just by looking up "perl FAQ" on Yahoo.  It is obvious to
everyone that they do not, as netiquette requires, stop and look at the
newsgroup before posting (and read the FAQs posted perriodically), they do
not look at the online perl FAQ, etc.  They would rather waste the time of
people who know then do a little bit of work.

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


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

Date: 23 Jun 1998 14:42:56 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Flames....
Message-Id: <6moetg$pf4@fridge.shore.net>

Russ Allbery <rra@stanford.edu> wrote:

: It's always been easier to argue on Usenet than to do nearly anything
: else.

No, it hasn't! 

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: Tue, 23 Jun 1998 00:31:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: how do I get directory structure disk space used?
Message-Id: <cjenm6.35c.ln@localhost>

Beck Web Servers & Design (admin@bwsd.com) wrote:

: I'm trying to a directory structure -> disk space used script.  
                                         ^^^^^^^^^^^^^^^

   Since disk space is managed by the Operating System, it would
   be good if the OS could tell you that somehow.

   ... but we don't know what OS you are using, 'cause you didn't say...


: I
: haven't the foggiest where to start.  I can do stuff with files, but
: have never attempted directories.  I know what I need...just don't know
: how....read directory and all directories under and get running total of
: bytes in the directories...


   If you what to roll your own in Perl, then you probably should
   look into the File::Find module on CPAN ( http://www.perl.com/CPAN/ )


: I know there must be an easy way to do this.


   If you have a Unix type system, this ought to do it:

   $space_used = `du -s some-directory/`;




[
  Does your file system support "holes"? 

  Do you want to count the holes?

  That is, do you want to know 

   1) the sum of the sizes of all of the regular files below a
      certain directory? (this won't be too hard in Perl)

   2) the actual disk space needed, including all of the overhead
      and housekeeping space that the OS uses to manage the FS.
      (better ask the OS to tell you this)
]


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 23 Jun 1998 13:52:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to find last modified date of a file?
Message-Id: <Pine.GSO.3.96.980623065154.24075H-100000@user2.teleport.com>

On Mon, 22 Jun 1998, F.Quednau wrote:

> open(BLA, $explan_file);

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Jun 1998 15:15:32 +0200
From: "Marcel Ouwendijk" <mouwend@casema.net>
Subject: How to test perl on my windows95 home computer...?
Message-Id: <6mo9nr$r8e$1@sun4000.casema.net>

Hi there...

I want to test my perl programs on my homecomputer with windows95 befor i
upload theme to my provider.

How can i do this???

Thanks in advance...
Marcel




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

Date: Tue, 23 Jun 1998 14:39:58 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How to test perl on my windows95 home computer...?
Message-Id: <358FB02E.CBA17670@nortel.co.uk>

Marcel Ouwendijk wrote:
> 
> Hi there...
> 
> I want to test my perl programs on my homecomputer with windows95 befor i
> upload theme to my provider.
> 
> How can i do this???
> 
> Thanks in advance...
> Marcel

Phew, this is asked a lot, and there is no straight answer in the win32 FAQ ( eg
http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html )

I think I will write a few lines on that in my web page. From the sound of it
you want to run the programs in a CGI context, so you'll need the TCP/IP thing
installed. Don't worry if you don't have a network card, just install a Network
Card anyway :) Don't forget to include that particular Protocol. Then you get a
Webserver (I STRONGLY recommend Omnihttpd : http://www.omnicron.ab.ca/httpd/ ,
simply because it's free, it's not M$, and I haven't read any post yet that
would complain about it, but GOOGOL number of people struggling with Personal
Webserver, etc...[Oh well, might be because no one uses Omnihttpd :)]), and let
it run on 127.0.0.1, which is the loopback IP address. Then you check the Server
properties, tell it where to find the Perl interpreter, and off you go !
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 23 Jun 1998 14:19:02 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: MD5 and Perl4
Message-Id: <Pine.GSO.3.96.980623071718.24075M-100000@user2.teleport.com>

On 23 Jun 1998, P=E5l L=F8berg wrote:

> I have used the MD5 module for Perl5, but need to do this in Perl4.

MD5 is often used for security-related issues. Perl4 has known security
holes. These don't go well together. Cheers!

--=20
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 23 Jun 1998 16:26:08 +0200
From: pallo-njus@orakel.ntnu.no (Pel Lxberg)
Subject: Re: MD5 and Perl4
Message-Id: <dt4hg1cnqin.fsf@verden.pvv.ntnu.no>

Tom Phoenix <rootbeer@teleport.com> writes:

> On 23 Jun 1998, Pel Lxberg wrote:
> 
> > I have used the MD5 module for Perl5, but need to do this in Perl4.
> 
> MD5 is often used for security-related issues. Perl4 has known security
> holes. These don't go well together. Cheers!

OK, let me rephrase the question. I'm looking for a way to do MD5 in
Perl5 in a Perl4 fashion without using modules (use/require) or
external programs.

So what I'm really looking for is MD5 implemented in pure Perl code.

-- 
*********************** Pel Brovold Lxberg *********************
  E-mail: pallo @ pvv.org      WWW: http://www.pvv.org/~pallo/
****************************************************************


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

Date: 23 Jun 1998 10:46:32 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: MD5 and Perl4
Message-Id: <6mof48$cm9$1@monet.op.net>

In article <dt4k968nz1s.fsf@verden.pvv.ntnu.no>,
Pel Lxberg <pallo-njus@orakel.ntnu.no> wrote:
>Have anyone implemented MD5 checksums routines (primarily for
>calculating MD5 checksums of files) in Perl4 without using external
>programs?

MD5 is very simple.  Why don't you look into the source code of the
MD5.pm module and see whather you can reuse it?



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

Date: Tue, 23 Jun 1998 07:43:48 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: number search
Message-Id: <358FA304.C0922C73@houston.Geco-Prakla.slb.com>

Tom K wrote:
> 
> Greetings All;
>      I want to put multiple 5 digit numbers into a data file or in the
> program itself....
>      I inserted a couple of 5 digit combonations into one line, called
> suffix, seperated the
>     numbers with a comma, didnt work.  I attemped to simple use a data
> file, made a
>     reference to file, no dice...
> 
>     I need help understanding how a perl script seperates items in a
>     single line...    Any and all suggestions welcome....
> 
>                                                 Thanx;
>                                                         Tom
Well, I have several recommendations.

First, look up the split command.  perldoc -f split, read the Blue
Camel, read the docs on the web.

Second, when posting questions regarding code, providing small code
snippets that display what doesn't work is much more helpful than saying
"I inserted a couple of .... commas, didn't work."  From this, we've no
way of knowing what you mean by 'didn't work'.  Did the machine catch
fire?  Did the OS crash?  Did the script spit out an error?  All
relevant, and possible, but not all are necessarily caused by your
script.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Tue, 23 Jun 1998 14:09:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Pat space doesn't change in nested whiles
Message-Id: <Pine.GSO.3.96.980623070157.24075J-100000@user2.teleport.com>

On Tue, 23 Jun 1998, Eric Bohlman wrote:

> Tom Phoenix <rootbeer@teleport.com> wrote:
> : Having said that, I should mention that it's almost always wrong to 
> : have the diamond operator in two places within the same program. 
> 
> Shouldn't that be "within the same *loop*" or "for reading the same file"? 

That's what I had in my first draft. I decided that I could be more
general, since I did say "almost" always.

If you know what you're doing, you can use as many diamond operators as
you wish. But it's very rare to see a real-world script with more than one
diamond properly used. 

> Obviously if a program has to read distinct files line by line for
> different purposes, multiple diamond operators are to be expected.

Maybe you meant to say "multiple line input operators"? The diamond is
more magical than the ordinary line input operator. It's normal to have
more than one line input operator in a program, of course.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 23 Jun 1998 07:39:46 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: pattern and variable question
Message-Id: <358FA212.DD0D2184@houston.Geco-Prakla.slb.com>

Sylvain Juneau wrote:
> 
> I need help:
> I have a variable called $last_line =
> 
> Jun 22 15:50:48: FTP /users/ocean/incoming/ACAQ2B.Jun 22 15:50:48: FTP
> /users/ocean/incoming/ACAQ2B.GRB.22155044.info1 to
> public:/users/public/oceans/ACAQ2B.GRB...OK
> 
> and I would like to test this variable using a matching pattern like
> /GRB/
> 
> something like this:
> 
> if ( $last_line has this pattern /GRB/) {print "SUCCES"}
> else{print "FAIL"}
<snip>

I suggest having a look at the =~ and !~ operators in your Programming
Perl (Blue Camel) or equivalent.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Tue, 23 Jun 1998 13:21:41 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Please help with this script
Message-Id: <Pine.GSO.3.96.980623061234.24075E-100000@user2.teleport.com>

On 23 Jun 1998, Chris Edwards wrote:

> Subject: Please help with this script

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

>  Basically what I want this script todo is reconize my name in the name
> field and when it see's my name it will color it red on the pages it
> generates on my site. 

You'll probably want to use a pattern match. If you're having trouble
constructing a suitable pattern match after reading the perl docs, please
ask again.

It also sounds as if you'll need to generate some HTML which will mark the
text as red. If you're not sure what HTML codes are needed after reading
the HTML docs, please ask in a newsgroup about HTML.

> begin 600 wwwboard.pl
> M(R$O=7-R+V)I;B]P97)L#0HC(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C

Don't post binaries to non-binary groups. It won't do any good; they'll
just be cancelled or killfiled. But if you're having trouble with a Perl
program, rather than posting the entire thing, cut it down to just a few
lines which illustrate the difficulty you're having before you post it.

Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Jun 1998 10:42:35 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Q: Can I run Perl program regularly?
Message-Id: <joe.mcmahon-2306981042350001@prtims.stx.com>

In article <358ecba4.0@rapeme.kirov.ru>, "D" <dmgl@dmgl.kirov.ru> wrote:

>Dear Sir/Madam
>
>How can I make a program that can run my Perl program regularly (daily)?
>
If it's on Unix, you should be able to use cron. On the Mac, there's a
cron clone. Can't speak for Win95/DOS.

 --- Joe M.


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

Date: Fri, 19 Jun 1998 11:37:08 -0400
From: "Michael D. Hofer" <featheredfrog@geocities.com>
Subject: Reading POD files in a browser...
Message-Id: <358A85A4.63D3@geocities.com>

This is a multi-part message in MIME format.

--------------5763C7524A3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

"installhtml" is okay if you have more disk than cycles...

Sorry if this is a duplicate, I posted this first on 6/17, but didn't
see it till yet!

-- 
Cian ua'Lochan /mka/ Michael D. Hofer
No Unsolicited Commercial Email: $500.00/Item for proofreading!
I'm not a medievalist - I just play one on weekends!
http://www.geocities.com/SoHo/Lofts/9800/

--------------5763C7524A3
Content-Type: text/plain; charset=us-ascii; name="message"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="message"

>From - Thu Jun 18 09:46:33 1998
Message-ID: <35891A39.6094@geocities.com>
Date: Thu, 18 Jun 1998 09:46:33 -0400
From: "Michael D. Hofer" <featheredfrog@geocities.com>
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
Newsgroups: comp.lang.perl.misc,comp.sources.unix
Subject: perl POD file browsing
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mozilla-Status: 0001
Content-Length: 2850

 ...so dere I wuz, see, wit no extra disk space and those seventeen CPAN
module-things wanting their pods converted to html and inserted in the
webspace...

I got tired of having to remember to add the pods to the html
structures, and of running out of disk, so I wrote the following, which
enables me to browse the perl install tree for pod files, in realtime -
no extra disk used up, no having to remember where I put 'em...

If you use it you're on your own.  Make sure pod2html is in the path
setting in the BEGIN block, and that $rootdir points to your top perl
install directory.   Jam this script into a convenient cgi-bin
directory.  Runs Okay on my Sparc 5.  Enjoy!
-- 
Cian ua'Lochan /mka/ Michael D. Hofer
No Unsolicited Commercial Email: $500.00/Item for proofreading!
I'm not a medievalist - I just play one on weekends!
http://www.geocities.com/SoHo/Lofts/9800/


#!/bin/perl 
# select and display a POD document via a browser
BEGIN {$ENV{'PATH'} = $ENV{'PATH'}.':/opt/perl5.004_04/bin';} # so we
can find pod2html

use strict;
use CGI qw(:all);

my $rootdir="/opt/perl5.004_04";
my ($subdir, $podfile);

my ($thisdir) = $rootdir;
$thisdir = param("thisdir") if param("thisdir");

print header, start_html(-title=>"Read a Pod, v2", -bgcolor=>"white");

if ($subdir = param("subdir")){ #changed the subdirectory
  $thisdir = "$thisdir/$subdir";
  display_form($thisdir);
}elsif  ($podfile = param("podfile")) { # got a podfile
  print `pod2html $thisdir/$podfile`;
}else{ #no results, do the first page...
  display_form($rootdir);
}

sub display_form{
  my ($formdir) = @_;
  my (@files, @pods, @subdirs);
  # what's in this directory?
  $thisdir=$formdir;
  opendir DIR, $formdir or die "Can't Open $formdir!!!:$!";
  @files = readdir DIR;
  closedir DIR;
  # identify subdirectories and podfiles
  foreach (@files) {
    my $fn = "$formdir/$_";
    push @subdirs, $_ if (-d $fn and $_ !~ /^\./);
    push @pods, $_ if (-f $fn and `egrep "^=head" $fn`);
  }

  #display the form...(yeah, it's really two, but with a single
callback...saves processing)
  print
    h1("Read a Pod, v3"),
    table(
      Tr( td({-align=>"right"},font({-size=>"+1"},strong("Current POD
Directory:"))),
	  td({-colspan=>"2"},$formdir)),
      Tr( startform,
	  input ({-type=>"hidden", -name=>'thisdir', -value=>$formdir}),
	  td({-align=>"right"},font({-size=>"+1"},strong("Select a
Subdirectory:"))),
	  td(popup_menu(-name=>"subdir", -values=>[@subdirs])),
	  td(submit(-value=>"Scan Subdirectory")),
	  endform),
      Tr( td({-align=>"center", -colspan=>"3"}, "or")),
      Tr( startform,
	  input ({-type=>"hidden", -name=>'thisdir', -value=>$formdir}),
	  td({-align=>"right"},font({-size=>"+1"},strong("Select a
PODFile:"))),
	  td(popup_menu(-name=>"podfile", -values=>[@pods])),
	  td(submit(-value=>"Read Podfile")),
	endform)
	  ),
	end_html;
}

--------------5763C7524A3--



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

Date: Tue, 23 Jun 1998 06:27:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Remove blank  too much lines from a text file
Message-Id: <MPG.ff94d231a1a6e539896ef@nntp.hpl.hp.com>

In article <358F9CC4.37E3E339@inlink.com>, Brent Michalski 
<perlguy@inlink.com> says...
> Ok Tom, I admin it isn't perfect, or even near it. 
> 
> BUT, it does work in the simplest cases.  

How can it 'work' if it doesn't even compile, regardless of the semantic 
error ("" instead of "\n")?  I doubt strongly that you tested it before 
posting.

print $_ OUTFILE if($_ ne "");

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


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

Date: Tue, 23 Jun 1998 12:49:51 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Remove blank  too much lines from a text file
Message-Id: <358F965F.BDC8D8EF@nortel.co.uk>

Michael Zehrer wrote:
> 
> Hi out there,
> 
> Beeing not a Perl- Pro I need some advice how I can remove blank lines
> from a text file or even reduce a number of blank lines too one. Like in
> this example:
> ------
 ... 
> ------

open THIS, "< /u/quednauf/temp/testfile.txt"  or die "Oops on this: $!";
open THAT, "> /u/quednauf/temp/testfile2.txt" or die "Oops on that: $!";
while (<THIS>) { print THAT unless /^\n/; }
close THIS;
close THAT;

The reg exp checks if there is a \n directly at the beginning of the line. If
you want to write back to the same file you could do a push array operation
instead of printing out the line, seek and truncate the file, and write the
array back.


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 23 Jun 1998 14:04:42 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Remove blank  too much lines from a text file
Message-Id: <358FB5FA.F4C41389@inlink.com>

You right, I'm wrong :-(  

It SHOULD be "\n".  I was running my fingers off this morning before I
was fully awake.

Alao, like Tom pointed out.  This will only work in the MOST basic
context.  The "\n" should really be tested for any number of whitespace
characters to make sure that you cover all possible situations...

Brent


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

Date: Tue, 23 Jun 1998 14:14:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Remove blank  too much lines from a text file
Message-Id: <Pine.GSO.3.96.980623071048.24075K-100000@user2.teleport.com>

On Tue, 23 Jun 1998, Brent Michalski wrote:

> open(INFILE,"$filename");

Those double quotes are merely misleading.

> open(OUTFILE,">$filename.out");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> while(<INFILE>){
>  print $_ OUTFILE if($_ ne "");
> }

I don't think that's at all what you meant.

> close;

Hmmm... At least five errors in six lines of code. I'm sure you can reach
100% if you try. :-) 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

Date: Tue, 23 Jun 1998 13:22:33 GMT
From: pverdret@sonovision-itep.fr
Subject: Re: RTF parsing
Message-Id: <6moa6p$8ba$1@nnrp1.dejanews.com>

In article <slrn6or072.6bq.mick@caladan.italpro.ddns.org>,
  mick@io.com (Michele Beltrame) wrote:
>
> Hallo!
>
> I need a Perl module or function to parse RTF (Rich Text Format) or on
> second choice MS WinWord DOC files. Also a RTF->HTML converter would
> be helpful. Any advice?
>
> 	TIA, Mickey.
>
> --
> Michele Beltrame
> mick@io.com
> http://www.italpro.com/mb/
>
I will send you a RTF parser written in Perl. This parser is not
documented, sorry!

I would appreciate to work with anyone to produce a Perl
module available on the CPAN. Send me a mail if interested.

Philippe


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 23 Jun 1998 13:22:21 GMT
From: pverdret@sonovision-itep.fr
Subject: Re: RTF parsing
Message-Id: <6moa6d$8b9$1@nnrp1.dejanews.com>

In article <slrn6or072.6bq.mick@caladan.italpro.ddns.org>,
  mick@io.com (Michele Beltrame) wrote:
>
> Hallo!
>
> I need a Perl module or function to parse RTF (Rich Text Format) or on
> second choice MS WinWord DOC files. Also a RTF->HTML converter would
> be helpful. Any advice?
>
> 	TIA, Mickey.
>
> --
> Michele Beltrame
> mick@io.com
> http://www.italpro.com/mb/
>
I will send you a RTF parser written in Perl. This parser is not
documented, sorry!

I would appreciate to work with anyone to produce a Perl
module available on the CPAN. Send me a mail if interested.

Philippe


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 23 Jun 1998 10:11:41 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Running commands
Message-Id: <358FB79A.56AF4AC0@newfangled.com>

Hehehhehehe..... I like your style Tom. :-)

Tom Phoenix wrote:

> On Tue, 16 Jun 1998, Azman Shariff wrote:
>
> > ---------------CODE---------------------
> >    $domain = "microsoft.com"
> >    $user = "billgates"
> >
> >    #Create User Directories
> >    ($shortdomain , $extension) = split( /./, $domain );
> >    @shellresult = `mkdir /virtual/$domain/home/$user`;
> >    @shellresult = `chmod 711 /virtual/$domain/home/$user`;
> > -------SNIP SNIP----------------------------------------
> >
> > what is wrong there? ......
>
> You left semicolons off of some statements, and you seem to have some
> algorithmic errors as well.
>
> > can i run a command thru perl codes? ....
>
> I don't know whether you can. I can. :-)
>
> > i think the double "`" would do the job rite?
>
> I'm not sure what the job rite is, :-)  but backticks are documented to be
> a way to run an external command and capture its standard output. Of
> course, perl has functions to create directories and set permission bits,
> so it's not necessary to run external programs if that's all you're doing.
>
> Hope this helps!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com

#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=(#####censored######)
-----------------------------------------------------------




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

Date: Tue, 23 Jun 1998 13:44:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Warnings from environment variables under -w
Message-Id: <Pine.GSO.3.96.980623064012.24075G-100000@user2.teleport.com>

On Mon, 22 Jun 1998, Larry Rosler wrote:

> > So, check to see if they are defined before you use them:
> > 
> >    if (defined $ENV{somevar}) {
> >      # do interesting stuff
> >    }
> >    else {
> >      # complain loudly
> >    }
> 
> Sorry, this 'defined' is not needed and has nothing to do with the 
> reported warnings.  

The reported "uninitialized value" warning does come from using some
variable which is undef; this species of defined() test may well be
appropriate and useful. Of course, the warning won't come from merely
using undef in a _boolean_ context, but that's certainly not the most
frequent context an environment variable will be found in. Hope this
helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 23 Jun 1998 10:12:56 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Weekdays <-> Dates
Message-Id: <358F7198.BACD5917@nortel.co.uk>

Hauk Langlo wrote:
> 
> Hi there. I'm about to make a program which needs to know which day of
> the week it is. I have a good idea about how to do it, but it feels like
> an unescesary amount of work. 

Use some module (eg Time::gmtime) which gives you the weekday, and use that
number to access an array which holds the written weekdays in the proper order.
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 23 Jun 1998 12:43:28 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: What "mini" database (text?) to use?
Message-Id: <slrn6ov8oo.1co.gabor@localhost.vmunix.com>

In comp.lang.perl.misc, Jonathan Bakke <bakke@earthlink.net> wrote :
# Kay
# 
# I am using MySQL which runs on a few different Unix platforms (and
# WindowsNT).  You can get it at www.mysql.com.  It comes with perl modules
# for connecting to the DB that require Perl 5.003 (you should use 5.004+).  I
# have a database with over 300,000 records and I get fairly good performance.
# I had an easy time installing it on RedHat Linux, just make sure you have
# current versions of the OS and Perl.  Good Luck.

I use Postgress 6.3.2 with DBI 0.97 and DBD::Pg 0.73.  Works fantastic.
Regardless of the database, use DBI.  It will make your life easier if
you need to switch databases. :)

# /jpb
# --
# -----
# Jonathan Bakke
# (703) 754-7034 [Voice]
# (703) 753-9343 [Fax - Call First]
# -----
# Zenin wrote in message <898493888.707321@thrush.omix.com>...
# >Kay Molkenthin <molkiheg@sp.zrz.tu-berlin.de> wrote:
# >: I just started with perl and wrote an adress book for my webserver.
# >: Because I want to learn more about perl I like to store the datas in a
# >: database, now I store them in a text file.
# >:
# >: For this project I only need a small database application. I heared of a
# >: text based perl database. What is the name and what do I need?
# >
# > Information on DBM style databases can be found via
# > perldoc AnyDBM_File
# >
# > If you want a text style database system with SQL style access,
# > check out the DBI system and the DBD::CSV driver, or the Sprite
# > module.  All available at CPAN.
# >
# >--
# >-Zenin
# > zenin@archive.rhps.org
# 
# 


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 2946
**************************************

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