[17746] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5166 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 20 21:10:32 2000

Date: Wed, 20 Dec 2000 18:10:13 -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: <977364613-v9-i5166@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 20 Dec 2000     Volume: 9 Number: 5166

Today's topics:
        Posting Guidelines for comp.lang.perl.misc ($Revision:  (Tad McClellan)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Jerome O'Neil)
    Re: problem with awk in perl script <Juha.Laiho@iki.fi>
    Re: qmail-inject <secursrver@hotmail.com>
        Simple Pattern Problem <stephen@virtual-attorney.com>
        Site Up Status robertf57@my-deja.com
        SSI in perl output <ng@fnmail.com>
    Re: String Parsing? <Juha.Laiho@iki.fi>
    Re: substrings - // question <Juha.Laiho@iki.fi>
    Re: switch/case in Perl? <cleon42@my-deja.com>
    Re: switch/case in Perl? (Tom Christiansen)
    Re: switch/case in Perl? (Abigail)
    Re: switch/case in Perl? (Abigail)
    Re: System Permissions <secursrver@hotmail.com>
    Re: using vi from within perl <carlywu@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Dec 2000 18:38:49 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.3 $)
Message-Id: <slrn942go9.3mb.tadmc@magna.metronet.com>


Here are the Posting Guidelines as they currently stand. 
Comments on its content are solicited.

If you made a comment, and I didn't argue against it, then it
should be included below. Please check to see if your particular
comment has been satisfactorily resolved. Lemme know if it hasn't.

There is no code for making an outline anymore, so one is
included in the post itself.

Major changes since the last posting (r0.1):

   link added for "Netiquette Guidelines"

   link added for ""Choosing Good Subject Lines""

   added bit about "Jeopardy" posting

   link added for quoting style guidelines

   "Do not post binaries, HTML, or MIME" section added

   

