[13405] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 815 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 16 04:07:21 1999

Date: Thu, 16 Sep 1999 01:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937469109-v9-i815@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 16 Sep 1999     Volume: 9 Number: 815

Today's topics:
        better way ? tvn007@my-deja.com
        can i get a witness? <jcweiss@cats.ucsc.edu>
    Re: can i get a witness? <ehpoole@ingress.com>
    Re: can i get a witness? (Abigail)
    Re: can i get a witness? <madebeer@debeer.org>
    Re: Can Perl talk to Javascript?? <madebeer@igc.apc.org>
    Re: CGI cannot open relative path <ehpoole@ingress.com>
    Re: End Of File <ehpoole@ingress.com>
    Re: End Of File (Abigail)
    Re: Help with game level tool (Jeff Ross)
        Help! Can't install Pg module <madings@baladi.nmrfam.wisc.edu>
    Re: Help! Can't install Pg module <madings@baladi.nmrfam.wisc.edu>
        Homeworkers Needed! mowhco@att.net
    Re: How to delete previous four lines and handle a head <pantau@zedat.fu-berlin.de>
    Re: Installing Tk module failed. Please help. <pantau@zedat.fu-berlin.de>
    Re: need to write www search engine <gremlin_NO_SPAM_@ix.netcom.com>
        Perl SYstem Functions Problem forseti78@hotmail.com
    Re: Procedure result inheritance <krajzewicz@inx.de>
        send mail perl->OLE->Lotus feketeroland11@my-deja.com
        Splitting a line and honoring "strings" <nospam@hss.hns.com>
    Re: Text Parsing - How to Multi-Line? (Martien Verbruggen)
    Re: Tk.pm <pantau@zedat.fu-berlin.de>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 16 Sep 1999 07:48:32 GMT
From: tvn007@my-deja.com
Subject: better way ?
Message-Id: <7rq7cd$skt$1@nnrp1.deja.com>

Hi,

I think there must be a better way (shorter way) of writing the
code below.

Would someone please help me ?

Thanks in advance for your help,

######################################################


