[24168] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6360 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 4 06:06:03 2004

Date: Sun, 4 Apr 2004 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 4 Apr 2004     Volume: 10 Number: 6360

Today's topics:
    Re: count files + dirs CORRECTED <Joe.Smith@inwap.com>
    Re: free source for bbs <uri@stemsystems.com>
    Re: free source for bbs <webmaster@infusedlight.net>
    Re: free source for bbs <uri@stemsystems.com>
    Re: free source for bbs <tassilo.parseval@rwth-aachen.de>
    Re: free source for bbs <Joe.Smith@inwap.com>
    Re: graph smoothing... <Joe.Smith@inwap.com>
    Re: just curious about perl coders <uri@stemsystems.com>
    Re: just curious about perl coders <tassilo.parseval@rwth-aachen.de>
    Re: just curious about perl coders <Joe.Smith@inwap.com>
    Re: Need help with a Perl Script Error <Joe.Smith@inwap.com>
    Re: PERL to VBScript help <rpresser@NOSPAM.imtek.com.invalid>
    Re: real, simple sample OOP intro text??!! <geoffacox@dontspamblueyonder.co.uk>
    Re: real, simple sample OOP intro text??!! <uri@stemsystems.com>
    Re: real, simple sample OOP intro text??!! <geoffacox@dontspamblueyonder.co.uk>
    Re: real, simple sample OOP intro text??!! <geoffacox@dontspamblueyonder.co.uk>
    Re: real, simple sample OOP intro text??!! <tassilo.parseval@rwth-aachen.de>
    Re: Sad experience with redirecting to /dev/null <Joe.Smith@inwap.com>
        Search and replace a string in files (Kapil Khosla)
    Re: test <uri@stemsystems.com>
    Re: test <tassilo.parseval@rwth-aachen.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 04 Apr 2004 08:55:33 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: count files + dirs CORRECTED
Message-Id: <94Qbc.182996$po.992444@attbi_s52>

GreenLight wrote:

> 	my $full_name = $dir . $file_name;
> 	if (-f $full_name) {
> 		$file_count++;
> 	} elsif (-d $full_name) {
> 		$dir_count++;
> 	}

For DOS, I would use:

	if (-d $full_name) {
		$dir_count++;
	} else {
		$file_count++;
	}

For Unix, I would use:

	if (-f $full_name) {
		$file_count++;
	} elsif (-d $full_name) {
		$dir_count++;
	} else {
		$special_count++;
	}

The poing being that there are more than just files and directories
in some operating systems.
	-Joe


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

Date: Sun, 04 Apr 2004 05:37:53 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: free source for bbs
Message-Id: <x7brm8i9qn.fsf@mail.sysarch.com>

>>>>> "R" == Robin  <webmaster@infusedlight.net> writes:

  R> should abandon programming, but why? There's no good reason for
  R> abandoning something once you've started and already have a
  R> backbone of knowledge for it.

you should abandon it because you have no skills and have show a
proclivity for not listen to those who have them. that does not portend
to your developing to be a good coder. you have no sense of what is
right or wrong about code. you have no sense about why your code is
broken in many ways. no one in their right mind will want your code. it
makes much of the kiddie scriptware out their look good.

now i feel like i want to dabble in brain surgery. i will watch a bunch
of movies and some discovery channel programs. that should be enough to
get started. do you want to me my first victim^Wpatient?

that is how we look at your work. it is amateurish to an extreme. get it
already. you will never be a good coder as you just don't get what it is
about.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Sat, 3 Apr 2004 21:53:23 -0800
From: "Robin" <webmaster@infusedlight.net>
Subject: Re: free source for bbs
Message-Id: <c4o9h6$rqh$1@reader2.nmix.net>

I think you're on some sort of vendetta against me...please don't become a
brain surgeon...hehe...
-Robin




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

Date: Sun, 04 Apr 2004 07:20:30 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: free source for bbs
Message-Id: <x7y8pcgqf5.fsf@mail.sysarch.com>

