[9040] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2658 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 21 07:07:42 1998

Date: Thu, 21 May 98 04:00:32 -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           Thu, 21 May 1998     Volume: 8 Number: 2658

Today's topics:
        ?access NT-SQLserver  from Linux? <jwest@netnw.com>
        Arrays (Antti-Jussi Korjonen)
    Re: Benchmark: local filehandle vs. Filehandle.pm <zenin@bawdycaste.org>
    Re: generating hash of complex records (Andre L.)
    Re: GNU attacks on the open software community. <zenin@bawdycaste.org>
    Re: GNU attacks on the open software community. <barmar@bbnplanet.com>
    Re: GNU attacks on the open software community. <barmar@bbnplanet.com>
    Re: GNU attacks on the open software community. (Paul Eggert)
    Re: GNU attacks on the open software community <zkessin@shell1.tiac.net>
    Re: GNU attacks on the open software community (Tyson Richard DOWD)
    Re: GNU attacks on the open software community <zenin@bawdycaste.org>
    Re: GNU attacks on the open software community <zenin@bawdycaste.org>
    Re: GNU attacks on the open software community <barmar@bbnplanet.com>
    Re: GNU attacks on the open software community <barmar@bbnplanet.com>
    Re: GNU attacks on the open software community <barmar@bbnplanet.com>
    Re: GPL documentation == unspeakable evil (Tyson Richard DOWD)
    Re: GPL documentation == unspeakable evil (Joonas Timo Taavetti Kekoni)
        Non-greedy regexp still eatting all the pies! <gmorgan@photographics.co.uk>
    Re: Perl Net::Telnet() (Antti-Jussi Korjonen)
        samba log files <darren2@jps.net>
        Writing to files <pi83@dial.pipex.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 18 May 1998 17:53:29 -0700
From: "Jim Westveer" <jwest@netnw.com>
Subject: ?access NT-SQLserver  from Linux?
Message-Id: <895539216.437967@slave1.aa.net>

Any words of wisdom on ways to access NT-SQLserver  from Linux?

I have spent some time looking at DBI and DBD-ODBC.  Would this be a good
way to go?

What Driver Manager does DBD-ODBC require?  It appears that the ODBC
installation requires a DriverManager on the Linux box.

Could anyone point me in the 'right' direction?

TIA,

Jim
jwest@netnw.com




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

Date: 21 May 1998 08:29:53 GMT
From: aajii@aajii.ton.tut.fi (Antti-Jussi Korjonen)
Subject: Arrays
Message-Id: <6k0om1$rpp$2@baker.cc.tut.fi>

I've got an array full of expressions, one row for example:
PORTS=16        ACTIVE PORTS=0        SWITCH 2=28   SWITCH 3=24
Now, I want extract the values of PORTS and SWITCH 2.
It would be nice to have a function, which does this for me.
So I have an array, @array which contains a whole lot of rows like above.
Now I pass @array and say PORTS or PORTS= to the function and it should
return 16. What would be the easiest way to do this? 

--
  
         __/                __/ __/  __/     Antti-Jussi Korjonen
      __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
    __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
  __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
                                         Antti-Jussi.Korjonen@sonera.fi
   --------->>  http://www.students.tut.fi/~k150556  <<---------
     


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

Date: 21 May 1998 08:02:02 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Benchmark: local filehandle vs. Filehandle.pm
Message-Id: <895738173.30559@thrush.omix.com>

Tom Christiansen <tchrist@mox.perl.com> wrote:
	>snip<
: 	    while ( $_ = $fh->getline ) { }

	But if you call this as <$fh> you don't have the speed it.

	This is more reason why:

		<$self->{handle}>

	Should work, but of course it doesn't.  To hell with the
	lame <*> notation, it should never been done as anything
	other then glob() anyway (and never should have called csh
	either).  Ok, I'm done ranting now. :-)

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Tue, 19 May 1998 13:23:36 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: generating hash of complex records
Message-Id: <alecler-1905981323360001@dialup-697.hip.cam.org>