open(DATA_WSP,$in="s00.pad") || die "cannot open input file: $in\n";
while (<DATA_WSP>) {

	if($_ =~ /spec/){

           $_ =~ tr/("//d;

           ($name,$spec_file) = split (' ',$_,3);

		if ($spec_file =~ /dc/){

	($spec_db_file,$ext) = split (/\./,$spec_file,2);

	$dc_specadr_file = $spec_db_file.".specadr";
	print "DC name is $dc_specadr_file\n";
			}

	elsif ($spec_file =~ /ac/){
	($spec_ac_db_file,$ext) = split (/\./,$spec_file,2);
	$ac_specadr_file = $spec_ac_db_file.".specadr";
	print "AC name is $ac_specadr_file\n";
		}
	}
	}


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 15 Sep 1999 22:07:22 -0700
From: Jonathan Cooper Weiss <jcweiss@cats.ucsc.edu>
Subject: can i get a witness?
Message-Id: <Pine.SUN.3.91.990915213855.8387A-100000@si.UCSC.EDU>

hi there,

i'm just looking for a little illumination on the following situation.

i've been programming in PERL for about 4 years now. recently, i worked on
a project for (yet another) up-and-coming e-commerce site.  essentially, i
built an entire e-commerce solution from the ground up using mod_perl,
apache (of course) and mysql. the system took advantage of persistant
database connections (launched on server start up) and extremely object
oriented PERL, the libraries for which were also loaded on start up. the
system also included a custom built DB parser providing for extremely
standard HTML creation of both administrative and client front ends. 
ultimately, the system seemed quite fast and robust to me -- even on the
none-too-posh linux laptop i was developing it on.

anyway, i have since left the project (due to previous time commitments)
only to be informed by my past employers that their potential new guy
seems to think that PERL is a bad choice for such systems. memory issues
notwithstanding (i figured it was worth a little RAM for the performance
benifits of the preloaded code and DB connections), i find it hard to
believe that a C solution (which is the only "superior" alternative i can
imagine he was talking about) would be incomparably better. not having a
really deep understanding of the internals (and having been semi out of
the biz for 8 months), i was wondering if i could get some more input on
this -- at least for my own sense of where things stand. 

thanks,
jonathan


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

Date: Thu, 16 Sep 1999 01:44:06 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: can i get a witness?
Message-Id: <37E083A6.BD762E49@ingress.com>

Jonathan Cooper Weiss wrote:
> 
> hi there,
> 
> i'm just looking for a little illumination on the following situation.
> anyway, i have since left the project (due to previous time commitments)
> only to be informed by my past employers that their potential new guy
> seems to think that PERL is a bad choice for such systems. memory issues
> notwithstanding (i figured it was worth a little RAM for the performance
> benifits of the preloaded code and DB connections), i find it hard to
> believe that a C solution (which is the only "superior" alternative i can
> imagine he was talking about) would be incomparably better. not having a
> really deep understanding of the internals (and having been semi out of
> the biz for 8 months), i was wondering if i could get some more input on
> this -- at least for my own sense of where things stand.

Well, C can certainly blow away Perl under the proper circumstances
(though in many instances Perl code can be manually optimized to reduce
the discrepency). However, C generally takes *many* times longer to code
and debug than does a similar Perl script.

However, a C solution coupled with a Server API hook can be very high
performance.  It can also bring down the webserver if there are any bugs
though.  Sheer performance often comes with a price.

Personally, I use both languages where appropriate.  For most projects,
though, I tend to prefer Perl for ease of use, portability, and much
quicker turnaround.  It doesn't matter how good a C programmer one is, for
a typically small-to-moderate performance penalty Perl scripts can be
turned out in a fraction of the time.

Unless your previous project *genuinely* needs to be highly optimized for
performance and memory use, the odds are the new programmer doesn't know
Perl and, as such, chooses to make a mockery of previous work to cover up
their ignorance.

"If all you have is a hammer, then every problem will be a nail."

FWIW, the same can be said of programmers who know only Perl.  To them
Perl will be the "perfect" solution to every problem and they will
disregard any facts to the contrary.  This is a common theme in many
programming languages where a programmer only knows a single language and
has no desire to learn new languages based upon the project's demands. 
Even Perl isn't written in Perl.

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: 16 Sep 1999 01:24:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: can i get a witness?
Message-Id: <slrn7u13eq.i4j.abigail@alexandra.delanet.com>

Jonathan Cooper Weiss (jcweiss@cats.ucsc.edu) wrote on MMCCVII September
MCMXCIII in <URL:news:Pine.SUN.3.91.990915213855.8387A-100000@si.UCSC.EDU>:
`` hi there,
`` 
`` i'm just looking for a little illumination on the following situation.
`` 
`` i've been programming in PERL for about 4 years now. recently, i worked on

And you still don't know how to spell it.

`` a project for (yet another) up-and-coming e-commerce site.  essentially, i
`` built an entire e-commerce solution from the ground up using mod_perl,
`` apache (of course) and mysql. the system took advantage of persistant
`` database connections (launched on server start up) and extremely object
`` oriented PERL,

What is "extremely object oriented Perl"? How does that differ from OOP?

``                the libraries for which were also loaded on start up. the
`` system also included a custom built DB parser providing for extremely
`` standard HTML creation of both administrative and client front ends. 

Extremely standard HTML creation? What the hell is that?

`` ultimately, the system seemed quite fast and robust to me -- even on the
`` none-too-posh linux laptop i was developing it on.

Hmmm. I wonder, how did you simulate large amounts of requests on a laptop?

`` anyway, i have since left the project (due to previous time commitments)
`` only to be informed by my past employers that their potential new guy
`` seems to think that PERL is a bad choice for such systems. memory issues
`` notwithstanding (i figured it was worth a little RAM for the performance
`` benifits of the preloaded code and DB connections), i find it hard to
`` believe that a C solution (which is the only "superior" alternative i can
`` imagine he was talking about) would be incomparably better. not having a
`` really deep understanding of the internals (and having been semi out of
`` the biz for 8 months), i was wondering if i could get some more input on
`` this -- at least for my own sense of where things stand. 

So, you don't even know what the new person was proposing. Why don't
you first talk to him? Furthermore, you've told us what you used,
but you haven't said what the system should do, and what the resource
requirements are.

How on earth do you expect this group to give an answer whether your
preferred setup would be at least as good as the other persons suggestion?



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Sep 1999 00:24:50 -0700
From: Michael de Beer <madebeer@debeer.org>
Subject: Re: can i get a witness?
Message-Id: <37e09b42@debeer.org>

> i find it hard to
> believe that a C solution (which is the only "superior" alternative i can
> imagine he was talking about)

'i can imagine' is dangerous here.  

Maybe the superior-ness of the alternative is something tangible but
not related to speed.  Maybe the new person has used a package that he
has a good reason to believe would be more sustainable than
proprietary perl code that only exists in one corporation.  I program
in Perl every day, and I love the language, but Zope's Portal Toolkit
looks pretty cool too!  Perl doesn't have a monopoly on good ideas.

Of course, there is always the possibility the new guy just has 
more fun programming new code than maintaining old code. ;)