>>>>> "R" == Robin  <webmaster@infusedlight.net> writes:

  R> I think you're on some sort of vendetta against me...please don't become a
  R> brain surgeon...hehe...

i won't if you won't try to be a programmer. there are already too many
coders in the field who don't know anything. you are just another
statistic. you will be so much smarter if you realize how little about
coding you know. besides all the security problems and lack of cgi
understanding, you lack the basics of simple coding like scoping, api
design and more. but you insist on claiming you know stuff when you
don't. only unelected presidents can make such false claims and get away
with it.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 4 Apr 2004 08:01:54 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: free source for bbs
Message-Id: <c4ofdi$q6e$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Robin:

> Well, it hasn't been hacked again in about half a day, I know how they did
> it the first time, fixed that, and I know how they did it the second time
> because my password for the admin script was something easily guessable, but
> the last time must have been done with some sort of exploiter script that
> submitted a lot of stuff through my forms through http. Can someone tell me
> a few lines of code I could use in the script - www.infusedlight.net/bbs/
> (download here) that would prevent it from being insecure, I know this is
> asking a lot, but I'd like to be able to be running a good, safe, secure
> message board system. In any event, I have a feeling that it might be really
> exploited soon now that I have a feature to mail posts to you, hopefully
> that doesn't happen. I also have a feeling that to get a secure script
> written I'll have to start over from scratch.

You have to take a few step backwards. At this point it is not so much
about Perl itself. Your first step must be getting familiar with all the
pitfalls in the field of web-programming and CGI. Start at

    <http://www.perl.org/CGI_MetaFAQ.html>

There are several topics. The first two (FAQs and Security) are
indispensable. Read a few (or even all of them) from top to bottom.

After that, read the documents relating to CGI and Perl in particular.
Sooner or later (but probably rather soon) they will mention CGI.pm
which is the module you should be using. Using that alone will eliminate
quite a few security holes.

> Password files are no longer world readable.

Well, that's already a start, isn't it?

> BTW, I'm a he-novice not a she- if you'd like to see some of the stuff I do
> as my main field of practice, writing, go to
> http://www.infusedlight.net/robin/stories.shtml - I know you're gonna say I
> should abandon programming, but why? There's no good reason for abandoning
> something once you've started and already have a backbone of knowledge for
> it.