(Mailed && posted.)
Here's an example of a hash of hashes like you want:

==================================================
# Let's say the records have the following fields:
@fields = qw/Name ID_num Age Favorite_meat Phone/;

while (<DATA>) {

   chomp;

   # Split the line (record) on spaces and 
   # create a field => value hash:
   $i = 0;
   %record = map {$fields[$i++], $_} split / /;

   # Store the record's reference in the bigger hash:
   $hash{$record{Name}} = { %record };

}

# Now, if you want to know George's age, you do:
$key = 'George';
print "$key is ", $hash{$key}->{Age}, 
      " years old.\n";

__DATA__
George 655 41 Spam 555-5555
Bob 999 21 Pork 555-4444
=================================================

HTH,
A.L.

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

In article <35610510.E92579A6@census.gov>, cstuber@census.gov wrote:

> I need to be able to store the equivilent of a C structure into
> a hash.  I am sort of following a simple version of an example
> on page 274 of the Camel book (Generation of a hash of complex
> records.  The code below yields "George 21" which isnt quite what
> I had hoped for.  I have tried dozens of different things, but
> nothing working so far.  Any assistance would be greatly appreciated.
> 
> $rec = {};
> 
> $rec->{NAME} = "George";
> $rec->{NUMBER} = "41";
> $AA{ $rec->{NAME} } = $rec;
> 
> $rec->{NAME} = "Bob";
> $rec->{NUMBER} = "21";
> $AA{ $rec->{NAME} } = $rec;
> 
> $key = "George";
> print "$key $AA{$key}{NUMBER}\n";


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

Date: 21 May 1998 09:29:05 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: GNU attacks on the open software community.
Message-Id: <895743396.736519@thrush.omix.com>

Ron House <house@usq.edu.au> wrote:
	>snip<
: Is FSF s'ware free, or is that just propaganda?

	Depends on what you meen by "free".  If I have a GPLed program on my
	computer and decide to change a piece of it *for my own personal
	use* and don't publish this change to the entire world, I'm in
	direct violation of the GPL.

	Is it still freedom when you've got a gun to your head?

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Thu, 21 May 1998 09:55:59 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: GNU attacks on the open software community.
Message-Id: <PSS81.71$152.620589@cam-news-reader1.bbnplanet.com>

In article <3563DAFE.3914BB50@usq.edu.au>, Ron House  <house@usq.edu.au> wrote:
>Why should he be unhappy? His manifesto makes it
>abundantly clear that he thinks a programmer has
>no right to remuneration for his work, and his

It does no such thing.  He believe that programming should be a service
industry, where you might be paid for your time, or someone might contract
with you to write or modify a program for them, or you would be paid for
software support service, etc.

He doesn't believe programmers have a right to expect royalties for every
copy of a program that's distributed.  But he earns his living as a
programmer and consultant.

The Manifesto also suggests a Software Tax, which can be used to pay
programmers.  I'm not sure how serious he really was about this; it seems
like a contingency plan if the free software industry can't be
self-supporting.

>GPL denies other programmers the right to
>acknowledgement. In Olde England, Thomas Cromwell

The GPL doesn't require you to acknowledge the original author of something
you've derived from.  But nowhere does it prohibit such acknowledgement.
And it requires you to document that you've changed the program, so that
people won't be misled to think that your modified program is the original
author's work.

>Is FSF s'ware free, or is that just propaganda?

Users can get the source code and are free to modify and redistribute it.

They're not free to deny the rights they were given to others when they
redistribute.

Is it just propaganda to say that I'm free, even though I don't have the
rights to commit suicide, shoot somone, sell myself into slavery, or drive
without a license?  There's virtually no such thing as total freedom; if
that's your definition of "free", then only public domain software is free.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: Thu, 21 May 1998 10:13:15 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: GNU attacks on the open software community.
Message-Id: <%6T81.73$152.620589@cam-news-reader1.bbnplanet.com>

In article <895743396.736519@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>Ron House <house@usq.edu.au> wrote:
>	>snip<
>: Is FSF s'ware free, or is that just propaganda?
>
>	Depends on what you meen by "free".  If I have a GPLed program on my
>	computer and decide to change a piece of it *for my own personal
>	use* and don't publish this change to the entire world, I'm in
>	direct violation of the GPL.

You're wrong (I won't stoop to the common rhetorical trick of saying you're
lying).  Nowhere in the GPL does it ever require you to publish anything.
If you think otherwise, please refer to the clause that says this.