Cheers,
-Michael


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

Date: Wed, 15 Sep 1999 21:09:18 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: Can Perl talk to Javascript??
Message-Id: <APC&1'0'50775dac'252@igc.apc.org>

>>wolflake wrote:
>>## My question is how could perl talk to javascript if cookies were
>>## disabled?

http://www.wddx.org/ has great libraries for sharing data.

There are perl and javascript functions that unpack WDDX packets
into their native variables, and vice versa, pack their variables 
into WDDX packets that can be exchanged lots of different ways.

For example: 

 * a web page with javascript could call an 'onSubmit' function to 
   package up information available to it as a WDDX packet.
   This WDDX packet would be like a hidden field that is passed to 
   a perl CGI script.

 * a perl CGI script that outputs an HTML page containing javascript
   can 'embed' perl variables as WDDX packets that the javascript can
   use.

Much better docs at http://www.wddx.org/ ;)

>Abigail wrote:
>if JavaScript program is being run inside a browser,
>you need to figure out how to communicate with the browser, not to 
>JavaScript directly.

Yes, this is a good point.  My examples are most applicable assuming
wolflake meant Javascript in a browser.  WDDX, however, is a good data
exchange format regardless of the 'transport' between the programs. 

-Michael






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

Date: Thu, 16 Sep 1999 01:13:05 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: CGI cannot open relative path
Message-Id: <37E07C61.AFF74B3B@ingress.com>