There is no need to abandon it. But in order to prove Uri wrong (he
who says you shouldn't be programming at all), go back to some of the
elementary things first. Closing these gaps will help you on the long
run.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 04 Apr 2004 09:22:04 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: free source for bbs
Message-Id: <0tQbc.71492$JO3.39406@attbi_s04>

Robin wrote:

> Can someone tell me
> a few lines of code I could use in the script - www.infusedlight.net/bbs/
> (download here) that would prevent it from being insecure.

A few lines won't do it.  To be secure requires an entire rewrite.

> I know this is
> asking a lot, but I'd like to be able to be running a good, safe, secure
> message board system.

That's a good goal, but you'll need to learn about how to avoid tainted data.
Have you been using Perl's taint-checking mode?

   #!/usr/bin/perl -T

	-Joe


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

Date: Sun, 04 Apr 2004 07:50:59 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: graph smoothing...
Message-Id: <D7Pbc.69853$K91.158775@attbi_s02>

Bill Parker wrote:

> I'm using GD::Graph quite successfully to produce a (temperature by time)
> graph.
> 
> But it's quite spikey and so I thought I'd overlay it with some sort of
> smoothed graph, so's the trend can (well, may be) displayed.

http://www.inwap.com/inwap/activity.html
http://www.inwap.com/mybin/apache/list-files.pl?http-graph


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

Date: Sun, 04 Apr 2004 05:40:27 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: just curious about perl coders
Message-Id: <x765cgi9mc.fsf@mail.sysarch.com>

>>>>> "R" == Robin  <webmaster@infusedlight.net> writes:

  R> I had one question, does anyone here work on developing perl, the language?
  R> I'd like to talk to some of the team.

oh, i can't wait to hear your suggestions. i first need to go to the
hospital to have them stitch up my sides in advance of my splitting
them.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 4 Apr 2004 08:20:25 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: just curious about perl coders
Message-Id: <c4ogg9$qtf$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Robin:

> I had one question, does anyone here work on developing perl, the language?
> I'd like to talk to some of the team.

Yes, there are a few in this group. Development of Perl5 happens through
a mailinglist (for which also a mail2news gateway exists). See

    <http://groups.google.com/groups?q=group%3Aperl.perl5.porters&ie=ISO-8859-1&hl=en>

to get an idea of how development is carried out. After browsing the
archive a bit, you'll realize that it has its own implicit rules and
conventions.

I have my doubts that you are already able to take part in these
discussions (and bear in mind that the p5-porters are a busy bunch of
people). Search for "This Week on perl5-porters" in this group. Those
are the weekly summaries of what has been discussed.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 04 Apr 2004 08:27:14 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: just curious about perl coders
Message-Id: <CFPbc.176170$1p.2115530@attbi_s54>

Robin wrote:

> I had one question, does anyone here work on developing perl, the language?
> I'd like to talk to some of the team.

Yes, there are many here.
Why do you ask?
The coding style in you poorly written BBS script shows that you are not
willing to accept advice from people more knowlegable than yourself.

Why do you want to pester the developers with newbie questions?
Are you implying that everyone replying to your posts thus far are
imbeciles?

Most people posting here have been too polite to say it:
   You are not competent enough to recognize your own failings.

You really ought to find a class in beginning Perl, such as at
a local community college, and perform a semester's worth of
homework assignments before putting up any of your code for downloading.

	-Joe


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

Date: Sun, 04 Apr 2004 09:36:29 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Need help with a Perl Script Error
Message-Id: <xGQbc.180067$Cb.1687885@attbi_s51>

Darren Clark wrote:

> #Strip directory structure
> $name=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
> my $newname = $2;

You are blindly using $2 without bothering to check if m// succeeded.  That
is guarenteed to fail for $name="My G5:Main directory:Subdir:File Name".

At bare minimum, change that to
   my $newname = $name =~ s/.*[/:\\]//;
or "use File::Spec;" to split off the directory part.
	-Joe


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

Date: 4 Apr 2004 06:12:32 GMT
From: Ross Presser <rpresser@NOSPAM.imtek.com.invalid>
Subject: Re: PERL to VBScript help
Message-Id: <Xns94C1BD576A8pt101594@129.250.170.91>

jcapp@belzon.com (Jeremy) wrote in news:7ae3f23b.0403021902.7b937814
@posting.google.com:

> Today, I was doing some converting, and ran across this code in Perl:
> 
> @union = @intersection = @difference = ();
> %count = ();
> foreach $element (@added, @subList) { $count{$element}++ }
> foreach $element (keys %count) {
>      push @union, $element;
>      push @{ $count{$element} > 1 ? \@intersection : \@difference },
> $element;
> }
> 
> Basically, we're taking two arrays (@added & @subList) and comparing
> them to see what different elemetns @added has vs. @subList and
> putting the results into @intersection.
> 
> Anyone know how to do this in VBScript? :)


With the aid of the Dictionary object (to emulate a hash) and a helper 
function to emulate push for arrays:

Function AAdd(arr,el)
  Redim arr(UBound(arr)+1)
  arr(UBound(arr))=el
End Function

Dim intersection,union,difference
intersection = Array()
union = Array()
difference = Array()
Dim count
Set count = Createobject("Scripting.Dictionary")
For Each el In added
  If Not count.Exists(el) Then
     count.Add(el,0)
  End If
  count(el) = count(el)+1
Next
For Each el in subList
  If Not count.Exists(el) Then
    count.Add(el,0)
  End If
  count(el) = count(el)+1
Next
For Each el In count.Keys
  AAdd(union,el)
  If count(el) > 1 Then
    AAdd(intersection,el)
  Else
    AAdd(difference,el)
  End If
Next

(Let me note that your Perl code assumes there are no repeated elements 
in either @added or @sublist.  My VBscript translation assumes the same.)


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