The GPL's places requirements on you *if* you redistribute the changed
work.  The gist of those requirements is that you must provide source,
must pass on the rights and requirements you were given to the recipient,
and may not add restrictions.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: 21 May 1998 03:10:30 -0700
From: eggert@twinsun.com (Paul Eggert)
Subject: Re: GNU attacks on the open software community.
Message-Id: <6k0uim$3kl$1@shade.twinsun.com>

Zenin <zenin@bawdycaste.org> writes:

>	If I have a GPLed program on my
>	computer and decide to change a piece of it *for my own personal
>	use* and don't publish this change to the entire world, I'm in
>	direct violation of the GPL.

You're entirely mistaken.  The GPL does not require publication,
and many people and organizations modify GPLed code
without publishing the result.


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

Date: 21 May 1998 04:10:01 -0400
From: Zach Kessin <zkessin@shell1.tiac.net>
Subject: Re: GNU attacks on the open software community
Message-Id: <yc74sykdoyu.fsf@shell1.tiac.net>

Tom Christiansen <tchrist@mox.perl.com> writes:

> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     Klaus.Schilling@home.ivm.de writes:
> :X is not needed at all by the GNU/Linux system. One can do extremely well 
> :without any GUI stuffs. Thus I don't have any X stuff installed at all.
> 
> Oh stop this silliness.  It's Linux.  Adding the word "GNU" is an insult.
> 
> Amazing how a group with the ironic name of "FSF" should be working so hard 
> to screw up free software and divide its proponents by bashing them 
> with religion.
> 
> --tom

The FSF in general and RMS in particular seem to be rather steemed now
that the Free/Open software movement has started to ignore them. Linux
exists because of Linus and company and Perl because of Larry Wall and
Randal and Tom (and others of course). I think RMS is annoyed because
free software is finaly being taken seriously, and its Linux, Apache
and perl that people are looking at. 


> -- 
>   "It's a cult.  Don't encourage them."
>           --Rob Pike on the FSF

Tue.

--Zach Kessin


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

Date: 21 May 1998 08:13:56 GMT
From: trd@cs.mu.oz.au (Tyson Richard DOWD)
Subject: Re: GNU attacks on the open software community
Message-Id: <6k0no5$103$1@mulga.cs.mu.OZ.AU>

Tom Christiansen <tchrist@mox.perl.com> writes:

> [courtesy cc of this posting sent to cited author via email]

>In comp.lang.perl.misc, trd@cs.mu.oz.au (Tyson Richard DOWD) writes:
>:No, they are worried that a very popular tool is documented in a
>:proprietry fashion, and that it makes the tool itself somewhat
>:proprietry.

>They are wrong.  Perl's documentation is free.  They're making this 
>whole thing up.

You can't modify it.  By the FSF's terminology (which is the only
terminology relevant to them), it's not free.  Some people agree with
them.  Some don't.

You cannot deny that you are the only person in the world who can modify
perlfaq.  Being utterly dependent upon one vendor in order to get work
done is something that RMS was very worried about when he devised the
GPL.  

In common parlance, calling perlfaq "free" is OK, but in the free
software community, where people allow modification and redistribution
of their work, it's misleading.

>:Have you read your own license recently?  It is not legal to copy code
>:examples from the perlfaq to use in commercial code without prior
>:written authorization.  Nowhere do you allow people to use the coding
>:examples -- except that you can distribute the document in part for
>:non-commercial use.  Starting with a coding example and modifying it
>:is of course illegal, as modification is not allowed.