Kragen Sitaker wrote:
> 
> In article <7rp5vp$9dj@dfw-ixnews8.ix.netcom.com>,
> Eric Bohlman <ebohlman@netcom.com> wrote:
> >Even better: make $rootdir (which might just be the name of the directory
> >to chdir() to) a global variable (use vars '$rootdir'), assign it in a
> >file (e.g. rootdir.pl) that does nothing but assign it, and then require
> >that file in each script.  Now any group of scripts that share the same
> >root can be moved with only *one* change in one place.
> 
> How do you require it?  Either using a relative pathname (which,
> according to the original poster, doesn't work to open files, so it
> probably won't work to require them either) or using an absolute
> pathname.  Which will have to be changed.  In every file that requires
> rootdir.pl.

In many instances, you can calculate the base directory of your executing
script by examining $0 ($ zero).

Otherwise, there is no simple solution.  The CGI specs do not define what
the default directory should be so each webserver (and even different
releases of the same server) may behave slightly differently in this
regard.

Writing a script that does not require any editing no matter the platform
(nor how foreign the platform may be to the development platform) is never
trivial, nor is it likely to be anytime in the near future.  All you can
do is design a script with as much intelligence as possible and make
certain the user has the ability to correct it if it should guess wrong.
-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: Thu, 16 Sep 1999 01:46:55 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: End Of File
Message-Id: <37E0844F.A475B6E9@ingress.com>

Kragen Sitaker wrote:
> 
> In article <7rpgrh$cun$1@lobster.vol.net>,
> eX-HTML <spam-me-sydneyfong@yahoo.com> wrote:
> >what should *not end-of-file* be in the script?
> 
> <MYFILE>, which will also read the next line into $_.  Read perldoc
> perlop, especially the section about I/O operators.  Also consider
> reading the FAQs.

It wouldn't hurt to test that <MYFILE> returns a defined value.  Otherwise
you could potentially abort prematurely if the last line contained only a
'0' (zero) character.

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: 16 Sep 1999 01:26:39 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: End Of File
Message-Id: <slrn7u13hs.i4j.abigail@alexandra.delanet.com>

Ethan H. Poole (ehpoole@ingress.com) wrote on MMCCVII September MCMXCIII
in <URL:news:37E0844F.A475B6E9@ingress.com>:
{} Kragen Sitaker wrote:
{} > 
{} > In article <7rpgrh$cun$1@lobster.vol.net>,
{} > eX-HTML <spam-me-sydneyfong@yahoo.com> wrote:
{} > >what should *not end-of-file* be in the script?
{} > 
{} > <MYFILE>, which will also read the next line into $_.  Read perldoc
{} > perlop, especially the section about I/O operators.  Also consider
{} > reading the FAQs.
{} 
{} It wouldn't hurt to test that <MYFILE> returns a defined value.  Otherwise
{} you could potentially abort prematurely if the last line contained only a
{} '0' (zero) character.


Not in modern Perls.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 16 Sep 1999 05:43:36 GMT
From: ross@eidetic.com (Jeff Ross)
Subject: Re: Help with game level tool
Message-Id: <CD7D466755B8C4A0.ABCD72D038167A58.C6D61C3488F0F1AF@lp.airnews.net>

Well I am not really having a problem other than the fact that I don't
know perl.  ;-)

The or die is about as savvy as I get.  I realize I am basically
asking someone to practically write this entire thing for me.  

If you're seriously interested in helping let me know and I can take a
pass at redfingin my needs.

Thanks in advance.

-Jeff Ross
eidetic

On Tue, 14 Sep 1999 14:07:44 GMT, kragen@dnaco.net (Kragen Sitaker)
wrote:

>In article <6B81952AF2FE0C4D.2575BEF842CB7A36.2D211023EE61ADF9@lp.airnews.net>,
>Jeff Ross <ross@eidetic.com> wrote:
>>can someone take a shot at this script for me? 
>
>One piece at a time.  Which part are you having trouble with at the moment?
>
>>chomp ($LEVELNAME = <STDIN>);
>>	open(HOGFILE, "z:\\hogs\\$LEVELNAME\\wldemd.h") or die "Can't
>>open file $LEVELNAME, check name and try again.\n\n";
>
>Very good.  You might want to include $! in there so the user can see
>why it failed.
>
>>I want to take some values from these files and do some math.
>
>print <LEVDATA> + <LEVDATA>;
>
>>(cut and paste the data to make your own local file)
>
>So I can follow up to your post?  I don't even know you!
>
>Kragen



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

Date: 16 Sep 1999 07:16:47 GMT
From: Steve Mading <madings@baladi.nmrfam.wisc.edu>
Subject: Help! Can't install Pg module
Message-Id: <7rq5gv$duq$1@news.doit.wisc.edu>

I'm trying to install the Pg module so I can have perl programs
talk to a Postgres database.  The problem is that it doesn't
seem complete somehow.

