[18336] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 504 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 16 14:06:57 2001

Date: Fri, 16 Mar 2001 11:05:29 -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: <984769529-v10-i504@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 16 Mar 2001     Volume: 10 Number: 504

Today's topics:
        -w and use strict; <lmoran@wtsg.com>
    Re: @a->[8] vs. $a[8] <mischief@velma.motion.net>
        [OT] GNU tar syntax (was: Create .tar.gz with Perl?) nobull@mail.com
    Re: `pwd` doesn't work on all servers? <bsugars@canoe.ca>
    Re: `pwd` doesn't work on all servers? <mischief@velma.motion.net>
    Re: `pwd` doesn't work on all servers? <bsugars@canoe.ca>
    Re: ANNOUNCE: Math::MatrixReal::Ext1 (Ilya Zakharevich)
        chomp not chomping? (Jim Kroger)
    Re: Copy/Paste using Perl? (LK)
    Re: Create .tar.gz with Perl? <aqumsieh@hyperchip.com>
        dbmopen-Error <SiStie@nuclear-network.com>
    Re: dbmopen-Error <jhall@ifxonline.com>
        Doesnt work <kalle@tvettsvamp.a.se>
    Re: Doesnt work (John Joseph Trammell)
    Re: Doesnt work <godzilla@stomp.stomp.tokyo>
    Re: Doesnt work <joe+usenet@sunstarsys.com>
    Re: Doesnt work <lmoran@wtsg.com>
    Re: Doesnt work <Steve_Alpert@idx.com>
    Re: Doesnt work <godzilla@stomp.stomp.tokyo>
    Re: Excute Script 2 <mischief@velma.motion.net>
    Re: FAQ 7.12:   What's a closure? (Greg Bacon)
        Funny regular expression problem <steve@NOSPAM.hotmail.com>
    Re: Getopt::Std swallows argument even if ":" not speci (LMC)
        Godzilla! Do you please your ego by insulting people. Y <kalle@tvettsvamp.a.se>
    Re: How to Print "system" failure ...was <Print own "di (BUCK NAKED1)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 16 Mar 2001 13:09:38 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: -w and use strict;
Message-Id: <6qk4bts77a8furbo94o6t0u0pv9pkc5tfl@4ax.com>

--Since I have been Learning Perl and Programming Perl I have always
started my thinga-ma-bobs (since I'm not too sure if I am scripting or
programming) with:

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

even when I do the coding in WIN32.  I recently came across a pretty
good book WIN32 Perl Scripting : The Administrator's Handbook (New
Riders (Roth)) that NEVER uses either the -w or use strict;.

Now this book in no way attempts to teach Perl.  It is sort of a Perl
Cookbook for Win32 Sys Admins.  I have seen hundreds of examples of
Perl scripts w/o -w or use strict; and the scripts work fine.  This
book is no different.  Everything works as expected (with local
adjustments, etc) in the book as well.  Apparently the author, Dave
Roth, is Perl Module writer so I assume he knows all about -w and use
strict; but has chosen not to use those (insert word for shebang,
switch, use thingy) in his Perl examples.

My questions are:

Do you remove those once your script works as expected and is unlikely
to be changed?  

Does it make the script faster not to have those up top?

Are there good reasons not to use those things?


 


--
Member of the Nondeterministic Football League


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

Date: Fri, 16 Mar 2001 17:19:16 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: @a->[8] vs. $a[8]
Message-Id: <tb4iok371tjd61@corp.supernews.com>

Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Chris" == Chris Stith <mischief@velma.motion.net> writes:

> Chris> Wouldn't it be more like ${\@a}[4]? At least I understand where those
> Chris> values come from better than I understand your example.

> Uh, yeah.  Precisely:

>     ${ FOO } [ 4 ]

> is the same as

>     ( FOO ) -> [ 4 ]