>I am talking about the prose, not the code.  It was addressing the prose
>thieves who've been robbing me.  If you look at my other licence, the
>one in perltoot, this spells things out clearly.  I'll have to merge them.

>    While it is copyright by me with all rights reserved, permission
>    is granted to freely distribute verbatim copies of this document
>    provided that no modifications outside of formatting be made, and
>    that this notice remain intact.  You are permitted and encouraged
>    to use its code and derivatives thereof in your own source code for
>    fun or for profit as you see fit.

You're right -- you really should merge this with your other license, I
only read the first one (at the top of perlfaq).

>See that?  "For fun or for profit as you see fit".  That, sir, is true
>freedom -- freedom to let the user make their own choice.  I want them
>to be able to use that code WITHOUT HINDRANCE.  No strings attached.
>I know that's very anti-FSF of me to give something away so freely without
>strings, but it's what I want to do.  I think that's what Perl wants to do.
>I really hate to see folks making others' decisions for them.  It's morally
>repugnant.  I also don't want them violating my own artistic rights.  This
>too is a moral concern.

Since this is your work, everyone (including, IMHO the FSF) agrees you
have the right to do this -- you are the author.  If you want to license
your work as you have, then go ahead and do it.

However, you convince everyone that there is true freedom when people cannot
change what you have written.  It's particularly striking when you can
modify Perl, but not its documentation.  If someone ever wanted to
make a variant, they would find straight away that to have accurate
documentation they need to write documentation from scratch.
Practically, this is a pain in the neck, so people might not bother
modifying it.  This isn't good for free software in general.

I would like to see a document that you can use code from without
hinderance.  But I would also like it if people could modify the
documentation.  Now I don't think the GPL is a good choice when code
examples are involved.  I think we agree here.  But I think the FSF
is right in that your documentation's license is restrictive.  It's not
the worst license in the world by any means, but it does not match
Perl's license.



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

Date: 21 May 98 08:52:15 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: GNU attacks on the open software community
Message-Id: <895741433.424658@thrush.omix.com>

Barry Margolin <barmar@bbnplanet.com> wrote:
: You've never heard of bug fixes?  Perhaps Tom intends to fix a particular
: bug, but his schedule prevents him from doing it as soon as you need.  So
: you make the fix and then share it with your friends.  That's the type of
: activity the GPL promotes.

	GPL doesn't promote this, it forces it with threat of lawsuit.

	It's not freedom when you have a gun to your head.

: I'm not saying that the Perl license prohibits this, but it sure sounds
: like you're discouraging this type of activity.

	Never heard of a "Changes" file?  Not to mention "bug fixes" should
	not change perl enough to need documentation changes, and extensions
	should be documented separately.

: What's the point of open
: source if you then discourage people making use of it?

	Good question.  It's one I always wonder about when the GPL
	advocates start bashing the FreeBSD license.

: Regarding modifying the documentation, what if there's a mistake in it?

	perlbug
-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 21 May 98 09:01:55 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: GNU attacks on the open software community
Message-Id: <895742014.143425@thrush.omix.com>

Barry Margolin <barmar@bbnplanet.com> wrote:
: I don't think RMS is opposed to all copyrights.  He believes that software
: users should be able modify it to suit their needs, i.e. that software
                                    ^^^^^^^^^^^^^^^^
	No, he does not.  If he did the GPL would be worded much closer
	to the BSD license.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Thu, 21 May 1998 09:10:18 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: GNU attacks on the open software community
Message-Id: <_bS81.68$152.620589@cam-news-reader1.bbnplanet.com>

In article <895741433.424658@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>Barry Margolin <barmar@bbnplanet.com> wrote:
>: You've never heard of bug fixes?  Perhaps Tom intends to fix a particular
>: bug, but his schedule prevents him from doing it as soon as you need.  So
>: you make the fix and then share it with your friends.  That's the type of
>: activity the GPL promotes.
>
>	GPL doesn't promote this, it forces it with threat of lawsuit.