Date: Sun, 04 Apr 2004 07:12:53 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <v5dv6057r1la7a4v8bckbrfjrvlhadpu9d@4ax.com>

On Sun, 04 Apr 2004 03:58:16 GMT, Bob Walton
<invalid-email@rochester.rr.com> wrote:

>Have you tried "Object Oriented Perl" by Damian Conway, Manning 
>Publications?  I thought it was crystal clear and generally excellent. 
>My apoligies if it is one of the offending books -- different things for 
>different folks.

Bob,

I am going to a book shop today to have a look at the all the latest
books on Perl and OOP so will include this one. Have seen an earlier
posting re Damian's book and the difficulty of sorting which is which
in the downloadable collection of scripts...have you seen this and do
you know if this has it been sorted out? 

Cheers

Geoff



>
>
>> Geoff



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

Date: Sun, 04 Apr 2004 07:28:20 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <x7vfkggq24.fsf@mail.sysarch.com>

>>>>> "GC" == Geoff Cox <geoffacox@dontspamblueyonder.co.uk> writes:

  GC> I am going to a book shop today to have a look at the all the latest
  GC> books on Perl and OOP so will include this one. Have seen an earlier
  GC> posting re Damian's book and the difficulty of sorting which is which
  GC> in the downloadable collection of scripts...have you seen this and do
  GC> you know if this has it been sorted out? 

AFAIK that wasn't a major issue. but i will second the book (and i
should know as i did a tech edit on it). it is the best (and only) book
on OOP and it is very well written. sure it uses a goofy set of examples
based on a cd collection but all books need to do that. real world
applications are usually too large for a single book to use and also
teach. but also most real world applications will not have the structure
that can be used to illustrate and compare different coding designs. you
choose a simple application so you can show how it can be developed in
many different ways and compare them. then the coding differences are
easily seen and can be highlighted. in a large real world app, only
small parts may have to do with an OO style or feature that is
important. so it would be very hard to show different ways of doing that
without reqwriting the whole thing. 

this is just like learning math in school. 3 + 4 = 7 is needed to
compare to 4 + 3 = 7 and also 5 + 2 = 7. if you jumped right into
complex accounting examples, you would never grasp basic addition.

so you ain't gonna find any book or doc that does what you want. either
they use some dummy application to work with or they will focus on a
short program which highlights a particular feature.

so get OOP and read it and don't complain about something which will
never change as it is the right way to write a book on coding.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Sun, 04 Apr 2004 07:33:37 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <sbdv60dnr6746hota7cpo36kg43aea941f@4ax.com>


>joylessly? Perhaps you have already reached stage 2 which means you know
>little but you know enough to ask questions relating to OOP in this
>group. People here will help you with them.

Tassilo,

I was a little tired and frustrated when I posted above, but would
like to say that I was very grateful for the "mini tutorial" response
which you made to one of my earlier postings on this!  

A couple of questions re that. I have used a modified version of your
code below and it does get me all the intro texts from the
total-260304.txt file but I have not understood how to get the <h2>
 ... </h2> lines and I have not understood how to parse through the
html.htm file getting the <h2>.. </h2> data and the intro texts from
the total-260304.txt file in the order in which the <option statements
appear in html.htm.

I follow what you say re finding <option and value but cannot see how
I would get <h2>, <p> etc..

Would appreciate a little light here!

Geoff


package MyParser;
use base qw(HTML::Parser);

open (OUT, ">>d:/a-keep9/nondb/parser/test/results.htm");
my $n=0;

print OUT ("<html><head><title>test</title></head><body> \n");
print OUT ("<table width='100%'> \n");

sub start { 
      my ($self, $tagname, $attr, $attrseq, $origtext) = @_;
         if ($tagname eq 'option') {
         &getintro($attr->{ value });
                              	                    }
        if ($tagname eq 'h') {
        print OUT ("<tr><td>$attr->{ href } </td></tr> \n");
                                          }
               }      

