[10473] in Perl-Users-Digest
Perl-Users Digest, Issue: 4065 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 25 13:06:23 1998
Date: Sun, 25 Oct 98 10:00:24 -0800
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, 25 Oct 1998 Volume: 8 Number: 4065
Today's topics:
Re: *Why* does clpm attract non-perl posts? <ebohlman@netcom.com>
Re: *Why* does clpm attract non-perl posts? <ljz@asfast.com>
Re: *Why* does clpm attract non-perl posts? (Nathan V. Patwardhan)
CGI - question about 'nph-' scripts - Please help! (Wrzek)
flock in IIS4.0 rk27@my-dejanews.com
Getting a web page content using perl <clee@innocent.com>
Re: Getting a web page content using perl <ebohlman@netcom.com>
Re: Getting a web page content using perl (Tad McClellan)
Re: Getting a web page content using perl <tobin@sji.org>
Gnu Unzip????? (Mattjm82)
Re: Not to start a language war but.. (Cees de Groot)
Objects -vs- packages & hashes <jhoglund@mirage.skypoint.net>
Re: passing associative arrays <tobin@sji.org>
Re: Perl & Y2K - booby trap code (Craig Berry)
Re: Perl & Y2K - booby trap code (Craig Berry)
Perl isn't a programming language [sic] (was: What isn' <tchrist@mox.perl.com>
Re: PLEASE HELP SOON!!! <daniel.vesma@thewebtree.com>
Re: PLEASE HELP SOON!!! (Tad McClellan)
Re: reading file and counting whitespace <avitala@macs.biu.ac.il>
Regular Expression Problem ??? (r j huntington)
Re: Regular Expression Problem ??? (Matthew Bafford)
Re: Regular Expression Problem ??? (r j huntington)
Re: Regular expressions.. (r j huntington)
Script wanted... pegboy@eclipse.net
Re: Wanted: programming (humor?) stevenjm@olywa.net
Re: why use do BLOCK? <r28629@email.sps.mot.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 25 Oct 1998 07:38:43 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <ebohlmanF1DH8K.G7s@netcom.com>
Amitai Schlair <amitai.schlair@usa.net> wrote:
: New Perl users, like the rest of us clpm readers, are almost always
: trying to fit lots of pieces together with Perl. The difference between
: us and them: new users don't make the effort to determine -- or simply
: don't know -- whether their problem is in fact with one or more of the
: various bits of wood, spackle, masking tape, metal, grease, etc.
The problem here is that there are plenty of newsgroups that deal with
the project as a whole rather than the individual parts, and people for
some reason seem reluctant to deal with them. If someone's having
trouble building a cabinet and they don't know quite where the problem
is, it makes far more sense for them to post to
rec.furniture.building.cabinets than to post a question about glue to
sci.materials.nails.
It may be that people are suffering from premature closure; they've begun
focusing on the details of implementation before they've fully defined
the problem they're trying to solve. But they need to be strongly but
politely discouraged when they do this; it is simply not possible to
build a functional and reliable system by throwing bits of code at it and
hoping that the right ones stick.
: I imagine the same effect can be seen in the Tcl and Python newsgroups,
: only to a lesser degree (in proportion to the number of newbies who've
: heard about them).
comp.lang.tcl doesn't seem to get any such posts. I don't read the
Python groups, so I can't vouch for them.
------------------------------
Date: 25 Oct 1998 07:57:11 -500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <lt3e8col3s.fsf@asfast.com>
Eric Bohlman <ebohlman@netcom.com> writes:
> Amitai Schlair <amitai.schlair@usa.net> wrote:
> : New Perl users, like the rest of us clpm readers, are almost always
> : trying to fit lots of pieces together with Perl. The difference between
> : us and them: new users don't make the effort to determine -- or simply
> : don't know -- whether their problem is in fact with one or more of the
> : various bits of wood, spackle, masking tape, metal, grease, etc.
>
> The problem here is that there are plenty of newsgroups that deal with
> the project as a whole rather than the individual parts, and people for
> some reason seem reluctant to deal with them.
I do not believe that people are reluctant to deal with the "project
as a whole" newsgroups. I just think that lots of novices don't
initially realize (because they are novices), that ...
... there are "project as a whole" newsgroups within which problems
similar to those they are bringing to c.l.p.misc are routinely
discussed.
... most regular contributors do not want c.l.p.misc to be one of
these "project as a whole" newsgroups.
Each time a novice comes here, this is a *new* *person*. Some
percentage of these new people (and I dare say this is significantly
less than 100 percent) do not realize these two facts and need to be
educated about them.
The only way that reluctance could have anything to do with this would
be if the posters in question were *not* new contributors to
c.l.p.misc, and if they knew about these other "project as a whole"
newsgroups and still, despite their knowledge, chose to nevertheless
post to c.l.p.misc with their questions.
I seriously doubt that anything more than the tiniest fraction of a
percent of these novices would fit into this category. Few, if any
first-time posters here are deliberately flouting c.l.p.misc
conventions, let alone are even *aware* of these conventions when they
first show up.
There will always be novices coming here, and many of them, being
novices in the first place, are going to be unaware of netiquette and
c.l.p.misc conventions. The fact that the number of novices doesn't
seem to be significantly decreasing says a lot more about Perl's
quality, usefulness, and popularity than anything about some sort of
fallaciously-imagined "reluctance" on the part of these novices to
take their questions elsewhere.
> [ ... ]
--
Lloyd Zusman ljz@asfast.com
perl -le '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
------------------------------
Date: Sun, 25 Oct 1998 13:56:06 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <W5GY1.172$dP4.46209@news.shore.net>
Lloyd Zusman (ljz@asfast.com) wrote:
: c.l.p.misc conventions. The fact that the number of novices doesn't
: seem to be significantly decreasing says a lot more about Perl's
: quality, usefulness, and popularity than anything about some sort of
: fallaciously-imagined "reluctance" on the part of these novices to
: take their questions elsewhere.
I agree with this. Too bad that beginners or first-timers were also
angry when they perceived Tom's "welcome to Perl" message (auto-FAQ)
as some kind of spam. FWIW, I found that document to be pretty
helpful.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: Sun, 25 Oct 1998 14:38:43 GMT
From: wrzek@panda.bg.univ.gda.pl (Wrzek)
Subject: CGI - question about 'nph-' scripts - Please help!
Message-Id: <363337db.9450684@news.pg.gda.pl>
Hi,
I want to write script in perl to push some information.
I heard that souch script should be 'nph-' type, so first i tried
to write a small script and change its name to nph-xx.cgi.
My script xx.cgi works good, but when i changed its name to
nph-xx.cgi Netscape try to save output istead of show the effect.
Could somebody help me?
Wrzek
P.S. Sorry, I know that my English is poor :(
==== My test script =========================================
#!/usr/bin/perl
print ("Content-type: text/html\n\n");
print ("<html>\n<body>\n<center>\n");
print ("<blink><font color='red' size='6'>OK</font><blink>\n");
exit;
==== My 'Push' script =======================================
#!/usr/bin/perl
use CGI::Push qw(:standard);
[...]
do_push(-next_page=>\&next_page,
-last_page=>\&last_page,
-delay=>10);
sub next_page {
my($q,$counter) = @_;
return undef if $counter >= 10;
$last_updated = localtime (time);
return start_html('Test'),
[...]
end_html();
}
sub last_page {
my($q,$counter) = @_;
return start_html('Done'),
"<center>", h1('End'), "\n",
"<img src='./end.gif' border=0><br>", "\n",
$last_updated, "\n",
end_html;
}
exit;
------------------------------
Date: Sun, 25 Oct 1998 08:02:49 GMT
From: rk27@my-dejanews.com
Subject: flock in IIS4.0
Message-Id: <70ulva$i4k$1@nnrp1.dejanews.com>
hi,
Is there anyway to implement the flock function in win32 perl on IIS 4.0?
What I want to do is to lock a file, open the file, edit the contents of the
file, close the file and then release the lock.
Thanks in advance.
Rahul
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 24 Oct 1998 23:42:43 -0700
From: Chris Lee <clee@innocent.com>
Subject: Getting a web page content using perl
Message-Id: <3632C863.5EBBF4E3@innocent.com>
Hi,
I am new about using perl with the internet. I would like to use perl to
get the web page content using perl. For example, if I input
"http://www.perl.com" to my perl program, my perl program will give me
the source content of that web page. Could this kind of thing be done by
perl? Any suggestion?
Thanks,
-- Chris
------------------------------
Date: Sun, 25 Oct 1998 07:52:47 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Getting a web page content using perl
Message-Id: <ebohlmanF1DHvz.H93@netcom.com>
Chris Lee <clee@innocent.com> wrote:
: I am new about using perl with the internet. I would like to use perl to
: get the web page content using perl. For example, if I input
: "http://www.perl.com" to my perl program, my perl program will give me
: the source content of that web page. Could this kind of thing be done by
: perl? Any suggestion?
Check out the documentation for the LWP module.
------------------------------
Date: Sun, 25 Oct 1998 01:15:42 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Getting a web page content using perl
Message-Id: <u6ju07.u26.ln@flash.net>
Chris Lee (clee@innocent.com) wrote:
: I am new about using perl with the internet. I would like to use perl to
: get the web page content using perl. For example, if I input
: "http://www.perl.com" to my perl program, my perl program will give me
: the source content of that web page. Could this kind of thing be done by
: perl? Any suggestion?
There are Perl modules for doing that.
use LWP::Simple;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 24 Oct 1998 22:38:40 -0700
From: Tobin Fricke <tobin@sji.org>
Subject: Re: Getting a web page content using perl
Message-Id: <Pine.LNX.3.96.981024222905.301A-100000@tobin>
On Sat, 24 Oct 1998, Chris Lee wrote:
> I am new about using perl with the internet. I would like to use perl to
> get the web page content using perl. For example, if I input
> "http://www.perl.com" to my perl program, my perl program will give me
> the source content of that web page. Could this kind of thing be done by
> perl? Any suggestion?
This is in the PERL FAQ (you'll be hearing that a lot on this newsgroup)
at http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html . The FAQ is
very helpful and really does contain the most common questions.
You can use backtics (``) to just run Lynx and capture the output:
$html_code = `lynx -source $url`;
$text_data = `lynx -dump $url`;
This, of course, assumes you have lynx installed. You can also do it in
100% perl. The LWP::Simple perl module makes this very easy:
use LWP::Simple;
$content = get("http://www.perl.com/");
For full documentation, you can type "perldoc LWP::Simple". If you don't
have the LWP::Simple module installed, you can get it with the CPAN.pm
module:
perl -MCPAN -e shell;
install LWP::Simple
For slightly more complicated requirements, you can use LWP::UserAgent.
Speaking of which, could anyone provide me with an example of fetching a
password-protected page with LWP::UserAgent? tnx.
And that's it.
Tobin Fricke
tobin@sji.org
------------------------------
Date: 25 Oct 1998 17:29:47 GMT
From: mattjm82@aol.com (Mattjm82)
Subject: Gnu Unzip?????
Message-Id: <19981025122947.20908.00000806@ng82.aol.com>
Douse any one know were I can get Gnu Unzip?
Thanks.
Matthew J. Meyer
------------------------------
Date: 25 Oct 1998 12:52:20 +0100
From: cg@bofh.cdg.acriter.nl (Cees de Groot)
Subject: Re: Not to start a language war but..
Message-Id: <70v3dk$4mi$1@bofh.cdg.acriter.nl>
Tom Christiansen <tchrist@mox.perl.com> said:
>In comp.lang.perl.misc, mso@eve.speakeasy.org (Mike Orr) writes:
>:The more $@%{}/* -> => symbols, the better. Who cares
>:if the result is an unreadable code?
>
>This was a lie yesterday. It is a lie today. It shall be a lie tomorrow.
Well, it was the reason I moved from Perl to Python for SGMLtools, and
I'm very happy I've done so. I've tried for 4 years to write R/W code
in Perl, and then simply gave up (why try when there are alternatives?).
Perl is effectively a single-user language - no harm with that, but not
suited for the numerous occasions when you need to modify someone else's
code.
--
Cees de Groot http://pobox.com/~cg <cg@pobox.com>
--- We're hiring Java developers => www.acriter.com
------------------------------
Date: 25 Oct 1998 16:33:30 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Objects -vs- packages & hashes
Message-Id: <70vjsq$log$1@shadow.skypoint.net>
Hi folks,
I use packages all the time, largely because I find them a convenient
way to hide subroutine names and use variables that are global only to
those subroutines that might use them.
One package I use is for accessing files, I have a rather large
associative array that contains information about a particular file.
$State[$fh]{FILENAME}
{HEADER}
{etc}
Most of the subs have a '$fh' as a first argument, that $fh is used as a
key into the hash to fetch state info for that particular file.
Doing things like:
$fa = &open_file("filename.a");
$fb = &open_file("filename.b");
$dat_a = &read_line($fa);
$dat_b = &read_line($fb);
would read a line from the appropriate file. (for this example) all the
subs know what file to access and what variables to update by the $fb.
It works, but based on what little I know of object technology, it seems
I'm reinventing objects.
Seemed to me, a $fb = new mypackage;
Where the &new() subroutine opens the file (among other things) and gives
me an instance of "mypackage" so that &read_line becomes:
$dat_b = $fb->read_line();
*might* make more sense. (well, either way, I still have to keep track of
$fb)
So I set out to try to understand what all this "instance of $fb" stuff
was about.
in "new" I have something like:
package mypackage;
$Testing = "We are set";
sub new {
my($this) = shift;
my($class) = ref($this) || $this;
my($self) = shift;
my($class) = bless($self,$class);
return($self);
}
sub set_var {
my($self)=shift;
$Testing = shift;
}
1;
The above doesn't work, unless I do a:
$self->{Testing} = shift;
My question is, are objects worth it?
Is there any grave danger in just using regular packages with "$fh" as a
key into the hash? It seems a lot simpler to me.
There must be a way to avoid all that $self->{stuff}, and still get the
desired effect. ("package-global" variables that are specific to this
instance of a package)
I don't understand it, so I'm probably not seeing the real value of
objects.
Jamie
------------------------------
Date: Sat, 24 Oct 1998 22:40:54 -0700
From: Tobin Fricke <tobin@sji.org>
To: sholden@cs.usyd.edu.au
Subject: Re: passing associative arrays
Message-Id: <Pine.LNX.3.96.981024223956.301B-100000@tobin>
On 25 Oct 1998, Sam Holden wrote:
> >%data = {'bob','1', 'joe', 'x'}
> That probably doesn't do what you think...
> should be %data = ('bob','1', 'joe', 'x');
Oops -- that's right -- I used normal paren's in my code. I just typed
curly brackets in my usenet message.
> something(\%data,'hello);
Thanks -- it's that \%data notation that I was looking for.
Tobin
------------------------------
Date: 25 Oct 1998 17:21:55 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70vmnj$15g$2@marina.cinenet.net>
Matt Knecht (hex@voicenet.com) wrote:
: Abigail <abigail@fnx.com> wrote:
: >There isn't any problem having localtime return numbers in base 17. Or the
: >number of years since 1666 squared, minus 1024.
: >
: >It doesn't make it easy for the programmer though.
:
: It makes it easy for the C programmer migrating to Perl.
And therein lies the summary, which we can continue to go 'round and
'round on ad nauseum without resolving. I think most of us would agree
that having localtime return y-1900 was a bad idea on the part of the
Unix/C designers; it's both unnecessary and a potential pitfall for clue-
challenged programmers. Now that we have 25 years of existing practice
with localtime-as-it-is behind us, though, it's more valuable to stick
with the de facto and de jure convention than to make a misguided attempt
to 'fix' it. If we want a localtime-ish func that returns year in raw
form (and 1-12 month, perhaps), add one with a new name.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 25 Oct 1998 17:33:46 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70vndq$15g$3@marina.cinenet.net>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
: :There is an unambiguous way that is also *standard*: ISO 8601:1988.
: :The following is the complete long form:
: :
: :yyyy-mm-dd HH:MM:SS (punctuation is optional)
:
: The day that you ask everyone on the street when they were born and they
: all recite an answer in a form such as that is the day that computer
: programmers should expect to use that form as their unique input and
: output style.
Larry was refering to storage formats, not user display/input formats.
The first step to thinking rationally about date issues is to separate
these two. Store in an unambiguous absolute format (ISO 8601, time_t, or
the like), display in a locale and context appropriate way, accept input
in as wide a variety of formats as you can manage.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 25 Oct 1998 14:19:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Perl isn't a programming language [sic] (was: What isn't Perl good for?)
Message-Id: <70vc27$kh6$1@csnews.cs.colorado.edu>
In comp.lang.perl.misc, jlewchuk@junctionnet.com writes:
:Also, from my POV, PERL is treated as a programming language, which it's not.
You display truly poor judgment coming to this newsgroup (note its name)
to claim that "perl is not a programming langauge". You don't know
what you're talking about, or else you're just plain wicked.
:If you try to treat it like one, you will fail miserably in producing good
:code. Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
:all of the above.
I can't tell whether you simply don't know what you're remarkably
ignorant or whether you're just here to spread dissent. I'm not sure
I care which case it should be, either. I expect others will spell out
in detail why your assertion is offensive and horribly wrong.
--tom
--
"VAX. For those who care enough to steal the very best."
-- A microscopic message on the silicon chip inside
one of Digital Equipment's often stolen computer designs.
------------------------------
Date: Sun, 25 Oct 1998 08:31:16 -0000
From: "Daniel Vesma" <daniel.vesma@thewebtree.com>
Subject: Re: PLEASE HELP SOON!!!
Message-Id: <3632e229.0@news.thefree.net>
To fix this, we need to know...
1. Code
2. OS
3. Perl Version
4. Error Log
Cheers
Daniel Vesma
www.thewebtree.com/daniel-vesma
------------------------------
Date: Sun, 25 Oct 1998 01:27:05 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: PLEASE HELP SOON!!!
Message-Id: <9sju07.u26.ln@flash.net>
Sarah Crawford (bast2657@sssnet.com) wrote:
: Hello. I have been recently installing CGI scripts to my web site.
: Each three of them are not working.
: I really need
: to have these problems fixed by Tuesday!! Thanks
I think you should hire someone to help you.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 25 Oct 1998 17:23:10 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: Re: reading file and counting whitespace
Message-Id: <70vfso$h8g$1@cnn.cc.biu.ac.il>
Erik A Belknap wrote in message <70tsc2$cp5@newslink.runet.edu>...
>I am trying to read a file a search for certain info all while counting
>the non-blank charcters. Any way of doing it?
^^
>I am reading in the .mailspool file and for every email I have to report
>who, when, and email address and total whitespace for that email. I need
^^
>to do it for every email in the file.
>Thanks
I'm unclear as to what you want to count, the "non-blank characters" or the
"whitespace ".
but anyway, this dirty little snippet will do the trick:
for non-blank:
$a="once upon a time i was falling in love, now I'm only falling apart";
$count=$a=~s/(\S)/$1/g;
$count is now: 53;
for whitespace:
$a="once upon a time i was falling in love, now I'm only falling apart";
$count=$a=~s/(\s)/$1/g;
$count is now: 13;
this is nicer, though:
foreach $temp ($a =~ /\S/g) {
$count++;
}
perlre,
Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il
------------------------------
Date: 25 Oct 1998 10:37:39 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Regular Expression Problem ???
Message-Id: <70uv1j$9j6$1@news.monmouth.com>
Hi, I'm learning perl and I've been reading the FAQs and other perl docs
but I'm stuck on a particular problem that really needs a solution. Any
assistance is greatly appreciated in advance.
This particular script removes the VirtualHost directive from httpd.conf
for a domain that is being removed from the system. Here's a sample
(the ip address is contrived).
<VirtualHost 201.102.12.21>
ServerName www.nodomain.com
ServerAdmin webmaster@nodomain.com
DocumentRoot /home/noname
TransferLog /home/noname/logs/access.log
ErrorLog /home/noname/logs/error.log
ScriptAlias /cgi-bin/ /home/noname/cgi-bin/
</VirtualHost>
No problem removing the first 7 lines; they each contain something
unique to that VirtualHost directive. The problem is the </VirtualHost>
tag. Of course, every VirtualHost directive ends with that tag on a
line by itself.
My thoughts run to 2 possible solutions, either find the first line
and remove that and the following 7 lines (whatever they may be), or
remove the first 7 lines based on their unique content and then somehow
find the sequence "\n</VirtualHost>\n" and remove that.
Unortunately, I haven't been able to figure out how to do either. Can
anyone help me, please, either with some suggested code or a pointer to
the appropriate docs. So far, I find regular expressions a little
confusing, so maybe I'm missing something obvious, in which case I
apologize for the noise.
Thanks for any help. -rh-
------------------------------
Date: Sun, 25 Oct 1998 08:09:36 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Regular Expression Problem ???
Message-Id: <MPG.109ced1a40b431589896e4@news.scescape.net>
In article <<70uv1j$9j6$1@news.monmouth.com>>, wolph@merlin.albany.net
(r j huntington) pounded the following:
=> [snip]
=> This particular script removes the VirtualHost directive from httpd.conf
=> for a domain that is being removed from the system. Here's a sample
=> (the ip address is contrived).
=>
=> <VirtualHost 201.102.12.21>
=> ServerName www.nodomain.com
=> ServerAdmin webmaster@nodomain.com
=> DocumentRoot /home/noname
=> TransferLog /home/noname/logs/access.log
=> ErrorLog /home/noname/logs/error.log
=> ScriptAlias /cgi-bin/ /home/noname/cgi-bin/
=> </VirtualHost>
Try:
#!/usr/bin/perl -w
my $ip = quotemeta('201.102.12.21');
while ( <DATA> ) {
print unless
m{^\s*<\s*VirtualHost\s*$ip\s*>\s*$}o
..
m{^\s*<\s*/\s*VirtualHost\s*>\s*$};
}
__DATA__
<VirtualHost 201.102.12.31>
ServerName www.nodomain.com
ServerAdmin webmaster@nodomain.com
DocumentRoot /home/noname
TransferLog /home/noname/logs/access.log
ErrorLog /home/noname/logs/error.log
ScriptAlias /cgi-bin/ /home/noname/cgi-bin/
</VirtualHost>
# blah blah blah
<VirtualHost 201.102.12.21>
ServerName www.nodomain.com
ServerAdmin webmaster@nodomain.com
DocumentRoot /home/noname
TransferLog /home/noname/logs/access.log
ErrorLog /home/noname/logs/error.log
ScriptAlias /cgi-bin/ /home/noname/cgi-bin/
</VirtualHost>
#blah #blah
=> Unortunately, I haven't been able to figure out how to do either. Can
=> anyone help me, please, either with some suggested code or a pointer to
=> the appropriate docs. So far, I find regular expressions a little
=> confusing, so maybe I'm missing something obvious, in which case I
=> apologize for the noise.
Regular expressions aren't always the best answer, sometimes it's best
to make use of Perl's other great features. ;-)
=> Thanks for any help. -rh-
Hope This Helps!
--Matthew
------------------------------
Date: 25 Oct 1998 16:28:30 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Re: Regular Expression Problem ???
Message-Id: <70vjje$k5k$1@news.monmouth.com>
: This particular script removes the VirtualHost directive from httpd.conf
: for a domain that is being removed from the system. Here's a sample
: (the ip address is contrived).
Thanks to those who took the time to respond. The best solution, in my
opinion, came from Guy Decoux. Here it is in all its elegance:
while (<DATA>) {
print unless /^<VirtualHost $ip>/ .. m#^</VirtualHost>#;
}
------------------------------
Date: 25 Oct 1998 09:57:54 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Re: Regular expressions..
Message-Id: <70usn2$7po$1@news.monmouth.com>
: I was wondering if anyone knew about an online (preferably HTTP or FTP)
: resource that had in-depth documentation about Perl regular expressions.
: This seems like the hardest thing I am trying to tackle so far.
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html
------------------------------
Date: Sun, 25 Oct 1998 17:31:38 GMT
From: pegboy@eclipse.net
Subject: Script wanted...
Message-Id: <3633600d.16481283@news.eclipse.net>
Hi, I am looking for a webbased email script, thats NOT pop3 or imap,
but instead, user to user. It will be used for a cancer bbs, and I
would like to enable users to have private/personals email available
to them, so they can email other users on the system only..
Thanks so much for any help!
Chris
pegboy@eclipse.net
------------------------------
Date: Sun, 25 Oct 1998 08:43:49 GMT
From: stevenjm@olywa.net
Subject: Re: Wanted: programming (humor?)
Message-Id: <70uoc4$lim$1@nnrp1.dejanews.com>
In article <70rhtq$6l0$1@news.campus.mci.net>,
"Rick K" <ismkoehlerism@nmism-us.campus.mci.net> wrote:
> >stevenjm@olywa.net cryptically writes:
> >
> > I have encrypted my email address with a secret process I
> > developed. I have done this to ensure only the best and
> > brightest will be able to reply.
> >
> > Reply to:
> >
> > teveSay ayMay
> > tevenmsay@lackwaterbay-acificpay.omcay
>
> I really wanted to reply to you via email, since this sounds like a
> fantastic encryption process. But even though I used a room full
> of TI 99/4A computers for 12 hours now, no luck in deciphering
> your encryption. How fiendishly clever! The only clue I have came
> in Run #5,098,445,292, when this spewed out:
>
> "Italnay Ipgay Inay Tisay"
>
> Of course, now you are faced with the moral dilemma of whether
> you should market your encryption technique ... did you use
> freeware to create it? =8^)
>
>
Nooo...... more like unaware. ;-) I suppose if a person were to get Beowolf
and a few hundred dual 400 pc's they could break the code....
I'm almost tempted to write a script in perl to..... Naw, I have better
things to do with my time, specially since someone, somewhere has already
done it, I'm sure.
Would be diverting to play with though.
Steve
Blackwater-Pacific.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Oct 1998 10:55:29 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Boson <boson@earthlink.net>
Subject: Re: why use do BLOCK?
Message-Id: <363349EC.37516B7A@email.sps.mot.com>
[posted and copy emailed]
Boson wrote:
>
> Hello,
> I have been looking for examples that shows the benefit of using the
> do BLOCK format. I could only find examples like this one:
> $file = do {local $/; scalar <FILE>};
IF you are from other programming background, such as C. This oneliner roughly
translates into:
$tmp = $/;
$/ = undef;
$file = <FILE>;
$/ = $tmp;
undef $tmp;
The last time I went to my Software Engineering class, a (corporate)
programmer's productivity is typically around fix number of lines of code per
day. The more lines you have, the more opportunity for bugs, longer
compile/build time, hence worsen productivity, and the chance to meet the
release date (Bill Gate will agree on this ;-). If you are only writing a
small program at home/school, you probably won't bother. But if you have to
work with 10000 lines of code, you'll feel the different.
If you are still not convinced of the above benifit, just think about the
typing work it saves you from :) Besides, you wouldn't want to write
$index=$index+1, if you can just say $index++, or would you?
The trick is to use the strength of the language. After all, again per
Software Engineering study, coding (efford) occupies only ~20% of a software
life cycle, why not have fun with it?
-tk
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4065
**************************************