The GPL doesn't force you to share with your friends, it allows it.  What
it forces is that you can't prohibit your friends from doing further
modifying and sharing, and if you share your binaries you must share your
source.

>	It's not freedom when you have a gun to your head.

You're not being forced to copy the code in the first place.  You're being
*allowed* to copy it if you agree to the terms, which are that you also
license your result similarly if you distribute it.  You have complete
freedom of choice: write your code from scratch, derive from public domain
code (if such exists), license someone else's code, or derive from GPLed
code.  In the first two cases, you own the copyright on the result and can
decide on the licensing terms.  In the latter two cases, you have to agree
to the licensor's terms; and in the last case those terms are the GPL.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: Thu, 21 May 1998 09:31:08 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: GNU attacks on the open software community
Message-Id: <wvS81.69$152.620589@cam-news-reader1.bbnplanet.com>

In article <6k0kov$s8j$1@mulga.cs.mu.OZ.AU>,
Tyson Richard DOWD <trd@cs.mu.oz.au> wrote:
>Tom Christiansen <tchrist@mox.perl.com> writes:
>>It certainly is about an author's moral rights!  They wish to give
>>up my author's rights on my work.  They think I'm being a mean old
>
>No.  They wish to replace your work with someone else's.  Where does
>it say "change license in perl-faq to be GPL"?  Nowhere.  
>	THEY HAVE TO WRITE THEIR OWN BOOK.

I think there's alot of confusion in this thread about why Tom is upset.

Tom doesn't consider the effort to write alternative Perl documentation to
be violating his rights.  His complaint is that the existence of this item
on the task list implies that he hasn't provided reasonable documentation
of Perl in the first place.  Since he considers his documentation to be
free (by his definition, not RMS's), in his opinion there already is "free
Perl documentation", and the implication that he hasn't provided this is an
attack on his work.  Furthermore, I think he sees it as indirectly
demanding that Tom change the copyright on his documentation to be the GPL,
something he's morally opposed to and doesn't think the FSF has a right to
request.

Tom apparently sees two problems with putting his documentation under the
GPL:

1) It would allow people to modify the documentation; and
2) it would force people who incorporate examples from the documentation
into their programs to put them under the GPL.

Problem 2 is actually easily solved.  Since Tom is the author of the
documentation, he can use a license that refers to the GPL, and then allows
additional rights, such as incorporating the examples into programs without
having to distribute their source.  If someone were to merge Tom's
documentation with some purely-GPLed documentation, the result of that
merger would necessarily be infected by the GPL, and the additional rights
would not apply to the combination (only the rights that were common to
both components would apply to the result), but that would be just as true
when merging PD documentation with GPLed documentation; the viral nature is
not in his documentation, it comes from the other piece.

Problem 1 is harder to solve, since the GPL doesn't permit additional
restrictions to be added to it, so you wouldn't be able to combine
something that prohibits modifications with a GPLed work if you planned on
distributing the result.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: Thu, 21 May 1998 09:41:12 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: GNU attacks on the open software community
Message-Id: <YES81.70$152.620589@cam-news-reader1.bbnplanet.com>

In article <895742014.143425@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>Barry Margolin <barmar@bbnplanet.com> wrote:
>: I don't think RMS is opposed to all copyrights.  He believes that software
>: users should be able modify it to suit their needs, i.e. that software
>                                    ^^^^^^^^^^^^^^^^
>	No, he does not.  If he did the GPL would be worded much closer
>	to the BSD license.

I don't think so.  The BSD license allows you to distribute binary-only
copies, thus preventing users from modifying it to suit their needs.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: 21 May 1998 08:19:42 GMT
From: trd@cs.mu.oz.au (Tyson Richard DOWD)
Subject: Re: GPL documentation == unspeakable evil
Message-Id: <6k0o2u$170$1@mulga.cs.mu.OZ.AU>

Tom Christiansen <tchrist@mox.perl.com> writes:

> [courtesy cc of this posting sent to cited author via email]