(Oh, btw, this is Redhat 6.0 Linux)

After installing all the postgress rpm's, the Pg.pm file is under
the name /usr/lib/perl5/site_perl/Pg.pm.  I add the directory
to the path when executing perl, like so:

   perl -I/usr/lib/perl5/site_perl  myprog.pl

This doesn't work - I get this error message:

Can't load '/usr/lib/perl5/site_perl/i386-linux/auto/Pg/Pg.so' for module Pg: /usr/lib/perl5/site_perl/i386-linux/auto/Pg/Pg.so: undefined symbol: Perl_markstack_ptr at /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.

(This error comes on the first line number where I say "use Pg;")

According to the README that came with the CPAN package, this
error message indicates a missing "libpg.so", but I looked and I
have a 'libpg.so' and it is properly ldconfigged (I redid ldconfig
many times in frustration, and it isn't in some weird directory or
anything - it's right there in /usr/lib so I know it's finding it.
(which a ldconfig -v verifies.) )

Does anyone know what I am doing wrong?



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

Date: 16 Sep 1999 07:35:05 GMT
From: Steve Mading <madings@baladi.nmrfam.wisc.edu>
Subject: Re: Help! Can't install Pg module
Message-Id: <7rq6j9$11t4$1@news.doit.wisc.edu>


Hello, responding to my own message here.

It seems like the first rule of usenet help groups is that
as soon as you post your question, the answer will come to you
in minutes.

