[18353] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 521 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 18 21:05:47 2001

Date: Sun, 18 Mar 2001 18:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984967507-v10-i521@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 18 Mar 2001     Volume: 10 Number: 521

Today's topics:
    Re: (OFF TOPIC - IGNORE) Re: Beginners question please  <principle@seekasonic.com>
    Re: Funny regular expression problem <Juha.Laiho@iki.fi>
    Re: Guidance on printed output <klessa@airmail.net>
    Re: Guidance on printed output <bart.lateur@skynet.be>
        Print "tar" Success or Failure (BUCK NAKED1)
    Re: Print "tar" Success or Failure <bart.lateur@skynet.be>
    Re: Print "tar" Success or Failure (Garry Williams)
    Re: Status: 403 Forbidden <peter.sundstrom-eds@eds.com>
    Re: way to check a pop3 mailbox without using additiona <peter.sundstrom-eds@eds.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 18 Mar 2001 23:44:03 +0000
From: Principle <principle@seekasonic.com>
Subject: Re: (OFF TOPIC - IGNORE) Re: Beginners question please help on the verge    of throwing PC out the    window
Message-Id: <9vhabtc1km5hk15u94es7mg79997nff7jo@4ax.com>

And your point is...

Maybe you have heard the dyslexia story before because its true any
way none of this has anything to do with perl why did you start the
topic in the first place I mean here's every one getting alone quite
nicely, iv had my question answered by some very helpful ppl and here
you are posting useless personal commentary about me why?

I don't know but more to the point I don't care if you want to talk
about me personally do it via email no need to try and embarrass me or
any one else in public, if you have an off topic point to make no need
to inflict your opinion on the entire group.

O ya and btw I never said I could speak Russian just said id be happy
to continue the discussion in it, I may have inferred I could but I
never directly said so someone of your towering intellect should have
picked up on that in fact I wish you would continue this discussion in
Russian if for no other reason than most of the rest of us would not
have to listen to you waffle on about what you perceive to be other
peoples problems.

Any other personal comments you have about me should be directed at my
email unless of course you would like to actually help with my problem
but then I suspect helping people out is a bit beneath someone like
you.

Just one more point there are many different forms of dyslexia my own
test many moons ago took more than 7 hours are you seriously trying to
tell me you can diagnose dyslexic by simply reading a few pages of
what they have typed?



On Sun, 18 Mar 2001 14:59:40 -0800, Kira <callgirl@la.znet.com> wrote:

>Principle wrote:
> 
>(lots of snippage)
>
>> Well Godzilla! just to sate you curiosity I'm dyslexic....
>
>While earning my Masters degree and earning my Teaching
>Credentials, both primary and secondary, there is a
>requirement is to be met by all California trained
>teachers, one requirement of numerous very rigorous
>requirements. All California teachers must attend a
>lengthy series of classes, a two year post-grad course,
>which includes extensive studies of student related
>illnesses, both physical and mental. Appropriately,
>this course of study includes dyslexia. Over my many
>years as an English and Science teacher, as a Professor
>of English, I have developed quite a talent for spotting
>those suffering dyslexia and, spotting those whom are not.
>
>Incidently, I have read your dyslexia story before,
>virtually word-for-word. However, different author.
>Women, like elephants, have large hips, an equally
>large memory and often prove to be just as nosey.
>
>
>> ...like to continue this discussion in Russian....
>
>My system is not enabled for Russian Cyrillic characters,
>nor is yours. I've also read this "I speak Russian" story
>before, a number of times.
>
>Je parlerais plutôt français, si vous ne vous occupez pas. 
>Cependant, je parlerais plutôt avec une personne honnête.
>
>
>> ...but lets be honest what other reason could there
>> possibility be.
>
>* laughs *
>
>
>Godzilla!



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

Date: 18 Mar 2001 14:17:48 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Funny regular expression problem
Message-Id: <992g2c$hge$1@ichaos.ichaos-int>

"Steve D. Perkins" <steve@NOSPAM.hotmail.com> said:
>    I've been trying to bug-fix someone's script that parses a
>configuration file line by line,
>storing information from three columns into three different arrays.  The
>format of the file is
>like this:
>
>#  Lines beginning with pound-signs are considered comments and ignored
>#  First column is a 2-to-4 character alphanumeric system code
>#  Second column is an initialization string enclosed in double-quotes
>#  Third colum is comma-delimited list of divisions within the system
>that use this string
>#  ...(can be asterisk to represent ALL systems)
>#  Columns can be seperated by tabs or spaces
>D1   "DUMMY-INITIALIZATION-STRING"   123,456
>D1   "DUMMY-INITIALIZATION-STRING-FOR-789"   789
>D2   "DUMMY-INIT-4-ALL-WITHIN-D2"   *