> And for certain FOO's, you can leave off the parens and/or curly braces
> (though not the same FOO's :).

Okay, I understand all that now. I guess my question was more how
you came up with the `27', but that's just @a in scalar context.
So the arrow is supposed to give its lhs scalar context and in this
case does not? Is that really a bug or just poorly documented DWIM?

Chris

-- 
Christopher E. Stith
Parking for people we like only. All other vehicles will be vandalized.



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

Date: 16 Mar 2001 18:40:35 +0000
From: nobull@mail.com
Subject: [OT] GNU tar syntax (was: Create .tar.gz with Perl?)
Message-Id: <u9lmq5d0bg.fsf_-_@wcl-l.bham.ac.uk>

trammell@bayazid.hypersloth.net (John Joseph Trammell) writes
off-topic and off-base:

> On Fri, 16 Mar 2001 06:15:28 -0700, bowman <bowman@montana.com> wrote:
> > tar -czf foo.tgz  *
> 
> s/-//

OT but the hyphen _should_ be there for GNU tar.

If these's no hyphen on the first argument then for the sake of
backward compatibility GNU tar parses the command line options using
the braindead 'traditional' tar syntax.  In this backward
compatibility mode long options, and hense any GNU extensions that
have no short option switch are unavailable.

If there is a hyphen then GNU tar uses the usual getopts_long()
syntax.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 16 Mar 2001 16:15:19 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
Subject: Re: `pwd` doesn't work on all servers?
Message-Id: <Pine.LNX.4.21.0103161117490.1932-100000@marmot.rim.canoe.ca>


On Fri, 16 Mar 2001, John A. Grant wrote:

>     "Can't exec "pwd": No such file or directory at
> /usr/local/lib/perl5/5.6.0/Cwd.pm

You could try chomp($cwd = `/bin/pwd`).

Cheers,
-Ben

-- 
signer: can't create ~/.sig: Protocol wrong type for socket



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

Date: Fri, 16 Mar 2001 17:15:57 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: `pwd` doesn't work on all servers?
Message-Id: <tb4iid67h1uie1@corp.supernews.com>

Benjamin Sugars <bsugars@canoe.ca> wrote:

> On Thu, 15 Mar 2001, John W. Krahn wrote:

>> "John A. Grant" wrote:
>> > 
>> > Is there a way to look up the cwd internally without capturing
>> > the output of `pwd` from the system?
>> 
>> perldoc Cwd
>> 
>> SYNOPSIS
>>            use Cwd;
>>            $dir = cwd;

> I think Cwd::cwd actually uses `pwd` internally on Unix systems.

It does, but that's not as portable. If you know your program
will never run anywhere else, then that could work.

Chris

-- 
Christopher E. Stith
You can never entirely stop being what you once were. That's
why it's important to be the right person today, and not put
it off till tomorrow. -- Larry Wall, 3rd State of the Onion



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

Date: Fri, 16 Mar 2001 18:06:50 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
Subject: Re: `pwd` doesn't work on all servers?
Message-Id: <Pine.LNX.4.21.0103161238320.865-100000@marmot.rim.canoe.ca>


On Fri, 16 Mar 2001, Chris Stith wrote:

> Benjamin Sugars <bsugars@canoe.ca> wrote:
> 
> > On Thu, 15 Mar 2001, John W. Krahn wrote:
> >
> >>            use Cwd;
> >>            $dir = cwd;
> 
> > I think Cwd::cwd actually uses `pwd` internally on Unix systems.
> 
> It does, but that's not as portable. If you know your program
> will never run anywhere else, then that could work.

The point was that the OP was having problems with `pwd` so switching to
Cwd::cwd won't help.

Cheers,
-Ben

-- 
signer: can't create ~/.sig: Resource deadlock avoided




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

Date: 16 Mar 2001 18:24:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: ANNOUNCE: Math::MatrixReal::Ext1
Message-Id: <98tloh$5sj$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<msouth@fulcrum.org>],
who wrote in article <98sl12$nn9$1@inxs.ncren.net>:
> an extension for Math::MatrixReal that lets you create a matrix from
> rows or colums, passed in as perl arrays rather than in the string format
> which is currently required by Math::MatrixReal.  The new methods are
> new_from_cols() and new_from_rows(), complementing the existing
> new_from_string() method.  This makes the module a little more
> "perlish", and, in particular, make it easier to create a matrix
> from a program.

Is there any reason to use such a deficient module?

  >perl -MMath::Pari -wle "$a = PARImat_tr [[1,2],[3,4]]; print $a**40"
  [38418114959269691024862069751,55991602170538933080248818850;83987403255808399620373228275,122405518215078090645235298026]

  >perl -MMath::Pari -wle "$a = PARImat [[1,2],[3,,4]]; print $a**40"
  [38418114959269691024862069751,83987403255808399620373228275;55991602170538933080248818850,122405518215078090645235298026]

Or do you need something much smaller?

Ilya


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

Date: Fri, 16 Mar 2001 13:45:19 -0500
From: minorseventhSPAMBLOCK@earthlink.net (Jim Kroger)
Subject: chomp not chomping?
Message-Id: <minorseventhSPAMBLOCK-1603011345190001@tritone.csbmb.princeton.edu>

Hi, I have the following code, in which chomp seems not to be doing its
job, and leaves junk attached to the end of an item:


chomp(@subjects = `cat subNames`);
foreach (@subjects) {
   chomp($_);
   }

foreach (@subjects) {
   system("cp subFs/${_}.f  ${_}/Input");     <<
}


WHAT I WANT TO HAPPEN:
For each of the subjects listed in file subNames, a file in directory
subFs exists, called <the subject's name>.f, and there is a directory with
the same name as the subject, which contains directory Input. I want to
move the <subject>.f file into <subject>/Input, for each subject.

CHOMP DOESN'T SEEM TO WORK:
You can see I added a loop to chomp each subject, in addition to the first
chomp command which should be sufficient? Still, in the debugger, typing 

x @subjects

after the first snippet above seems not to clean up the end of the item and
returns the subjects with something appended to each (carriage return?):

"anna/cI"
"baig/cI"
-
-
-


THE BAD EFFECT:   
When I continue to step through until the second snippet above, I get an
error at the line << like:

/Input not found.

When I check, the directory anna is there, and the directory Input is in
it. So I assume it is the extra garbage (/cI) on the end of anna that
keeps it from finding the anna/Input directory?

Thanks for any help.

Jim

-- 
Please remove SPAMBLOCK to reply.

For a list of free online jazz and jazz guitar lesson websites:
http://www.princeton.edu/~kroger/home/OnlineJazzLessons.html


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

Date: Fri, 16 Mar 2001 16:12:10 GMT
From: lkenny@fisheries.org (LK)
Subject: Re: Copy/Paste using Perl?
Message-Id: <3ab23ac8.5008487@wingate>

On Fri, 16 Mar 2001 09:55:27 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

>Why are you adding a newline to every line? The newline is still there.
>So now there will be two.

>Uh... this is a binary file? Ouch! Most definitely use binmode on both
>input and output file handles! This at least will give an exact copy:

Thanks for the newline heads-up.
I added binmode after I posted this, and it allowed me to get the
whole file in.  Without it was giving me about two garbled lines of a
multi-hundred lined file.

>But no, that's not even what you want. You want to PARSE the WordPerfect
>file, and extract the text from it, and then print out the plain text.
>
>But CPAN doesn't have any modules referencing "Word PErfect" or
>"Wordperfect". Tough luck.
>
>So, automation is the only way to go: control WordPerfect to open the
>file for you, maybe even make it save as text. Best bet: see what
>Win32::OLE can do for you. At worst, make it copy the text. Using
>Win32::API it must be possible to retrieve the text from the clipboard
>into a scalar (OpenClipboard(), GetClipboardData(CF_TEXT), GLobalLock(),
>RtlMoveMemory(), GLobalUnlock(), CloseCLipboard()).
>
>Then you can just save the scalar. I assume it already contains CR
>characters, so binmode again is necessary. To notepad, CR+CR+LF is a
>softwrap marker, make one edit with notepad and you'll loose all of your
>returns. You might have seen this happen with HTML files doawnloaded
>from internet.

Thanks.  This gives me a plae to start.

LK



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

Date: Fri, 16 Mar 2001 16:51:13 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Create .tar.gz with Perl?
Message-Id: <7a4rwt3ben.fsf@merlin.hyperchip.com>


trammell@bayazid.hypersloth.net (John Joseph Trammell) writes:

> On Fri, 16 Mar 2001 06:15:28 -0700, bowman <bowman@montana.com> wrote:
> > tar -czf foo.tgz  *
> 
> s/-//

tr/-//d is faster ;-)

--Ala


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

Date: Fri, 16 Mar 2001 19:34:32 +0100
From: Simon Stiefel <SiStie@nuclear-network.com>
Subject: dbmopen-Error
Message-Id: <Pine.LNX.4.31.0103161925500.7015-100000@server.stiefel.priv>

Hi,

yes, I know, I better should use "tie", but I don't know how to do that.
;-)

I've written a CGI-Script. This CGI-Script has to open a DBM-File, which
is in /var/pos.
But everytimes when I it tries to open it, an error appears which says,
that the ressource is currently not availible.
The DBM-File(s) (pos.dir & pos.pag) exist of course.

And even if I copy those files in the cgi-bin-directory it can't open it.

Here's some of my code:


--- snip
sub Code_Verify
{
        dbmopen (%DB,"/var/pos/pos",undef) || die "fehler: $!";
        if ($DB{$code} eq "n") {
                return 0;
        } else {
                return 1;
        }
}

--- snip

Can somebody help me?

Thank you!


Mit freundlichen Gr=FC=DFen,        .~.     Open Minds.
with best regards               /V\             Open Sources.
                               // \\                    Open Future!
Simon Stiefel                 /(   )\_ I N U X
                               ^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.com   |  http://www.nuclear-network.com |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |





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

Date: Fri, 16 Mar 2001 18:50:34 GMT
From: "John Hall" <jhall@ifxonline.com>
Subject: Re: dbmopen-Error
Message-Id: <_fts6.34973$o7.1476017@news1.rdc1.sdca.home.com>

I don't pretend this to be the definitive answer, but I have a few ideas,

1. Don't know what 'undef' is supposed to do in that context. Usually i've
seen chmod like file attributes go there:

        dbmopen (%DB,"/var/pos/pos",644) || die "fehler: $!";

2. If you really can't figure out how to get a lock on the file, have you
tried 'making a copy' of the file(s) and then opening those?

3. Newer versions of the dbmopen stuff by default use one file 'pos.db'
instead of 2..

4. If something is periodically writing to those files, put a 'wait for
lock' action in your code so that if it can't get a lock it tries again a
few milliseconds later.


"Simon Stiefel" <SiStie@nuclear-network.com> wrote in message
news:Pine.LNX.4.31.0103161925500.7015-100000@server.stiefel.priv...
Hi,

yes, I know, I better should use "tie", but I don't know how to do that.
;-)

I've written a CGI-Script. This CGI-Script has to open a DBM-File, which
is in /var/pos.
But everytimes when I it tries to open it, an error appears which says,
that the ressource is currently not availible.
The DBM-File(s) (pos.dir & pos.pag) exist of course.

And even if I copy those files in the cgi-bin-directory it can't open it.

Here's some of my code:


--- snip
sub Code_Verify
{
        dbmopen (%DB,"/var/pos/pos",undef) || die "fehler: $!";
        if ($DB{$code} eq "n") {
                return 0;
        } else {
                return 1;
        }
}

--- snip

Can somebody help me?

Thank you!


Mit freundlichen Grüßen,        .~.     Open Minds.
with best regards               /V\             Open Sources.
                               // \\                    Open Future!
Simon Stiefel                 /(   )\_ I N U X
                               ^ ~ ^
--
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.com   |  http://www.nuclear-network.com |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |







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

Date: Fri, 16 Mar 2001 17:08:51 GMT
From: "Kalle Anka" <kalle@tvettsvamp.a.se>
Subject: Doesnt work
Message-Id: <DMrs6.180$4N4.54020@newsc.telia.net>

I know that the files math, but nothing prints out!
For example: $filename is
someone@somewere.com <br>
someone2@somewere.com <br>
someone3@somewere.com <br>

and $email (from input) is someone@somewere.com



    open INFILE, $filename
or return "Couldn't open file for reading";
    @infile = <INFILE>;
for $line (@infile) {
if( $email eq $line ) {
    close INFILE;
print "Yes<br>\n\n";

}
}




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

Date: Fri, 16 Mar 2001 17:16:25 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Doesnt work
Message-Id: <slrn9b4g9f.j2u.trammell@bayazid.hypersloth.net>

On Fri, 16 Mar 2001 17:08:51 GMT, Kalle Anka <kalle@tvettsvamp.a.se> wrote:
> I know that the files math, but nothing prints out!
> For example: $filename is
> someone@somewere.com <br>
> someone2@somewere.com <br>
> someone3@somewere.com <br>

                       ^

Spaces count for something!  "abc" != "a b c"...
Try printing out "$email" and "$line" to make sure they're
*really* the same.



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

Date: Fri, 16 Mar 2001 09:38:12 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Doesnt work
Message-Id: <3AB24F84.FDF76D13@stomp.stomp.tokyo>

Kalle Anka wrote:

(snippage)
 
> I know that the files math, but nothing prints out!

"match"

> For example: $filename is
> someone@somewere.com <br>
> someone2@somewere.com <br>
> someone3@somewere.com <br>

"where"
 
> and $email (from input) is someone@somewere.com


 "someone@somewere.com"

does not equal

 "someone@somewere.com <br>\n"


My suggestion is you dimiss any effort at
programming and invest your time and effort
in attaining a decent education.

Godzilla!


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

Date: 16 Mar 2001 12:50:39 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Doesnt work
Message-Id: <m3snkdtxg0.fsf@mumonkan.sunstarsys.com>

"Kalle Anka" <kalle@tvettsvamp.a.se> writes:

Subject: Doesnt work

Couldn't you come up with a more descriptive Subject?

> I know that the files math, but nothing prints out!
> For example: $filename is
                         ^^
"is", or "contains"? I think you mean "contains" here.

> someone@somewere.com <br>
> someone2@somewere.com <br>
> someone3@somewere.com <br>
> 
> and $email (from input) is someone@somewere.com

=item don't look for a single line in a file like this

>     open INFILE, $filename
> or return "Couldn't open file for reading";
>     @infile = <INFILE>;
> for $line (@infile) {

=cut

  open INFILE, $filename or die "Can't open '$filename': $!";

  my $line;
  while (<INFILE>) {
    chomp; # drops trailing newlines; can omit if undesirable
    $line = $_, last if /^\Q$email/o; # substr match!
  }

  close INFILE;
  print "Yes<br>\n\n" if defined $line;

=item $email never eq $line: it doesn't have any <br>'s 

> if( $email eq $line ) {
>     close INFILE;
> print "Yes<br>\n\n";


-- 
Joe Schaefer   "Always acknowledge a fault. This will throw those in authority
                 off their guard and give you an opportunity to commit more."
                                               --Mark Twain


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

Date: Fri, 16 Mar 2001 13:23:14 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Doesnt work
Message-Id: <ool4btka1da86v4v4g8gj6a6p1p71bv4nf@4ax.com>

On Fri, 16 Mar 2001 09:38:12 -0800, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote wonderful things about sparkplugs:

>
>My suggestion is you dimiss any effort at
>programming and invest your time and effort
>in attaining a decent education.

as trolls go you're usually more interesting.

Clearly Kalle's grasp of the English language is tenous due to Kalle's
not speaking English everyday or as a first language, or both.  I have
no idea where .se is but I am guessing it isn't an English speaking
locale.

Further you used the word effort twice in the sentence, which is very
weak.  As an editor I would have circled those in bright red and
dropped that on your desk for a rewrite.

You can do better.

ex:

My suggestion is you dismiss any further attemps at programming and
invest your efforts towards attaining a decent education.


>
>Godzilla!


--
Member of the Nondeterministic Football League


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

Date: Fri, 16 Mar 2001 12:26:36 -0500
From: Steve Alpert <Steve_Alpert@idx.com>
Subject: Re: Doesnt work
Message-Id: <77j4btoj2ba0qviulf3roda875j06fpsrk@4ax.com>

"Kalle Anka" <kalle@tvettsvamp.a.se> wrote:

>I know that the files math, but nothing prints out!
>For example: $filename is
>someone@somewere.com <br>
>someone2@somewere.com <br>
>someone3@somewere.com <br>
>
>and $email (from input) is someone@somewere.com
>
>    open INFILE, $filename
>or return "Couldn't open file for reading";
>    @infile = <INFILE>;
>for $line (@infile) {
>if( $email eq $line ) {
>    close INFILE;
>print "Yes<br>\n\n";
>
>}
>}

Have you read any Perl books?  Usually, EVERY line read from a file has a "\n"
on the end.  For starters, either add it to $email or take it off your input
lines!

/sra

        Steve Alpert (Steve_Alpert @ i d x . c o m)
        IDX Systems Corp.   Boston, Massachusetts



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

Date: Fri, 16 Mar 2001 11:02:18 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Doesnt work
Message-Id: <3AB2633A.FB37B82B@stomp.stomp.tokyo>

Lou Moran wrote:
 
> Godzilla! poked a pig with a sharpened stick:

(snipped pig squealing)

My goodness! Will you listen to yourself
squeal like a stuck pig!

Godzilla!


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

Date: Fri, 16 Mar 2001 17:46:31 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Excute Script 2
Message-Id: <tb4kbn7cmb3kf2@corp.supernews.com>

John W. Krahn <krahnj@acm.org> wrote:
> Milliwave wrote:
>> 
>> Hello I have two separate scripts
>> 
>> script 1 and script 2.
>> 
>> Script 2 needs information from script 1, and hence can only be executed
>> once script 1 has completed running. Is there any sought of command which I
>> can use within script 1 to execute script 2, once script
>> one has completed executing? Basically a command which could fire-off script
>> 2?

> perldoc -f eval
> perldoc -f exec
> perldoc -f system
> perldoc -f do

Or, if you reverse thinking and force script 2 to run script 1
ahead of itself:

perldoc -f require

Chris

-- 
Christopher E. Stith
Where there's a will, there's a lawyer.



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

Date: Fri, 16 Mar 2001 17:05:42 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: FAQ 7.12:   What's a closure?
Message-Id: <tb4hv6cjbfb565@corp.supernews.com>

In article <slrn9b2ufo.p0e.abigail@tsathoggua.rlyeh.net>,
    Abigail <abigail@foad.org> wrote:

: It was made mostly as a proof of concept. It shows you what's possible,
: and that you can do OO without using language supported OO constructs.

Rob Pike already told us that:

    The O-O languages give you more of course - prettier syntax, derived
    types and so on - but conceptually they provide little extra.

Greg
-- 
VMS is a text-only adventure game. If you win you can use Unix.
    -- Bill Davidsen


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

Date: Fri, 16 Mar 2001 12:34:01 -0500
From: "Steve D. Perkins" <steve@NOSPAM.hotmail.com>
Subject: Funny regular expression problem
Message-Id: <98tirt02snp@news2.newsguy.com>

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


    The regular expressions I'm using to break each line up look like this:


FOR FIRST COLUMN (extract characters preceeding the first double-quote, trim quote mark off
later):
"^.*[\"]"

FOR SECOND COLUMN (extract characters between double-quotes, trim quotes off later):
"[\"].*[\"]"

FOR THIRD COLUMN (extract characters after last double-quote, trim quote mark off later):
"[\"].*$"


    However, I'm not getting the results I expected!  The first real expression returns
everything through the final double-quote rather than the first:
D1   "DUMMY-INITIALIZATION-STRING"

    ... the second expression does work fine:
"DUMMY-INITIALIZATION-STRING"

    ... although the third expression returns nothing at all (empty string).

    Can anyone spot the (probably idiotic) error I'm making here, or suggest expressions that
would return what I need for the first and third columns?






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

Date: Fri, 16 Mar 2001 12:56:20 -0500
From: "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se>
Subject: Re: Getopt::Std swallows argument even if ":" not specified?
Message-Id: <3AB253C4.9D51414@lmc.ericsson.se>

Argh! I can't believe this...

I just stumbled upon this in the doc. I read it before, but ... ahem..
fast. :) I expected to be a bit like libc's getopt(3).. :)

Wow. I'm sorry for the rant. 

Thanks everyone!

A.

> >Don't give me that "it's-not-a-bug-it's-a-feature" crap. :)
> 
> I wouldn't dream of it, since it's neither.
> 
> 'getopt' matches switches with arguments.  That's all it does.
> 
> 'getopts' does that and sets Boolean flags.  A ':' here makes it match
> 
>   perldoc Getopt::Std


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

Date: Fri, 16 Mar 2001 19:02:00 GMT
From: "Kalle Anka" <kalle@tvettsvamp.a.se>
Subject: Godzilla! Do you please your ego by insulting people. You may be god at Perl and a hotshot in this group, but hardly can you have a decent education.
Message-Id: <Iqts6.198$4N4.59447@newsc.telia.net>

Godzilla! Do you please your ego by insulting people. You may be god at Perl
and a hotshot in this group, but hardly can you have a decent education.

Dont disturb yourself with my quests anymore.





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

Date: Fri, 16 Mar 2001 12:28:26 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: How to Print "system" failure ...was <Print own "die" message"
Message-Id: <24839-3AB25B4A-127@storefull-245.iap.bryant.webtv.net>

> !(system('foo')) || die "blah $?\n";   or 
> system('foo') && die "blah $?\n"; 
> Chris 

Thanks, Chris... but I tried both ways, and that isn't working either.
Now, I have the opposite problem. It never prints the die message when
it fails. 

I tested it like this...
    !(system("tar -zxf $tmpfile -C $tmpdir 2>&1")) || die "blah$?\n";    

and here's my real block of code...

    mkdir $tmpdir, 0705; 
    !(system("tar -zxf $tmpfile -C $tmpdir 2>&1")) || die     
     "<HTML><BODY><!--#echo banner=''-->
    <font size=4 face=Verdana,Arial color=990033><BR><BR><BR>
<blockquote><STRONG>Un-tar was not successful<BR> 
    </STRONG></blockquote></font></BODY>/HTML>blah$?\n",
rmdir $tmpdir, unlink $tmpfile, exit;  

Both ways had the same results. When the tar was unsuccessful, it never
printed the die message. Why?

--Dennis



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

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


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