Well, to answer my own question: the problem was that Redhat's
rpm's for postgres like to install the include files in a nonstandard
way - into /usr/include/pgsql/*.h  This was confusing the Makefile.pl
in the CPAN module I was trying to make.  But I didn't notice right
away and tried using the 'installed' version anyway, which was actually
a previously halfway installed version from yesterday's aborted attempt
at this.

I had to add /usr/include/pgsql to the Makefile.PL of the pgsql_perl
download and then install that.  now it works peachy.


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

Date: Wed, 15 Sep 1999 17:45:16
From: mowhco@att.net
Subject: Homeworkers Needed!
Message-Id: <694.682260.308059@ns.bigbear.net>

Dear Future Associate,

You Can Work At Home & Set Your Own Hours.  Start earning Big 
Money in a short time
       
                                    NO Newspaper Advertising!

Your job will be to stuff and mail envelopes for our company. You 
will receive $.25 for each and every envelope you stuff and mail 
out.

Just follow our simple instructions and you will be making money 
as easy as
1… 2… 3

For example stuff and mail 200 envelopes and you will receive 
$50.00. Stuff and mail 1000 and you will receive $250.00. Stuff 
and mail 2000 and you will receive $500.00 and more 

Never before has there been an easier way to make money from 
home!

Our Company's Home Mailing Program is designed for people with 
little or no experience and provides simple, step by step 
instructions.  

There is no prior experience or special skills necessary on your 
part, Just stuffing envelopes.

We need the help of honest and reliable home workers like you.  
Because we are overloaded with work and have more than our staff 
can handle. We have now expanded our mailing program and are 
expecting to reach millions more with our offers throughout the 
US and Canada.

Our system of stuffing and mailing envelopes is very simple and 
easy to do!
You will not be required to buy envelopes or postage stamps.

We will gladly furnish all circulars at no cost to you. We assure 
you that as a participant in our program you will never have to 
mail anything objective or offensive. 

There are no quotas to meet, and there no contracts to sign. You 
can work as much, or as little as you want. Payment for each 
envelope you send out is Guaranteed!

Here is what you will receive when you get your first Package.  
Inside you will find 100 envelopes, 100 labels and 100 sales 
letters ready to stuff and mail

As soon as you are done with stuffing and mailing these first 
letters, your payment will arrive shortly, thereafter. All you 
have to do is to order more free supplies and stuff and mail more 
envelopes to make more money.

Our sales literature which you will be stuffing and mailing will 
contain
information outlining our highly informative manuals that we are
advertising nationwide.  As a free gift you will receive a 
special manual valued at  $24.95, absolutely free, just for 
joining our Home Mailers Program.

Plus you will get your own special code number, so that we will 
know how much you are to get paid.  And to make re-ordering of 
more envelopes, that our company supplies very simple for you.

We are giving you this free bonus because we want you to be 
confident in our company and to ensure that we will be doing 
business with you for a long time.

Benefits Of This Job:

1. You do not have to quit your present job, to earn more money 
at home
2. You can make between $2,500 to $4,500 a month depending on the 
amount of time you are willing to spend stuffing and mailing 
envelopes
3. This is a great opportunity for the students, mothers, 
disabled persons or those who are home bodies.

To secure your position and to show us that you are serious about 
earning extra income at home we require a one-time registration 
fee of $35.00.
This fee covers the cost of your initial start up package,  which 
includes 100 envelopes, 100 labels and 100 sales letters and a 
manual, your registration fee will be refunded back to you 
shortly thereafter.

Money Back Guarantee!

We guarantee that as soon as you stuff and mail your first 300 
envelopes You will be paid $75.00 and your registration fee will 
be refunded.

Many of you wonder why it is necessary to pay a deposit to get a 
job. It is because we are looking for people that seriously want 
to work from home.  

*  If 3.000 people told us they wanted to start working from home 
and we sent out 3.000 packages free to every one.  And then half 
of the people decided not to work, this would be a potential loss 
of more than $60,000 in supply's and shipping that we have sent 
out to people that don't want to work

We have instituted this policy to make sure that you really want 
to work and at least finish your first package.

To Get Started Today Please Enclose Your Registration Fee of $35
Check,Cash Or Money Order and fill out the application below and 
mail to:

MOHW Co	
PMB
11054 Ventura Blvd #126	
Studio City, CA 91604

Name_____________________________________________________

Address___________________________________________________

City____________________________________ State______________

Zip Code________________

Telephone Number(s)_________________________________________

E-mail Address______________________________________________



For all orders, please allow seven (7) days for delivery and up 
to 10 days. Cash and Money Orders will result in faster shipping 
of your package.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



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

Date: Thu, 16 Sep 1999 09:21:43 +0200
From: Hans-Georg Thien <pantau@zedat.fu-berlin.de>
Subject: Re: How to delete previous four lines and handle a header in a streaming  input?
Message-Id: <37E09A87.A3023FB4@zedat.fu-berlin.de>



Mike schrieb:
> 
> Hi all,
> 
> 1.  I want the script to be able to simply reprint all lines *EXCEPT* for
> when one
> certain pattern is matched on a line, in which case I want that line and
> previous
> three lines to not be printed out.

hi mike,

you are right, this is not quite easy at the first glance ...
but this should work with the following idea: 

have a buffer containing the last 4 lines. If the buffer contains more
then 4 lines, then print the first item and remove it. If the current
line contains your pattern, then delete the whole buffer. 


my @buf=();
my $line="";
my $bufsize=4;

while (<>)
{
  push (@buf, $_);

  #if buffer is full, then remove the first bufferitem and print it
  if (@buf > $bufsize)
  {
      $line=shift(@buf);
      print $line;
  }

  #pattern was found, - delete the buffer containing the last 4 lines
  if (/pattern/)
  {
     print STDERR "found pattern, deleting buffer\n";
     @buf=();
  }
}

#some lines maybe left in buffer, - print them out
foreach $line (@buf)
{
  print $line;
}

I hope this helps - hans


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

Date: Thu, 16 Sep 1999 09:39:53 +0200
From: Hans-Georg Thien <pantau@zedat.fu-berlin.de>
Subject: Re: Installing Tk module failed. Please help.
Message-Id: <37E09EC9.61288959@zedat.fu-berlin.de>



zzhang schrieb:
> 
> I downloaded Tk800.015.tar.gz from a CPAN mirror site and saved it in an
> empty directory. I used the following commands to decompress and unpack it:
>     Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.so.6.1
>     Cannot find X include files via /usr/X11R6/include
>     Cannot find X include files anywhere at ./myConfig line 318.
>     BEGIN failed--compilation aborted at Makefile.PL line 19.
> The O.S. is Red Hat Linux 6.0.
> Does anybody know what's wrong? Thanks.

Maybe ;-)

It seems that you do not have X11 installed ? I don't know Red Hat
Linux, but there should be a package manager or setup tool. Just use it
to install X11 and try again.

Hope this helps, - hans


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

Date: Thu, 16 Sep 1999 01:06:11 -0400
From: gremlin <gremlin_NO_SPAM_@ix.netcom.com>
Subject: Re: need to write www search engine
Message-Id: <37E07AC3.BDE22F61@ix.netcom.com>

This is a total guess, so I guess it is as much a question as an
answer.  But why not have your crawlers start off by working from a
result list for "URL:gov" or whatever the exact syntax is from
AlstaVista, etc.?  This way you let the big search engines do some of
the up front work for you.  You might even be able to be more specific
for your "chunks", e.g., "URL: *NOAA*.gov".  The crawlers could build
their own list/database of links by extracting them from the sites as
you search them.  Is this totally stupid?  Wouldn't be the first time :)

Mike


Roger Jacques wrote:
> 
> I want to write a robot program that will search all www sites by
> domain type and return the <title>.


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

Date: Thu, 16 Sep 1999 05:35:04 GMT
From: forseti78@hotmail.com
Subject: Perl SYstem Functions Problem
Message-Id: <37e08063@news.asgard.net.au>

Hi,

I am having difficulty gett (ps -aux | grep program) to run from perl and 
store the output in a file or array.
I need to check if the program is running and if so kill it.

Can anyone help me out with the syntax for this???

Also could someone please help me out with the syntax for starting a program 
from perl that will continue running after perl exits??

TIA
Travers
"Experiance is what you get when you didnt get what you wanted"


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

Date: Thu, 16 Sep 1999 08:04:48 +0200
From: Daniel Krajzewicz <krajzewicz@inx.de>
To: Daniel Krajzewicz <krajzewicz@inx.de>
Subject: Re: Procedure result inheritance
Message-Id: <37E08880.B03B47AC@inx.de>

Hello !!!

Well, actually I'm working for a biiiiiiiig internet company and write
some basic perl-scripts, I hope you'll be able to see them in some days
in action...
Anyway, the purpose for returning the result and the rrorcode is the
that I'll be able to collect all errors and give them out on a HTML-page
if they occure...

see ya,
Daniel Krajzewicz


Kragen Sitaker wrote:
> 
> In article <37DF5239.A2C20FDE@inx.de>,
> Daniel Krajzewicz  <krajzewicz@inx.de> wrote:
> >Let's say I#m constructing a set of modules - I can just animate you to
> >do this.
> 
> Please don't animate me.  I'm animated enough as it is :)
> 
> >I wish to have a simple error-handler which works in the following way :
> >Each modules only expor the variable "result" and "error". When an error
> >occures,
> >the variable "error" holds the word "true" and result the
> >error-description.
> >On no error "error" contains "false" and "result" the result of the
> >procedure.
> >So far about the technics, now two questions :
> >1. Is this nonsence ?? Is there a better way for an error-handler ?
> 
> It depends on what you want out of the error handler.  "return undef"
> and "die" are two popular ways of returning errors in Perl, and "croak"
> -- from the Carp module -- is popular for telling your caller that they
> called you incorrectly.  "return" is a popular way of returning the
> result of a procedure.
> 
> I can't think of a situation in which what you describe would be
> better, but maybe you have one :)
> 
> >2. Is there a possibility to map both variables onto the same calling
> >variables, that means when an error occures in a submodule,
> >automatically the same variables in the caller will be set ??
> 
> Sounds like you want "die" or "croak".
> 
> I'm not sure what "calling variables" are.  But you can export
> variables into every module that uses them so that every module ends up
> having '$result' and '$error' point to the same variable (or not point
> to anything).
> 
> Kragen
> --
> <kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
> Tue Sep 14 1999
> 55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
> <URL:http://www.pobox.com/~kragen/bubble.html>

-- 
 __________________________
<     Daniel Krajzewicz    >
 >------------------------<
<     krajzewicz@inx.de    >   
 >------------------------<
< http://www.art-so-far.de >
 >------------------------<
<__________________________>


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

Date: Thu, 16 Sep 1999 07:25:24 GMT
From: feketeroland11@my-deja.com
Subject: send mail perl->OLE->Lotus
Message-Id: <7rq60s$rsv$1@nnrp1.deja.com>

Can anybody help me???
How can I send email from perl with lotus notes via ole?
I haven't got any idea!!!

Thanks for the time!
Roland


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 16 Sep 1999 18:16:19 +0530
From: "Lokesh Setia" <nospam@hss.hns.com>
Subject: Splitting a line and honoring "strings"
Message-Id: <m2k8pr6n38.fsf@gsetia.hss.hns.com>


Hi,

I have to parse a line whose fields are splitted into spaces,

>> # My Code
print "Please enter the line: ";
chop ($line = <stdin>);
>>

The user enters:
yellow brown black green blue

This line would be splitted into an array of 5 elements by,
@line = split ' ', $line;

What I want is to honor the quotes "" and '' withing the user line
so that the user can embed spaces in the values: like,

blue "light pink" "dark blue" green 'navy blue'

Is there an inbuilt perl function that would help me achieve this?

Thanks and regards,
Lokesh.


-- 

/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/      .--.      |                                             _/ 
_/     |o_o |     |   Name : Lokesh Setia                       _/
_/     |:_/ |     |   E-mail : nospam@hss.hns.com               _/
_/    //   \ \    |   Tel : 91-346666-2391                      _/
_/   (|     | )   |   #include <sys/disclaimer.h>               _/
_/  /'\_   _/`\   |   Org : Hughes Software Systems             _/
_/  \___)=(___/   |                                             _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



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

Date: Thu, 16 Sep 1999 06:39:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Text Parsing - How to Multi-Line?
Message-Id: <Og0E3.207$E%1.14186@nsw.nnrp.telstra.net>

In article <37E03425.7F63A5CF@cisco.com>,
	Makarand Kulkarni <makkulka@cisco.com> writes:

>                                 $line4 = <DATA>; #lose this line

If you want to 'lose this line', why do you store it in a global
variable that doesn't get cleaned up until program exit? Why store it
at all?

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.       | bundled with your Microsoft product.
NSW, Australia                      | 


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

Date: Thu, 16 Sep 1999 09:36:06 +0200
From: Hans-Georg Thien <pantau@zedat.fu-berlin.de>
Subject: Re: Tk.pm
Message-Id: <37E09DE6.133CD164@zedat.fu-berlin.de>



blks schrieb:
> 
> I have a couple of questions relating to PERL/TK.
> 
> First, is the Tk.pm module installed on a Linux 5.2 machine? and if so does
It depends on your distribution

> anyone know where?
perl -V  prints your configuration. The Tk modules are normally located
in something like 

  /usr/lib/perl/site_perl
  /usr/lib/perl/perl.500x

If you cannot figure it out try

unx>
unx> cd /usr/lib/perl
unx> find . -name Tk.pm
unx>

> Second, at the perl.com site (CPAN) their is a list of TK modules for PERL,
> but which one should I get and install?
http://www.cpan.org/modules/01modules.index.html/Tk800.015.tar.gz


> Third, if I install a new Tk.pm module, must I recompile PERL to use it?
no

I hope this helps - Hans


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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