I think others have provided adequate analysis already, but I haven't
seen complete solutions yet (if the quoted section doesn't contain
whitespace, split is ok; if the quotes section can contain whitespace,
then I think the below RE should work better).

($first,$second,$third)=m/^(\w{2,4})\s+"(.*?)"\s+(.*)/;

So, the above will match (from variable $_):
- 2-4 "word characters" from the beginning of line; will be stored to $first;
  "word characters" are alphanumeric and _
- one or more whitespace, followed by " (this part will not be stored)
- whatever, until the next "-character; will be stored to $second
  (actually, the terminator is " followed by whitespace, so even
   embedded "-characters would be ok as long as they are not followed
   by whitespace. Writing the third part of the RE more carefully would
   permit even this condition)
- "-character followed by one or more whitespace (again, not stored)
- the rest of the line will be stored to $third

It is assumed here that you've already chomp()ed the input line; if not,
the third field will be terminated with "newline", which may cause
confusion later on.


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

Date: Sun, 18 Mar 2001 17:47:23 -0600
From: "Kathy" <klessa@airmail.net>
Subject: Re: Guidance on printed output
Message-Id: <2C3884474D54885C.6F6CD2D40CA5F186.78C216E0AF935039@lp.airnews.net>

Thanks for the response, and my apologies for the huge delay, I experienced
some system interruptions which impacted my news access.

What I have basically is a plain-text file of a phone directory, one line
per record, comma-delimited.  Initially all that was required was a
web-based query and search of the directory listing, but now they want a
printed directory from this file.  So what I want to be able to do is read
in this directory file, and output a 'phone book' in double-column format.
Basically, name, address, phone number information (so multiple lines for
each entry), and some entries have two or three extra lines of information
to display as well.

I can certainly use perl format strings to format stuff into columns, that's
easy enough, but to basically have an output look like this:
------------
PAGEHEADER INFORMATION

name1                                                              name4
address1                                                          address4
city1 state1 zip1                                               city4 state4
zip4
phone1
otherinfo1                                                         name5

address5
name2                                                              city5
state5 zip5
address2
city2 state2 zip2                                                name6

address6
name3                                                              city6
state6 zip6
address3                                                          phone6
city3 state3 zip3
add'itionalinfo 6
phone3

PAGEFOOTER INFORMATION (page number, date, etc.)
----------------
is something I don't see how to do.  I've already resolved the problem with
a (very kludgy) creation of html output which is then printed out, but for
curiosity's sake, I'd love to know how to do this 'a better way' since html
output that's printed CERTAINLY isn't good.

Hmmm... which cookbook do you mean?  I have Patchett & Wright's CGI/Perl
Cookbook, but I don't see a 4.18 recipe.  If it's a disk reference, my CD
was broken when I bought it and I never did get around to returning it for a
good one (darn it).

Thanks again for your response,

Kathy

"Michael Carman" <mjcarman@home.com> wrote in message
news:3A9ECC81.D1C2795A@home.com...
> As in the Perl format/write syntax? Yes, you can do columns. See the
> perlform manpage.
>
> What do you mean by columns anyway? Do you mean that if you had a list
> (1..10) you'd print it like this?
>
> 1 4 7
> 2 5 8
> 3 6 9
>
> If so, then buy/beg/borrow a copy of the Cookbook and look at recipe
> 4.18.
>
> And of course, there's always [s]printf().
>
> Tell us what the input and output should look like, and it making Perl
> format it nicely becomes a trivial problem.
>
> -mjc




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

Date: Mon, 19 Mar 2001 00:16:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Guidance on printed output
Message-Id: <bpjabt8l6smgeh5uhiucuta660va8l012u@4ax.com>

Kathy wrote:

>I've already resolved the problem with
>a (very kludgy) creation of html output which is then printed out, but for
>curiosity's sake, I'd love to know how to do this 'a better way' since html
>output that's printed CERTAINLY isn't good.

FWIW, I've been told there are some excellent modules for generating PDF
directly in Perl. When printed, they sure beat some primitive fixed font
formatting in plain Ascii, which may have been acceptable until  the
seventies.