>In gnu.misc.discuss, trd@cs.mu.oz.au (Tyson Richard DOWD) writes:
>:Like the way you extract promises from people not to modify your
>:documentation by having a strict copyright and sending around the lawyers?

>I don't recall sending my lawyers after anyone.  Why have you alleged
>that I sent around lawyers regarding these documents when I have not?
>Are you committing libel?  :-)

Sorry, I mis-remembered an earlier article, someone sent the lawyers
around to *you*. 




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

Date: 21 May 1998 09:47:10 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: Re: GPL documentation == unspeakable evil
Message-Id: <6k0t6u$jba$1@hiekkalaatikko.cs.hut.fi>

Tom Christiansen (tchrist@mox.perl.com) wrote:
: It is imperative that no documentation be placed under the GPL due to its
: insidious viral nature.  For example, the Perl documentation is meant to
: be used to take examples from to use in your programs.  We want people
: to do this.

So what is the problem?
1. direct copying of examples to your non GPL program is forbidden.
2. Usage of the documentation for you own future book is forbidden(no?)
3. something else...

-- 
	_-  Joonas Kekoni       OH2MTF	    I                           -_
	_-internet:	jkekoni@cc.hut.fi   I       DO NOT EAT.         -_
	_-slowmail:	j{mer{ntaival 7a176 I                           -_
	_-		02150Espoo          I      It is a monitor      -_
	_-		Finland/Europe      I                           -_


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

Date: Thu, 21 May 1998 11:54:40 +0100
From: "Glenn Morgan" <gmorgan@photographics.co.uk>
Subject: Non-greedy regexp still eatting all the pies!
Message-Id: <6k10qp$c9s$1@news.u-net.com>

I'm having a problem trying to find a solution to the following :

I have some SGML like this

<cross-ref refid="tbl1">Table 1</cross-ref><tbl
id="tbl1"><tblbdy><r><c>text</tblbdy></tbl>A line of text between two table
elements<cross-ref refid="tbl2">Table 2</cross-ref><tbl
id="tbl2"><tblbdy><r><c>text</tblbdy></tbl><cross-ref refid="tbl3">Table
3</cross-ref><tbl id="tbl3"><tblbdy><r><c>text</tblbdy></tbl>

What I want to do is if there is a situation where a table cross-ref appears
between 2 tables, I want to move it to the front of the table elements.  I
would then have the following SGML.

<cross-ref refid="tbl1">Table 1</cross-ref><tbl
id="tbl1"><tblbdy><r><c>text</tblbdy></tbl>A line of text between two table
elements<cross-ref refid="tbl2">Table 2</cross-ref><cross-ref
refid="tbl3">Table 3</cross-ref><tbl
id="tbl2"><tblbdy><r><c>text</tblbdy></tbl><tbl
id="tbl3"><tblbdy><r><c>text</tblbdy></tbl>

I've tried the following regexp

s/(<tbl .*?<\/tbl>)(<cross-ref refid=\"tbl.*?<\/cross-ref>)(<tbl
 .+?>)/$2$1$3/

but I end up with this

<cross-ref refid="tbl1">Table 1</cross-ref><cross-ref refid="tbl3">Table
3</cross-ref><tbl id="tbl1"><tblbdy><r><c>text</tblbdy></tbl>A line of text
between two table elements<cross-ref refid="tbl2">Table 2</cross-ref><tbl
id="tbl2"><tblbdy><r><c>text</tblbdy></tbl><tbl
id="tbl3"><tblbdy><r><c>text</tblbdy></tbl>

I initially thought that <tbl .*?<\/tbl> wouldn't match from table 1 cos it
was non-greedy but I obviously interpreted this incorrectly and it is clear
to me now why it produced the results it did.  so I tried this

while ($bdy =~ /(<\/tbl>)(<cross-ref\s+refid
=\"tbl\d+\">.*?<\/cross-ref>)(<tbl\s)/)
{
   $before = $` . $1;
   $match = $2;
   $after = $3 . $';

   $before =~ s/(<tbl\s.*?<\/tbl>$)/$match$1/;
   $bdy = $before . $after;
}

I thought that if I anchored the match to the end of a line then the
non-greedy match would do the trick, but it was still eatting more pies than
I initially hoped it would.

<cross-ref refid="tbl1">Table 1</cross-ref><cross-ref refid="tbl3">Table
3</cross-ref><tbl id="tbl1"><tblbdy><r><c>text</tblbdy></tbl>A line of text
between two table elements<cross-ref refid="tbl2">Table 2</cross-ref><tbl
id="tbl2"><tblbdy><r><c>text</tblbdy></tbl><tbl
id="tbl3"><tblbdy><r><c>text</tblbdy></tbl>

It seems that if I could start match from the cross-ref and work back I'd be
ok, any ideas




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

Date: 21 May 1998 08:21:16 GMT
From: aajii@aajii.ton.tut.fi (Antti-Jussi Korjonen)
Subject: Re: Perl Net::Telnet()
Message-Id: <6k0o5s$rpp$1@baker.cc.tut.fi>

: That is odd. According to the documentation, which you have read all
: the way through, and not just to extract that little piece of example
: code, the prompt must match:

:          Password prompts must match the pattern:

:              /password[: ]*$/i

: If your linux box does indeed have the prompt 'Password:', then there
: shouldn't be any problems. Now.. What does it have as prompt?

: > $t = new Net::Telnet (Timeout => 10, Prompt => '/bash\$ $/');

: Is this actually a regexp for the command prompt you will be expecting?

No, the prompt I'm expecting is:
aajii% 
In my code the Prompt is '/aajii% /' The SUN's got a different prompt: 
korppi 23%
korppi 24%
etc...
so, the Prompt there is '/korppi \d\d% /' and it works just fine.
It should log in before it starts waiting for the Prompt, shouldn't it?
And it doesn't do that on my linux.

--
  
         __/                __/ __/  __/     Antti-Jussi Korjonen
      __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
    __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
  __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
                                         Antti-Jussi.Korjonen@sonera.fi
   --------->>  http://www.students.tut.fi/~k150556  <<---------
     


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

Date: Thu, 21 May 1998 09:20:33 +0000
From: Darren Nguyen <darren2@jps.net>
Subject: samba log files
Message-Id: <3563F1E1.57982B06@jps.net>


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

Hi,
    I have to do a program that will parse the samba log files. I
understand that I need to do multi-dimensional arrays. I have to
calculate when the user logs in and then logs out all in seconds.
Problem is one line states when they connect and the second line states
when the service closes.  So how do I calculate two numbers on two
different lines and reference that to only that service or user.  Does
this make sense??


--
reply to nguyec04@student.ucr.edu
or darren2@jps.net



--------------42E9B16829BF38F6DA3F0BB7
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hi,
<BR>&nbsp;&nbsp;&nbsp; I have to do a program that will parse the samba
log files. I understand that I need to do multi-dimensional arrays. I have
to calculate when the user logs in and then logs out all in seconds.&nbsp;
Problem is one line states when they connect and the second line states
when the service closes.&nbsp; So how do I calculate two numbers on two
different lines and reference that to only that service or user.&nbsp;
Does this make sense??
<BR>&nbsp;
<PRE>--&nbsp;
reply to nguyec04@student.ucr.edu
or darren2@jps.net</PRE>
&nbsp;</HTML>

--------------42E9B16829BF38F6DA3F0BB7--



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

Date: Thu, 21 May 1998 10:58:37 -0700
From: Marcia L Sussman <pi83@dial.pipex.com>
Subject: Writing to files
Message-Id: <35646B4D.45C3@dial.pipex.com>

I have a program which opens a file for reading, closes it again, 
then re-opens the file for writing and writes the information
with additions. This should be easy, and it works 99% of the
time.
But occasionally the file becomes empty. Why???
I'm locking the files whilst in use and closing them properly.
Anyone else had this problem? Any ideas?
Thanks
Marcia Vigar
-- 
marcia.vigar@reed.co.uk


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

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

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