=====================================================================
=====================================================================
Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Do not expect people to do a machine's work
       - Do not type in Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 0.3 $)
    The comp.lang.perl.misc (clpmisc) Usenet newsgroup is for the discussion
    of using the Perl programming language.

    Since clpmisc is such a high-traffic newsgroup (more than 100 articles
    per day), there a number of measures that we all should take to keep the
    group useful for everyone.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. For
    more information about netiquette in general, see the "Netiquette
    Guidelines" at <URL:http://andrew2.andrew.cmu.edu/rfc/rfc1855.html>.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must

    This section describes things that you *must* do before posting to
    clpmisc.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    `Subject:' header.

  Really Really Should

    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        It is standard netiquette to monitor (lurk) a newsgroup for a few
        days or weeks before posting. By doing so you will be able to see
        what is socially acceptable in the newsgroup.

        You can "power lurk" by reading 20-30 posts a day for the last
        several days at a Usenet archive.

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is
        <URL:http://www.deja.com/home_ps.shtml>.

  If You Like

    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information, there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?

    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community

    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines"
        <URL:http://www.perl.com/CPAN-local/authors/Dean_Roehrich/subjects.p
        ost>

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* the sections of quoted text
        that your comments apply to. Failure to do this is called "Jeopardy"
        posting because the answer comes before the question.

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see
        <URL:http://www.geocities.com/nnqweb/nquote.html>.

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Do not expect people to do a machine's work
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not type in Perl code
        Use copy/paste or your editor's "import" function or something
        rather than attempting to type in your code. If you make a typo you
        will get followups about your typos instead of about the question
        you are trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid

    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similarly to your question, folks will
        assume that you did not look at all. Don't become indignant at
        pointers to the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@metronet.com>


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


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

Date: Thu, 21 Dec 2000 01:07:07 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.3 $)
Message-Id: <%Ic06.2537$lz1.436046@news.uswest.net>

tadmc@metronet.com (Tad McClellan) elucidates:
> 
> Here are the Posting Guidelines as they currently stand. 
> Comments on its content are solicited.

I don't quite know how to properly word my pet peeve, but I do the 
answer.

"Yes, Perl can probably do that."

It happens when someone posts a set of requirements, and then asks
"Can Perl do that?"

It drives me frickin nuts, making me spend hours counting to ten.

-- 
If men could learn from history, what lessons it might teach us!  But
passion and party blind our eyes, and the light which experience gives
is a lantern on the stern, which shines only on the waves behind us.
				--Samuel Taylor Coleridge, "Recollections"


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

Date: 20 Dec 2000 21:52:57 +0200
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: problem with awk in perl script
Message-Id: <91r2mp$aqu$1@ichaos.ichaos-int>

"Nikos Laoutaris" <laoutaris@di.uoa.gr> said:
>I have a problem with a rather simple awk command that i am issuing from
>inside a perl script using the system() call.
>
>The awk command is
>
>awk '{print $10,$1}' statdata.dat

Even though you can do that in awk, if you're already writing in perl,
I'd warmly suggest you to do that in perl, too:

open SD,'<statdata.dat' or die "Couldn't open statdata.dat: $!\n";
while (<SD>) {
	chomp;
	print join(' ',(split)[9,0]),"\n";
}
close SD;
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a- C++ UH++++$ UL++++ P+@ L+++ E(-) W+$@ N++ !K w !O
         !M V PS(+) PE Y+ PGP(+) t- 5? !X R tv--- b+ DI? D G e+ h--- r+++ y+
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Thu, 21 Dec 2000 00:15:40 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: qmail-inject
Message-Id: <MYb06.1147$Sc1.38179@newsread2.prod.itd.earthlink.net>

That may well be, Tad, but the exact error states that the error is at
qmail-inject.pl at line 100 regardless of which of my scripts causes it to
fail.  Obviously, there is either a Perl version of qmail or qmail contains
a Perl script. So again, I go back to asking if qmail is an open source
project of if there is any way of getting my hands on the source code.

I don't know about you guys, but I hate writing blindly to other programs.
That's why most of us got involved in Perl and Linux to begin with.
Tad McClellan <tadmc@metronet.com> wrote in message
news:slrn941mkd.2gn.tadmc@magna.metronet.com...
> Ed Grosvenor <secursrver@hotmail.com> wrote:
>
> >My hosting provider uses qmail-inject instead of sendmail.
>
> >every once in a great while, I get an error that reads "Use of
> >uninitialized value at line 100..."
>
>
> qmail is written in C. That is a _Perl_ warning message.
>
> The problem is in your Perl program, not in qmail-inject.
>
>
> >Well, that's great, except that the man
> >pages (which are all I can get my hands on it seems) don't exactly tell
you
> >what's at line 100.
>
>
> It is line 100 in your Perl program.
>
>
> >I follow the instructions and the error seems almost
> >arbitrary.
>
>
> The qmail instructions will not help with a Perl problem  :-)
>
>
> >So what I was wondering is if any of you knows where I might be able to
get
> >my hands on an actual real copy of qmail-inject.
>
>
>    www.qmail.org
>
> Surprise!
>
>
> >my searches for the
> >source have proven fruitless.
>
>
> Google finds over a hundred hits for both "qmail" and "qmail-inject".
>
> Did your "search" include trying a search engine?
>
>
> >I would really appreciate any help on this
> >one.
>
>
> We would need to see the Perl code to help with the Perl problem.
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas
>




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

Date: Wed, 20 Dec 2000 18:29:36 -0600
From: Stephen Hargrove <stephen@virtual-attorney.com>
Subject: Simple Pattern Problem
Message-Id: <3A414EF0.C07E8B8A@virtual-attorney.com>

i think i'm finally going blind, because i have a very simple pattern
matching problem and i can't seem to locate the error.  basically, the
following program should recursively traverse a directory structure.
when i locates a file ending in .mp3, it should branch to the subroutine
and process the song with the MPEG::MP3Info module.   Following the
source code is a sample listing of the output.  As you can see, it's
failing on the pattern match for .mp3 and is considering everything a
directory.

can someone PLEASE show me where i'm missing the boat on this.  i've
been chasing this problem for hours now, and simply cannot see what's
going wrong.  (btw, if someone has a piece of code which does what i'm
trying to do, i'm not above begging for it.)

thanks!



#!/usr/bin/perl

use MPEG::MP3Info;

$rootDir= "/music/mp3/";

open (INF, ">/home/Stephen/perl/output");
open (SQL, ">/home/Stephen/perl/insert.sql");

sub processSong {
        $Test = $TreeDir . '/' . $Mp3;

        $tag = get_mp3tag($Test);
        $x = 0;
        for (keys %$tag) {
                $x++;
                if ($x == 1) {
                        print SQL "*******************\n";
                        printf SQL "Album: %s\n", $tag->{$_};
                }
                elsif ($x == 2) {
                        printf SQL "Year: %s\n", $tag->{$_};
                }
                elsif ($x == 3) {
                        printf SQL "Type: %s\n", $tag->{$_};
                }
                elsif ($x == 4) {
                        printf SQL "Song: %s\n", $tag->{$_};
                }
                elsif ($x == 5) {
                        printf SQL "Rip: %s\n", $tag->{$_};
                }
                elsif ($x == 6) {
                        printf SQL "Song No.: %s\n", $tag->{$_};
                }
                elsif ($x == 7) {
                        printf SQL "Group: %s\n", $tag->{$_};
                }
        }
}

@songList = `ls -R $rootDir`;
foreach $Song (@songList) {
        next if $Song =~ /^\./;                 # skip . files (. ..
 .bashrc etc)
        next if $Song =~ /m3u/;                 # skip m3u files
        $Mp3 = chop($Song);
        print INF "found $Song ";
        if ($Mp3 =~ /\.mp3/i) {                       # we have a .mp3
                print INF "which is an MP3\n";
                processSong();
        }
        else {
                print INF "which is a directory\n";
                ($TreeDir) = split(/:/, $Mp3);
        }
}



SAMPLE OUTPUT for INF:

found /music/mp3/4 non blondes: which is a directory
found 4 Non Blondes - Bigger, Better, Faster, More which is a directory
found  which is a directory
found /music/mp3/4 non blondes/4 Non Blondes - Bigger, Better, Faster,
More: which is a directory
found 01 Train.mp3 which is a directory
found 02 Superfly.mp3 which is a directory
found 03 What's Up.mp3 which is a directory
found 04 Pleasantly Blue.mp3 which is a directory
found 05 Morphine & Chocolate.mp3 which is a directory
found 06 Spaceman.mp3 which is a directory
found 07 Old Mr Heffer.mp3 which is a directory
found 08 Calling All The People.mp3 which is a directory
found 09 Dear Mr President.mp3 which is a directory
found 10 Drifting.mp3 which is a directory
found 11 No Place Like Home.mp3 which is a directory

SAMPLE OUTPUT for SQL
<empty file>
--
steve



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

Date: Thu, 21 Dec 2000 00:34:12 GMT
From: robertf57@my-deja.com
Subject: Site Up Status
Message-Id: <91rj64$169$1@nnrp1.deja.com>

Can anyone recommend a publicly available Perl script that will monitor
a website's (up) status and page the admin if it goes down?  Thanks.


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 20 Dec 2000 18:35:59 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: SSI in perl output
Message-Id: <91rj10$le6$1@info1.fnal.gov>

Is there a way to put a SSI include directive into the output of a perl
script and have the server interpret it as a shtml?

--
Enrico Ng <ng@fnmail.com>




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

Date: 20 Dec 2000 20:22:01 +0200
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: String Parsing?
Message-Id: <91qtc9$amf$1@ichaos.ichaos-int>

spcman@my-deja.com said:
>Anyone have a one-liner to check to make sure a string consists of only
>az-AZ-0-9 (Letters, Numbers) NO CHARACTERS!

Match anything not contained in that list, as in

if ($s =~ m/[^a-zA-Z0-9]/) {
	print("Not ok");
} else {
	print ("Ok");
}
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a- C++ UH++++$ UL++++ P+@ L+++ E(-) W+$@ N++ !K w !O
         !M V PS(+) PE Y+ PGP(+) t- 5? !X R tv--- b+ DI? D G e+ h--- r+++ y+
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: 20 Dec 2000 19:09:04 +0200
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: substrings - // question
Message-Id: <91qp3g$add$1@ichaos.ichaos-int>

japhy@pobox.com said:
>On Dec 18, Adam Levenstein said:
>>USER:username
>>
>>followed by a newline, and the username is of varying lengths. I'm
>>trying to get the username and put it into $user. Here's the line I've
>>been using, but doesn't seem to work:
>>
>>$user = "VALUE=\"" . ($data[3] =~ /USER:\S{1,}\n$/) . "\"";
>
>A regex in scalar context returns success.  Perhaps you meant:
>
>  $user = 'VALUE="' . ($data[3] =~ /USER:(.+)/)[0] . '"';
>
>First, I changed \S{1,} to .+, since . won't match \n by default.  And I
>put ()'s around it so that we would save what matched there.  Then, I took
>subscript 0 of the list returned by the regex (effectively getting $1).

Just another solution, albeit with slightly changed functionality.

($user = $data[3]) =~ s/^USER:(.*?)\s*\n/VALUE="$1"/;

Difference to the original is that this will allow usernames that contain
whitespace characters (which may or may not be a good idea). Difference
to japhy's solution is that this will strip off any whitespace that exist
just before the newline (of course there shouldn't be any, but mistakes
happen). This also handles case "USER:\n" by translating that to VALUE=""
without producing a warning about uninitialized variables.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a- C++ UH++++$ UL++++ P+@ L+++ E(-) W+$@ N++ !K w !O
         !M V PS(+) PE Y+ PGP(+) t- 5? !X R tv--- b+ DI? D G e+ h--- r+++ y+
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Wed, 20 Dec 2000 23:35:56 GMT
From: Adam Levenstein <cleon42@my-deja.com>
Subject: Re: switch/case in Perl?
Message-Id: <91rfor$ucr$1@nnrp1.deja.com>

In article <slrn9424un.3cd.tadmc@magna.metronet.com>,
  tadmc@metronet.com (Tad McClellan) wrote:

> And now that you have displayed the attitude that it is OK to
> re-ask FAQs, the chances of your getting help with future Perl
> problems has been diminished. I hope your venting was worth
> the trade-off you have made.

As opposed to displaying the attitude that only people who find what
they're looking for the in FAQ (I did look, believe it or not - and I
bet "not") are worthy to post without rude response?

Obviously the chances of my getting help weren't diminished, or I
wouldn't have received several polite answers. As for venting - well,
yeah, I guess to you, only I was venting - not the guy who went on the
rant in the first place about kilfiling my-deja.com.

Here's a suggestion: Why not re-work the FAQ to make things easier to
find? A search function would be nice, for example. "parts 0 1 2 3 4 5
6 7 8 9" is fairly indescriptive.

Or, on the other hand, you could just "plonk" everyone who takes
offense at Mr. Manners' responses.

--
-------------------------------------------------
Adam Levenstein
cleon42@my-deja.com

"Extraordinary claims require extraordinary evidence."
				-- Carl Sagan


Sent via Deja.com
http://www.deja.com/


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

Date: 20 Dec 2000 17:28:14 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: switch/case in Perl?
Message-Id: <3a414e9e@cs.colorado.edu>

In article <91rfor$ucr$1@nnrp1.deja.com>,
Adam Levenstein  <cleon42@my-deja.com> wrote:

>As opposed to displaying the attitude that only people who find what
>they're looking for the in FAQ (I did look, believe it or not - and I
>bet "not") are worthy to post without rude response?

Ok, fine: since you've asked so nicely, let us therefore believe
you.  We'll assume you're telling the truth, ok?  Fine.  Now, given
that assumption, the only fair inference is that you would have us
believe that although you plainly lack the most basic level of
minimal competence needed to perform a trivial text search on a
text file, that you would somehow benefit from technical assistance?

Is that what you're really asking? 

Anyone who cannot trivially figure out how to search a simple text
file has no business imitating a programmer, and should instead
hire someone who can.

>Obviously the chances of my getting help weren't diminished, or I
>wouldn't have received several polite answers. As for venting - well,
>yeah, I guess to you, only I was venting - not the guy who went on the
>rant in the first place about kilfiling my-deja.com.

The "guy who went on the rant" when he told you to RTFM, as you
doubtless have thus far failed to notice, just so happens to be the
guy who *wrote* you that FAQ, buster.  I didn't do it so you could
ignore it.  And your notion of rant is hilarious.  *THAT* was not
a rant.  However, we're now getting a lot closer.  Keep embarrassing
yourself with more postings about inability to read, and perhaps
more people will join in.

>Here's a suggestion: Why not re-work the FAQ to make things easier to
>find? A search function would be nice, for example. "parts 0 1 2 3 4 5
>6 7 8 9" is fairly indescriptive.

I can see you haven't read the perlrtfm manpage posted to this group
some time back.  I strongly suggest you do so.  

What *are* you talking about?  Do explain what it can possibly mean
to "add search functions to a text file".  

--tom


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

Date: 21 Dec 2000 00:33:10 GMT
From: abigail@foad.org (Abigail)
Subject: Re: switch/case in Perl?
Message-Id: <slrn942ju6.la8.abigail@tsathoggua.rlyeh.net>

Tom Christiansen (tchrist@perl.com) wrote on MMDCLXVIII September
MCMXCIII in <URL:news:3a410424@cs.colorado.edu>:
`` 
`` --tom, who's convinced he should globally killfile my-deja for
``        fricking ever.


I've had my-deja in my kill file for years. One of the best features
of my killfile.

Here's my section that deals with domains.

% Domains to ignore.
[*]
Score:: -9999
  From: @aol\.com\.invalid
  From: cd-online\.nl
  From: compuserve\.com
  From: demon\.nl
  From: enteract\.com
  From: my-deja\.com
  From: my-dejanews\.com
  From: @hobsonsquare\.com
  From: hotmail\.com
  From: worldaccess\.nl
  From: worldonline\.nl
  Message-ID: deja\.com
  NNTP-Posting-Host: dejanews\.com
  NNTP-Posting-Host: worldonline\.nl
  Organization: Newsfeeds\.com
  X-MyDeja-Info: .
  X-DejaID: .



Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT


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

Date: 21 Dec 2000 00:42:33 GMT
From: abigail@foad.org (Abigail)
Subject: Re: switch/case in Perl?
Message-Id: <slrn942kfp.la8.abigail@tsathoggua.rlyeh.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDCLXVIII September
MCMXCIII in <URL:news:ura24tkgasil7hkvn1l8rg4vpr8i5o3t6l@4ax.com>:
!! Andrew N McGuire wrote:
!! 
!! >> And yeah - I never understood why Richie put the "break" in there.
!! 
!! >  Well, you may want to have a default case.  If you decide
!! >in your switch that a default case is necessary, then you
!! >must use a break in case you have a case where you do not
!! >want to fall through to the default case.
!! >
!! >  Of course one could argue that you never need a default
!! >case
!! 
!! Nope. You should never need to "fall through". That is like an "if"
!! statement, where you do the "else" part as well.


Actually, it's more like:

    if ($x > 10) {
	# Do this
    }
    if ($x >  5) {
	# Do this too
    }

For $x == 11, both parts are done. For $x == 4, none of them are done.

While I agree that the use of break isn't always very handy, I don't
see a better way to do "fall through" in a clean way. Now, whether
"fall through" is acceptable programming is another debate. But the
decision was made for C (and hence for many other languages). I don't
think I would want to miss it from C.

Oh, and for those not wanting to type 'break' in C:

    # define Case      break; case
    # define Default   break; default


Abigail
-- 
BEGIN {$^H {q} = sub {pop and pop and print pop}; $^H = 2**4.2**12}
"Just "; "another "; "Perl "; "Hacker\n";


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

Date: Thu, 21 Dec 2000 00:23:06 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: System Permissions
Message-Id: <K3c06.1205$Sc1.42812@newsread2.prod.itd.earthlink.net>

I might just be talking out my *** here, but the way I would approach this
would be to have the Perl script write the data to a flat file and then have
the script run a shell script through a system command.  The shell script
could then open the flat file and use the contents to add the user.

Good luck!
Marcus <coz@paston.co.uk> wrote in message
news:91qicq$pb6$1@reader-00.news.insnet.cw.net...
> I also want to write some form of CGI system administrator i.e a web form
> where you enter the username, shell, group and comment and the form calls
a
> script that runs a useradd with these params, (Sun Solaris Server)
>
> The trouble is that a script called by the web server has all the
> permissions of a fly walking around on top of the server case !!!
>
> Any ideas ??
>
> Mark
>
>




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

Date: Thu, 21 Dec 2000 10:39:01 +1100
From: "Carl Wu" <carlywu@yahoo.com>
Subject: Re: using vi from within perl
Message-Id: <3a41424b$0$7514$7f31c96c@news01.syd.optusnet.com.au>

There are fundamental differences between these two commands:
1. $status = `vi $filename`;
2. $status = system("vi $filename");

In the first command, the $status will get the standard output of the
command "vi $filename". And the vi process will get the standard input (your
keyboard) from its parent process ("perl"), but its standard output has been
redirected to some system area to be assigned to $status variable of your
program. So you can type any command to the vi process but you won't see
anything from vi until you quit vi, after that if you print $status from
perl program you will see what you should have seen with a normal vi.

In the second command, the $status will get the exit status of the command
"vi $filename". And the vi process will inherite both standard input (your
keyboard) and standart output (your monitor) from its parent process
("perl"), the vi works fine. And the $status will be an integer which is the
exit status of vi, completely different with the first case.

Hope this helps.

Carl Wu

David Hiskiyahu wrote in message <3A40F8F2.D57D2DCD@alcatel.be>...
>...
>> > I know that this is not good practice but though that I would be able
>> > to do the following:
>> >
>> >    $status = `vi $filename`  ;
>> >
>> > However, this seems to put me in vi mode, but the screen stays as it
>> > is until I exit vi, I cannot see the file contents.
>...
>
>mike_solomon@lineone.net wrote:
>>
>> try:
>>
>> system("vi filename");
>>
>> this will open the file to edit
>>
>> when you exit vi it will return you to the script
>>
>...
>
>Mike, any clue why 'system' works ok here while the backticks fails?
>
>I wonder if there is some written info on the difference between the two,
>which most of time behave just the same.
>
>I can guess that 'system' causes the perl parent process to fork a child
>process and wait for it to exit, while backticks probably runs the system
>command under the same process, which must mess up the i/o, which must be
>the reason for backticks failing to show the vi window.
>
>'%man perlfunc' in the section of 'system' does clearly say that 'system'
>forks a child and waits, but I couldn't find a clear description of how
>backticks work ...




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 5166
**************************************


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