Hmmm... does anybody here know what PDF module that would be?

-- 
	Bart.


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

Date: Sun, 18 Mar 2001 17:59:53 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Print "tar" Success or Failure
Message-Id: <20088-3AB54BF9-10@storefull-243.iap.bryant.webtv.net>

How do you print your own success or failure message with the "tar"
command?

I've tried...  
if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")==0) {
print "SUCCESS";
}
else {print "FAILURE";
};
 ..and this doesn't work. Why?

Yes, I learned some things about this from an earlier thread, but the
examples given

system("tar -zxf file.tar.gz") && die 
"FAILURE";    or     
 
!(system("tar -zxf file.tar.gz")) || die 
"FAILURE"; 

 ...didn't work. Anyway, I also need the script to print a message
whether tar is successful or fails.

Further help would sincerely be appreciated.

--Dennis



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

Date: Mon, 19 Mar 2001 00:56:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Print "tar" Success or Failure
Message-Id: <r8mabt0kgql8ck7vffgrs6hlguiokjhet4@4ax.com>

BUCK NAKED1 wrote:

>I've tried...  
>if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")==0) {
>print "SUCCESS";
>}
>else {print "FAILURE";
>};
>..and this doesn't work. Why?

Probably because this tar doesn't return a proper exit value.

But why are you using system()? What is the output from tar to STDOUT
good for? Wouldn't it be better to capture it, by using backticks ("`")
instead of system(), and parsing tar's textual output? Plus, the user
need never see it.

-- 
	Bart.


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

Date: Mon, 19 Mar 2001 01:36:17 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9baokg.dap.garry@zfw.zvolve.net>

On Sun, 18 Mar 2001 17:59:53 -0600 (CST), BUCK NAKED1
<dennis100@webtv.net> wrote:

> How do you print your own success or failure message with the "tar"
> command?
> 
> I've tried...  
> if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")==0) {
> print "SUCCESS";
> }
> else {print "FAILURE";
> };
> ..and this doesn't work. Why?

No clue.  What does "doesn't work" mean?  

> Yes, I learned some things about this from an earlier thread, but the
> examples given
> 
> system("tar -zxf file.tar.gz") && die 
> "FAILURE";    or     
>  
> !(system("tar -zxf file.tar.gz")) || die 
> "FAILURE"; 
> 
>  ...didn't work. 

What does "didn't work" mean?  

>Anyway, I also need the script to print a message
> whether tar is successful or fails.
> 
> Further help would sincerely be appreciated.

Further code would be appreciated.  

Why not post the code (cut and pasted) you're having a problem with
and the results you expected and the results you got?  Wouldn't that
make a lot more sense?  Please try to trim the code to just the
relevant parts that we need to duplicate the problem.  

-- 
Garry Williams


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

Date: Mon, 19 Mar 2001 12:10:16 +1200
From: "Peter Sundstrom" <peter.sundstrom-eds@eds.com>
Subject: Re: Status: 403 Forbidden
Message-Id: <993ipl$4mf$1@hermes.nz.eds.com>


"In off the Post" <pbm@NOSPAMiotp.demon.co.uk> wrote in message
news:gHVqFCAeLzs6Ewkx@iotp.demon.co.uk...
> I need to send a 403 HTTP header, which will then be handled by an
> Apache ErrorDocument (which works) which will re-direct the user to a
> specified page.
>
> Why doesn't this perl script work?
>
> print "Status: 403 Forbidden\n\n";

For exactly the same reason as this shell script "won't work"

#!/bin/sh
echo "Status: 403 Forbidden\n\n"

or this C program "won't work"

int main()
{
  printf("Status: 403 Forbidden\n\n");
}

See a pattern here?  ie: not related to Perl as you will get the same
results for whatever language you write it in.




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

Date: Mon, 19 Mar 2001 12:26:28 +1200
From: "Peter Sundstrom" <peter.sundstrom-eds@eds.com>
Subject: Re: way to check a pop3 mailbox without using additional modules?
Message-Id: <993jo0$699$1@hermes.nz.eds.com>


"Paul" <paulthomson@hotmail.com> wrote in message
news:3ab3d941@news1.homechoice.co.uk...
> Hi,
>
> Does anyone know of a way to check a pop3 mailbox without using additional
> modules to the basic perl 5 installation? The reason I ask is my isp makes
a
> hideous charge for installing modules :(

Then install the module yourself and save your money.

perldoc -q module/library




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 521
**************************************


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