sub getintro {
 open (INN, "d:/a-keep9/nondb/db/total-260304.txt");
         while (defined (my $lineintro = <INN>))           {
               if ($lineintro =~ /@_','(.*?)'\)\;/) {
               print OUT ("<tr><td> $1 </td></tr>\n");

}

}
close(INN);
                    }

package main;
open (IN, "d:/a-keep9/nondb/parser/html.htm");
undef $/;
my $html = <IN>;
my $parser = MyParser->new;
$parser->parse( $html );

print OUT ("</body></html \n");







>
>Tassilo



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

Date: Sun, 04 Apr 2004 07:39:10 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <dnev60tfghkj1umq8tbn8v6u01sb7thhni@4ax.com>

On Sun, 04 Apr 2004 07:28:20 GMT, Uri Guttman <uri@stemsystems.com>
wrote:

>so get OOP and read it and don't complain about something which will
>never change as it is the right way to write a book on coding.

Uri,

Are you really certain that OOP could not be taught from a real set of
data, a real class (module), real scripts etc? I will look at Damian's
book and try to be converted!

Cheers

Geoff




>uri



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

Date: 4 Apr 2004 08:52:54 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <c4oid6$scl$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Geoff Cox:

>>joylessly? Perhaps you have already reached stage 2 which means you know
>>little but you know enough to ask questions relating to OOP in this
>>group. People here will help you with them.
> 
> Tassilo,
> 
> I was a little tired and frustrated when I posted above, but would
> like to say that I was very grateful for the "mini tutorial" response
> which you made to one of my earlier postings on this!

It can be done for HTML::Parser because it's just one module. I'd be a
bit more reluctant towards writing one on OOP. It's probably a topic too
huge for a single usenet posting.

Note that HTML::Parser's subclassing technique doesn't require the full
set of OOP skills. It uses just one tiny aspect of it which I tried to
make clear in my posting. Apparently however 'subclass' can't be easily
explained without knowing what a 'class' in general is.

> A couple of questions re that. I have used a modified version of your
> code below and it does get me all the intro texts from the
> total-260304.txt file but I have not understood how to get the <h2>
> ... </h2> lines and I have not understood how to parse through the
> html.htm file getting the <h2>.. </h2> data and the intro texts from
> the total-260304.txt file in the order in which the <option statements
> appear in html.htm.
> 
> I follow what you say re finding <option and value but cannot see how
> I would get <h2>, <p> etc..
> 
> Would appreciate a little light here!
> 
> Geoff
> 

[ indenting fixed a bit ]

> package MyParser;
> use base qw(HTML::Parser);
> 
> open (OUT, ">>d:/a-keep9/nondb/parser/test/results.htm");
> my $n=0;
> 
> print OUT ("<html><head><title>test</title></head><body> \n");
> print OUT ("<table width='100%'> \n");
> 
> sub start { 
>       my ($self, $tagname, $attr, $attrseq, $origtext) = @_;
>       if ($tagname eq 'option') {
>            &getintro($attr->{ value });
>       }

For a tag like

    <option value="bla">

this will call 

    getintro("bla");

in the moment when this tag was encountered in the HTML document.

>       if ($tagname eq 'h') {
>            print OUT ("<tr><td>$attr->{ href } </td></tr> \n");
>       }

What is the <h> tag and why does it have an "href" attribute? 
You said you were looking for <h2> tags. That would mean you'd at least
have to write:

    if ($tagname eq 'h2') {

Also, <h1>-<h6> don't have an "href" attribute. The only attribute they
can have is AFAIK "align". Or are you trying to access the "href"
attribute of a previous tag? If you want to do that, you have to store
it for later use (usually on a stack or so) when the start() method is
called for the tag containing this attribute. By the time start() is
called for <h2>, %$attr wont have it because it belongs to a different
tag.

> }      
> 
> sub getintro {
>      open (INN, "d:/a-keep9/nondb/db/total-260304.txt");
>      while (defined (my $lineintro = <INN>))           {
>           if ($lineintro =~ /@_','(.*?)'\)\;/) {
>                print OUT ("<tr><td> $1 </td></tr>\n");
> 
>           }
> 
>      }
>      close(INN);
> }

Now apparently you are searching for a line containing:

    bla','<SOME_CHARACTERS>');

where you capture <SOME_CHARACTERS>.

Can you explain what kind of data there is in the file total-260304.txt?
To me it looks a bit like a fraction of the arguments for function calls.

At this point I don't understand how the <option>, <h2> and <p> tags
relate to each other. Can you give a small sample of the data in the
input HTML file and also of the data in the total-*.txt files?
And finally, show us how the result made from these files is supposed to
look like.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 04 Apr 2004 09:50:59 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Sad experience with redirecting to /dev/null
Message-Id: <7UQbc.70454$K91.158293@attbi_s02>

Mike Hunter wrote:

>> So redirect iperf's stdin as well, that way it shouldn't touch yours:
>> 
>> system("iperf -s -D </dev/null >/dev/null"); 
> 
> Good advice.  But:
> 
> 1.  I shouldn't need to do that...right?  A command run from system if fork'd
> off and should have its own file handles.

You DO have to do that.  A command run from system shares STDIN, STDOUT and
STDERR.  The higher numbered file handles are not shared but 0, 1 and 2 are.

I would use
   system("iperf -s -D </dev/null >>/var/log/iperf.log 2>&1 &");

	-Joe


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

Date: 3 Apr 2004 22:41:03 -0800
From: khoslakapil@yahoo.com (Kapil Khosla)
Subject: Search and replace a string in files
Message-Id: <919aa2da.0404032241.191f4d6b@posting.google.com>

I am new to PERL and I am trying to write a script which can do the
following changes.

int Main()            CHANGES TO             int main()
#define Main main     CHANGES TO             #define main main
int Main(String *str) CHANGES TO             int main(String *str)

Essentially I am just converting all the occurences of Main to main in
a file.

I read the chapter on Regular expressions and wrote the following
script to do a search for the pattern with Main in an array with the
same requirement.This works correctly for me.

##################
use strict;
my $i;
my @arrstr = ('Mainframe','#define main Main','int Main(String
^sd)','int Main()','DllMain','int Main(ad)','MainMain');
	
	for( $i=0;$i<@arrstr;$i = $i+1 )
	{
		print "$arrstr[$i]\n";

		if ($arrstr[$i] =~ m{\bMain(\(.*\))?$} )
		{
			print "String matched\n\n";
		}
	}

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

Now, I dont know how to use this in a file and replace the string
matched with the corresponding lower case  main.
This is what I could write till now.

	
	
	open FILEHANDLE,"E:\\file.cpp" or die ("Could not open file for
reading");;

	my @myfile = <FILEHANDLE>; # get the file in an arraylist

	for $line(@myfile)
	{
	#	search for a pattern, if exists, replace with the correct str ?? #
This is what I dont know how to do :(
	}
	close FILEHANDLE;


Can you  help?
Thanks a lot.
Kapil


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

Date: Sun, 04 Apr 2004 05:39:17 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: test
Message-Id: <x78yhci9oa.fsf@mail.sysarch.com>

>>>>> "R" == Robin  <webmaster@infusedlight.net> writes:

  R> "CatcherInTheRye" <letnomanenterhere@yahoo.co.kr> wrote in message
  R> news:c4g8b5$akp@netnews.proxy.lucent.com...
  >> test
  >> 
  R> go away.

take your own advice. you are not useful here.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 4 Apr 2004 08:08:20 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: test
Message-Id: <c4ofpk$qfh$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Uri Guttman:

>>>>>> "R" == Robin  <webmaster@infusedlight.net> writes:
> 
>  R> "CatcherInTheRye" <letnomanenterhere@yahoo.co.kr> wrote in message
>  R> news:c4g8b5$akp@netnews.proxy.lucent.com...
>  >> test
>  >> 
>  R> go away.
> 
> take your own advice. you are not useful here.

Neither was this posting of yours. Uri, you do know the concept of
emails, don't you? They wouldn't make a comment like that less
superfluous, but please, write such things in private if you must.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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