[8378] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1995 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 1 02:07:40 1998

Date: Sat, 28 Feb 98 23:00:23 -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           Sat, 28 Feb 1998     Volume: 8 Number: 1995

Today's topics:
        A pipe to telnet is opened for input? <RobertMac@worldnet.att.net>
        can people test THIS PROGRAM for me? (asdf)
        COOKIE MALADY (asdf)
    Re: Easy way to "clean" an array <jefpin@bergen.org>
    Re: Easy way to "clean" an array <ljz@asfast.com>
        Filehandles with fmt unix command? (Brian Springstead)
        Filehandles with fmt unix command? (Brian Springstead)
    Re: Is this behaviour of => correct? <uri@sysarch.com>
    Re: newline <jdf@pobox.com>
    Re: newline <rjk@coos.dartmouth.edu>
        News Script? <webdesing@djem.net>
        news2htm.pl <gizmo@cet.com>
    Re: Perl Scripts which extract info from HTML pages (Abigail)
        Perl system admin tools <skruzich@stc.net>
    Re: Q: splice() time complexity, want linked lists? (David Petrou)
    Re: reg expression help.. <rjk@coos.dartmouth.edu>
        Replacing blocks of text on-the-fly...... <sviper@inav.net>
    Re: Replacing blocks of text on-the-fly...... (Michael Martin)
    Re: some thoughts on RTFM/FAQ/newbies/moderated (brian moore)
    Re: The Ineffable Tom C. nospam@domain.com
    Re: use system or backticks?? (Brett Slocum)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 1 Mar 1998 05:57:56 GMT
From: "Robert Mac" <RobertMac@worldnet.att.net>
Subject: A pipe to telnet is opened for input?
Message-Id: <6datd4$q8q@bgtnsc02.worldnet.att.net>

Dear Sir or Madam

I want to send an email message using the rcpt to: in telnet.
I can open telnet for input in a perl script but I can't seem to pass the
necessary command lines
in order to send email from telnet.
How do you pass the telnet command lines from a perl script once you open
telnet for input?

Sincerely,

Robert Waugaman     RobertMac@worldnet.att.net


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

Date: 1 Mar 1998 05:58:45 GMT
From: you@somehost.somedomain (asdf)
Subject: can people test THIS PROGRAM for me?
Message-Id: <6datel$g04@chile.earthlink.net>

Everyone, please make sure your cookies are turned on in your
favorite browers..then go to http://www.alabanza.com/mercuryz/sardonia
click on the logo, then click on create character. Create your character
by entering your name twice, then enter a password. After
pressing the button, you should be transported to another page of text.
Please let me know if it says "your character has 30 hp, a short
sword, no items, and 100 gold pieces"
and if it does not say that, then respond with what came up on your
browser.

For some reason, this works on my machine and some others, but on others
it does not....

thanks, sean



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

Date: 1 Mar 1998 01:29:04 GMT
From: you@somehost.somedomain (asdf)
Subject: COOKIE MALADY
Message-Id: <6dadl0$nvd@chile.earthlink.net>

$cookie="Set-Cookie: character=$character; expires=Wednesday, 03-Feb-99 
12:02:44 GMT; domain=www.alabanza.com";


print "$cookie\015\012";
print "Content-type: text/html\n\n";

with the above code I can set cookies on my machine, but nobody else's.
I have no idea why it would work with my computer, but no on a friend's.
Without any code changes, it worked last night on his computer, but not
now...anybody have any ideas?



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

Date: Sat, 28 Feb 1998 23:34:18 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Schwitter Ruedi <Ruedi.Schwitter@schweiz.org>
Subject: Re: Easy way to "clean" an array
Message-Id: <Pine.SGI.3.95.980228233228.21002B-100000@vangogh.bergen.org>

>I have a sorted array with duplicated entrys, like
>
>006621
>006621
>006622
>006623
>006623
>006623
>006624

Let that array be called @array1
Let the array we want to have only single elements (no dups) be @array2

foreach $element (@array1){
	push @array2, $element unless grep { $_ eq $element } @array2;
}

If you can't understand that, look at the docs.
Here's a brief explanation.  For each element in array1, push it to array2
unless it's already in array2.

--
| The only difference between me and a madman is that I am not mad.
|                                                 - Salvador Dali

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
                qw[jeff] on #perl,#javascript,#cgi on IRC

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: 01 Mar 1998 00:37:20 -0500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Easy way to "clean" an array
Message-Id: <luen0n55v3.fsf@asfast.com>

"I have a life, and I can prove it!" <jefpin@bergen.org> writes:

> >I have a sorted array with duplicated entrys, like
> >
> >006621
> >006621
> >006622
> >006623
> >006623
> >006623
> >006624
> 
> Let that array be called @array1
> Let the array we want to have only single elements (no dups) be @array2
> 
> foreach $element (@array1){
> 	push @array2, $element unless grep { $_ eq $element } @array2;
> }
> 
> If you can't understand that, look at the docs.
> Here's a brief explanation.  For each element in array1, push it to array2
> unless it's already in array2.

The above method will indeed work, but I believe the one below will
be more efficient:

Let the initial array be called @array1, and the resulting array be
called @array2.  Then ...

  @hash{@array1} = undef;
  @array2 = sort keys %hash;

On the second line, you may prefer the following if you want to force
a numeric sort ...

  @array2 = sort { $a <=> b } keys %hash;


-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: 1 Mar 1998 02:37:14 GMT
From: bspring@j51.com (Brian Springstead)
Subject: Filehandles with fmt unix command?
Message-Id: <6dahkq$l6m$1@usenet11.supernews.com>

I have a number of ASCII files that I only want to format various sections of
it with the unix command "fmt".  I've already written the script which pulls out
the various sections and makes an array.  How can I pipe this through fmt and
get it back into my perl script?  I thought I could just print to the file
handle and the read it back in inside a for or foreach loop.  Is there an
easier way?  Thanks in advance.

Brian
 
-- 
Brian Springstead | ...It's true that love can change us, but never quite enough
     Rush fan     | Sometimes we are too tender.  Sometimes we're too tough...  
 bspring@j51.com  | 							Rush


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

Date: 1 Mar 1998 02:39:01 GMT
From: bspring@j51.com (Brian Springstead)
Subject: Filehandles with fmt unix command?
Message-Id: <6daho5$l6m$2@usenet11.supernews.com>


I have a number of ASCII files that I only want to format various sections of
it with the unix command "fmt".  I've already written the script which pulls out
the various sections and makes an array.  How can I pipe this through fmt and
get it back into my perl script?  I thought I could just print to the file
handle and the read it back in inside a for or foreach loop.  Is there an
easier way?  Thanks in advance.

Brian
 
-- 
Brian Springstead | ...It's true that love can change us, but never quite enough
     Rush fan     | Sometimes we are too tender.  Sometimes we're too tough...  
 bspring@j51.com  | 							Rush


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

Date: 28 Feb 1998 23:07:21 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Is this behaviour of => correct?
Message-Id: <x7zpjbyrye.fsf@sysarch.com>

liyanage@access.ch (Marc Liyanage) writes:

> I'm building a HASH with the => operator. The man page says => behaves like
> comma but treats the operator to its left like a string.
> 	my ($stylesheet_conversion) = {
> 		Rub-Tit19 => { HTML => "<%text%><BR>", category => 'title'},	
> 	};
> instead. If I don't quote it, it seems to get evaluated and a zero is
> inserted.
> I don't have this problem with the other keywords that don't have a dash.
> Manpage sez:
>        The => digraph is mostly just a synonym for the comma
>        operator.  It's useful for documenting arguments that come
>        in pairs.  As of release 5.001, it also forces any word to
>        the left of it to be interpreted as a string.

well, here is a case where the camel is mightier than the man! the blue
camel (page 50 and 94) sez, "and it also quotes any bare IDENTIFIERS to
the left of it."
                                                         ^^^^^^^^^^^
(should also be singular since it quotes only 1 identifier)

Rub-Tit19 is NOT a legal identifier since it has that pesky dash. use
underscore instead since it is a legal char in an identifier. or just
quote it.

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 28 Feb 1998 23:37:30 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: newline
Message-Id: <lnuvni0l.fsf@news.concentric.net>

"DAN ALBERTSSON" <dan.albertsson@swipnet.se> writes:
> I have tried to use:
> 
> $row =~ tr/\r//d;
> $row =~ tr/\n/\v/;
> 
> to substitute them to a vertical tab instead but it seems to result in
> plain/standard v instead. Why. Or can I do it in another way.

Control characters can be represented in double-quotish fashion using
the \c escape, such that (for example) a ^V may be spelled "\cV".
You'll find this information in the perlop and perlre documents.
-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Sun, 01 Mar 1998 00:40:53 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: DAN ALBERTSSON <dan.albertsson@swipnet.se>
Subject: Re: newline
Message-Id: <34F8F4E6.C561895B@coos.dartmouth.edu>

[posted and mailed]

DAN ALBERTSSON wrote:
> 
> I have tried to use:
> 
> $row =~ tr/\r//d;
> $row =~ tr/\n/\v/;
> 
> to substitute them to a vertical tab instead but it seems to result in
> plain/standard v instead. Why. Or can I do it in another way.

Perl does not support the \v shorthand for the vertical tab.

>From Mastering Regular Expressions, by Jeffrey Friedl, page 241:

Footnote to Table of Regex Shorthands and Special-Character Encodings:
   The phantom \v (vertical tab) has been omitted.  The manpage and other
   documentation listed it for years, but it was never actually added to
   the language!  I doubt it will be missed now that it has finally been
   removed from the documentation.

Ah well, guess he was wrong - it is missed, at least in this case.  :-) 
You'll have to choose another character, or use a numeric encoding: \x0B or \013.

-- 
 _ / '  _      /             rjk@coos.dartmouth.edu
( /)//)//)(//)/(                     chipmunk@m-net.arbornet.org
    /                                        http://www.ziplink.net/~rjk/
        It's funny 'cause it's true ... and vice versa.


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

Date: Sat, 28 Feb 1998 10:53:34 -0500
From: ";8-) DjemNet" <webdesing@djem.net>
Subject: News Script?
Message-Id: <6dam83$m7k$1@gte1.gte.net>

Hi!

    I want to know if someone knows a good perl script to post news to a
newsserver' group  for  example:  newsgroup comp.perl  in the server
news.djem.net

    You know, that the person that use it, have to define a newsserver
or group to post to.
        Or if the news server needs a password and User Id.  used too.

        Please write back to me directly to webmaster@djem.net  or just
reply here.

                Thanks for taking the time to read this.

           att..:    DjemNet
                      webdesign@djem.net
                       http://www.djem.net/



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

Date: Sat, 28 Feb 1998 17:01:51 -0800
From: Landon Hendee <gizmo@cet.com>
To: gizmo@cet.com
Subject: news2htm.pl
Message-Id: <Pine.LNX.3.95.980228165650.10679A-100000@pigpen.cet.com>

Summary: converts tin .newsrc file to HTML format
Keywords: perl tin converter newsgroups newsreader unix linux convert newsrc to HTML usenet news

*** Small ad for something very useful to some peope:
    GO to ANY URL! Is your Lynx GO Command disabled?
    http://www.cet.com/~gizmo/scripts/go-to-url.pl

    <A HREF="http://www.cet.com/~gizmo/scripts/go-to-url.pl">
    GO to ANY URL! Is your Lynx GO Command disabled?</A>

RESONDING TO THIS MESSAGE: Please send any comments for me to 
gizmo@cet.com AND to this newsgroup.

COMMENT: I've been reading a lot about perl lately and have 
bought three books on it. PERL IS AWESOME! Here's what I've 
bought so far: 

   "Learning Perl"  -  I _HIGHLY_ recommend this book!
   by Randal L. Schwartz & Tom Christiansen
   Published by O'Reilly & Associates, Inc.  
   ISBN: 1-56592-284-0

   "Web Programming with Perl 5" 
   -- This book is great, too. It comes with a CD containing
   -- the whole CPAN archive at the time of publishing
   by Bill Middleton, Brad Deng & Chris Kemp
   Published by Sams.net  ISBN: 1-57521-112-2

   "Perl 5 Quick Reference"
   Micheal O Foghlu
   Published by QUE  ISBN: 0-7897-0888-4

I checked out this book from the library:
   "Programming Perl"
   Larry Wall, Tom Christiansen & Randal L. Schwartz
   Published by O'Reilly & Associates, Inc.  
   ISBN: 1-56592-149-6

COMMENT: I'm writing this program as a fun way for me to learn 
perl. I learn best by practice. This is one of my first scripts 
that I actually got to work right so if anyone has any 
suggestions for optimizing the code, please let me know. 

PROGRAM DESCRIPTION: This program converts the unix tin news 
reader's .newsrc file to HTML format. I've gotten this far, but I 
need to figure out some more perl code to finish it up. 

QUESTION: How do I sort the output before it writes to the html 
file. I haven't been able to figure that out yet. If you go into 
tin and subscribe to a pattern, then subscribe to another 
pattern, it puts the second pattern match at the bottom of the 
newsrc file instead of sorting the file. What I've been doing to 
get around this is the following line: 

   sort ~/.newsrc | uniq >newsrc 

QUESTION: How do I tell perl to go into my news server and get 
the active newsgroups file? ( news.host.com ) 

QUESTION: If I read in all of the 34,000+ newsgroups and use this 
script to convert it to html format, the resulting file is over 2 
megs in size. How can I tell perl to split it up into smaller 
HTML pages or let the user search for keywords and then split 
that up into seporate pages if it's to big? For the search part. 
I've been doing this: 

   grep "keyword" ~/.newsrc | sort | uniq >newsrc 

How would I code this line into perl? I use this same line for 
several different things and would love to know how to do it in 
perl. I don't want to use `backticks` or make any other calls to 
the unix shell. 

QUESTION:  Look through my code, which DOES work and read the comments to
see if you can help me out with the various problems that I am having.

Ok, just what you've all been waiting for, the program!

--- CUT HERE ---
#!/usr/bin/perl -w  # I always start my programs with this line.
use strict;     # I use this because I am not a 'lazy programmer'

# I'll change this whole script to be executable from my 
# web page after I get everything working properly... :-) 
#print "Content-type: text/html\n\n";

# Let me know it compiled and is running
print STDOUT "Working...\n\n";  # I know that I can omit STDOUT 

# I had a problem opening the ~/.newsrc file so I just copied it 
# to a file located in the same directory as this program. I have 
# full r/w access to the file and I'm executing this script right 
# in my shell. Is there a reason why I can't refer to the file 
# with one of the following examples: 
#
# /home/gizmo/.newsrc
# ~/.newsrc

# Define the input and output files
my $infile  = "newsrc";       # Short .newsrc test file
#my $infile  = "newsrc2";      # File contains ALL the newsgroups  
my $outfile = "newsrc.html";  # Where to send the output

# Define some HTML tags
my $title = "Complete Listing of USENET Newsgroups in HTML Format";
my $hb = "<DD><A HREF=\"news:";
my $hm = "\">";
my $he = "</A>";

# Open the output file and print the beginning of the HTML document
open (OUT, ">$outfile") || die "Can't open $outfile file: $!";
print OUT "<HTML><HEAD>\n<TITLE>$title</TITLE>\n</HEAD><BODY>\n";
print OUT "<H3>$title</H3>\n";
print OUT "<P><DL>\n";

# I would like to be able to read in the while newsrc file and 
# then close it so I can use it as a subroutine with another 
# program I made that does similar stuff. 

# Open and process the input file
open (IN, $infile) || die "Can't open $infile file: $!";
while (<IN>) {
   my @all = split (/\n/);  # Does it read in the WHOLE file here?
   my $line;
   foreach $line (@all) {
       chomp;

       # These next two lines process each line of the input file
       # and find either a ! or a : character and strip everything
       # including the found character to the end of the line
       
       $line =~ s/:.*//; # Can I combine these two lines so that
       $line =~ s/!.*//; #   I can speed things up a bit?

       # Print each line to the output file in HTML format
       # Is there a better way to do this?
       print OUT $hb . $line . $hm . $line . $he . "\n";
       }
   }
close (IN);

# Print out the end of the HTML file
print OUT "</DL>";
print OUT "\n</BODY>\n</HTML>\n\n";

# Clost the output file
close (OUT);

# Output the next line to show it's done
print STDOUT "Done.\n";
exit;




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

Date: 1 Mar 1998 03:19:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Scripts which extract info from HTML pages
Message-Id: <6dak40$fdd$1@client2.news.psi.net>

kmyers@syneractive.com (kmyers@syneractive.com) wrote on 1642 September
1993 in <URL: news:6da6id$fpa$1@nnrp1.dejanews.com>:
++ I need to write a Perl script which reads an HTML page with about 15 tables
                                                ^^^^^^^^^
++ and only extracts information from 3 of these tables.  It then must reproduce
++ the page with the exact layout, but only displaying the 3 extracted tables.
                     ^^^^^^^^^^^^

Someone is pulling your leg.



Abigail
-- 
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'


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

Date: Sat, 28 Feb 1998 23:13:06 -0500
From: Steve Kruzich <skruzich@stc.net>
Subject: Perl system admin tools
Message-Id: <34F8E051.75F9C734@stc.net>

This is a multi-part message in MIME format.
--------------592FF004C9312FFCEBE08682
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,
Is there any place where i can find some kind of tools to move files
from one server to another server periodically?
All i can seem to find is only CGI and web scripts.  Can anyone point me
to a place where i can find some of these types of
tools?
Thanks
Steve Kruzich
skruzich@stc.net

--------------592FF004C9312FFCEBE08682
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Steve Kruzich
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Steve Kruzich
n:              Kruzich;Steve
org:            SCT Communications
adr:            P.O Box 1281;;;Dahlonega;GA;30533;USA
email;internet: skruzich@stc.net
tel;work:       706-867-6773
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------592FF004C9312FFCEBE08682--



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

Date: 1 Mar 1998 03:33:05 GMT
From: dpetrou@cs.cmu.edu (David Petrou)
Subject: Re: Q: splice() time complexity, want linked lists?
Message-Id: <6dakth$p7o$1@goldenapple.srv.cs.cmu.edu>

Abigail (abigail@fnx.com) wrote:
: David Petrou (dpetrou@cs.cmu.edu) wrote on 1642 September 1993 in
: <URL: news:6d9ob3$a74$1@goldenapple.srv.cs.cmu.edu>:
: ++ 
: ++ Gerr.  Obviously I meant "doubly-linked" list.  (Since you can't
: ++ remove an arbitrary element in O(1) using singly-linked lists.)
: 
: Why not?

Because you have to modify the pointer of the element before the one
to remove to point to the element after the one to remove.  Without
back links, you'd have to iterate through all the elements to find the
successor of the element you want to remove, taking O(n) time.

BTW, I did mean "splice()" not "split()" in my first message.  (See
the subject line.)

Thanks for the dejanews suggestion.  I'll look it up.

: Abigail

David


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

Date: Sun, 01 Mar 1998 00:30:09 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Alex Krohn <alex@gossamer-threads.com>
Subject: Re: reg expression help..
Message-Id: <34F8F262.10A05DD9@coos.dartmouth.edu>

[posted and mailed

Alex Krohn wrote:
> 
> The eval is being looped around (as it loops line by line through a
> flat file database and compares the search term to the info in the
> file).
> 
> Since each execution of the loop will most likely be comparing the
> search input with different text, I assume this means the code does
> vary, and so the reg exp will have to be recompiled each time?

The code does not vary - it's the values of the variables that varies.  Yes,
the regexp will have to be recompiled every time, but not the code.

> The reason I have to put an eval there is I want to let people search
> via reg expressions, but I can't trust that they will form one
> properly.

Exactly.  That's why you need to use eval.  

-- 
 _ / '  _      /             rjk@coos.dartmouth.edu
( /)//)//)(//)/(                     chipmunk@m-net.arbornet.org
    /                                        http://www.ziplink.net/~rjk/
        It's funny 'cause it's true ... and vice versa.


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

Date: Sat, 28 Feb 1998 19:22:21 -0600
From: Steel Viper <sviper@inav.net>
Subject: Replacing blocks of text on-the-fly......
Message-Id: <34F8B84D.786DDA9A@inav.net>

This is a multi-part message in MIME format.
--------------8747E9BE17B125B615F5F8CF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


--------------8747E9BE17B125B615F5F8CF
Content-Type: text/plain; charset=us-ascii; name="post.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="post.txt"

Greetings. I am in the process of writing a script to automatically update
my DNS records for when I add domains (I host web pages, domains, etc.).
What I am attempting is to parse through my 'named.conf' file and remove
domains if a 'db.domain' file no longer exists or add and entry into my
'named.conf' if a new 'db.domain' file has been added. Below is a sample
of the 'named.conf' file:


	zone "domain1.net" {
		type master;
		file "db.domain1";
	};

	zone "domain2.net" {
		type master;
		file "db.domain2";
	};

So, if I remove the file 'db.domain1', the Perl script should remove
the entry for domain1 from 'named.conf' which is a total of 5 lines.
If I add a domain, I want to be able to insert an entry similar to
the above into the 'named.conf' file. I have searched through the
man pages and DejaNews with no discussion of removing, replacing or
adding blocks of text on the fly. Help greatly appreciated.


Steel Viper

--------------8747E9BE17B125B615F5F8CF--



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

Date: 1 Mar 1998 06:34:20 GMT
From: dmmartin@home.net (Michael Martin)
Subject: Re: Replacing blocks of text on-the-fly......
Message-Id: <6davhc$9pb$1@ha2.rdc1.sfba.home.com>

Hi,

>        zone "domain1.net" {
>                type master;
>                file "db.domain1";
>        };
>
>        zone "domain2.net" {
>                type master;
>                file "db.domain2";
>        };
>
>So, if I remove the file 'db.domain1', the Perl script should remove
>the entry for domain1 from 'named.conf' which is a total of 5 lines.
>If I add a domain, I want to be able to insert an entry similar to
>the above into the 'named.conf' file. I have searched through the
>man pages and DejaNews with no discussion of removing, replacing or
>adding blocks of text on the fly. Help greatly appreciated.


ok, try this  NOTE all of this code is UN-tested, no promises but I think it 
will work:

my(@entries);

sub ChkEntries{

$/ = '};\n';                  #sets the input record seperator to };<newline>

open(FILE, "+<named.conf");   #open the file

while(<FILE>){                #loop thru file

 m/file "(db\..+)"/i;         #match the file name
 $file = $1;                  #assign $file the filename
 if(! -e $file)){             #if the file does not exist
  s/$_//;                     #substitute nothing for the domain entry
 }else{
  push(@entries, $file);      #place all active domain db file names into the  
                             #@entries array

}#end loop
$/ = "\n";                    #set the input record seperator back to normal
}#end sub

that subroutine should do the job for checking the named.conf against the 
existing files, thr this one for checking files against named.conf:

sub ChkFiles{

opendir(DIR, $db_dir);  #open dir
@files = sort(grep(/^db\./, readdir(DIR)));   #load all files startind with db. 
into @files
closedir(DIR);          #close dir

foreach $domain_db (@files){           #for each entry in @files
 if(!grep(/$domain_db/, @entries)){    #if it does not have a corasponding     
                                   #entry in @entries
  @filename = split(/\./, $domain_db); #split the file name to get the domain  
                                      #name
  open(FILE, "+<named.conf");          #open named.conf
  print FILE << "EOF";                 #print till it encounters the string EOF

zone "$filename[1].net" {
      type master;
      file "$domain_db";
};

EOF                                    #add the entrie into named.conf
close(FILE);                           #close the file
}#endif
}#end loop
}#end sub

__END__

**NOTE**: there is a big bug in this code: it cannot tell the difference 
between .com, .net, ,org, etc. tld's.  I am not familar with these kind of 
files so it may be that all that needs to be done is to extract the last three 
letters from the end of the db file name (i.e. db.pmwdcom for pmwd.com).  but 
regardless I am sure you can take it from here.

HTH,

Philip








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

Date: 1 Mar 1998 03:50:40 GMT
From: bem@news.cmc.net (brian moore)
Subject: Re: some thoughts on RTFM/FAQ/newbies/moderated
Message-Id: <slrn6fhmpg.a5s.bem@thorin.cmc.net>

On Thu, 26 Feb 1998 14:33:07 +0000, 
   Jim Smith <james-detg.smith@ubs.com> wrote using Netscape, which munged the
   hell out of his formatting, forcing me to fix it...
> comp.infosystems.www.authoring.cgi (I think) is a 'self-moderated'
> newsgroup. All posts get a standard reply, including pointers to FAQs et
> cetera, asking you to reconfirm your post. My one and only post to that
> group, asking where the FAQ was never got there to annoy anyone.

For the most part it seems to work well there.

> This would deal with all but the most wilfully silly posts. The only
> doubt I have is whether those who spend a lot of time responding to this
> group find it an unacceptable overhead.

Actually, as I recall, the ciwag one only mails you once and then decides
you're acceptable if you ACK it.

Of course, perhaps its success is why people wander in here. :(



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

Date: 1 Mar 1998 04:45:11 GMT
From: nospam@domain.com
Subject: Re: The Ineffable Tom C.
Message-Id: <6dap4n$eb5$1@picasso.op.net>

Bert Robbins (brobbins@tis.com) wrote:
: Brendan Knox wrote:
: What an arrogant attitude. If I express a interest in something
: I don't expect the old timers to laugh in my face and say well
: if you can't figure out how we got here then you obviosly aren't
: smart enough for us to talk to.

Well, in general, I don't think this an accurate description
of what really happens here.  Newbie posts which I have seen 
are generally followed up with a short reply which states 
that "your question is a FAQ" and includes a pointer 
to where the answer can be found.  In some cases, 
the answer is a little testy, but that's all, just testy.


: The Perl community is best servered by being friendly and 
: courteous to newcomers. We need to advocate Perl as the 
: solution to problems that Perl is best suited to accomplish.
: We need to take a leadership role in ensuring that Perl is
: understood and used to the benefit of all.

Maybe, but not in a newsgroup.  This newsgroup is not a chat cafe. 
I can't speak for others, but I don't come here to get 
the warm fuzzies.  I come here to learn things.  

Keep in mind -- a newsgroup is not a private cubicle
or a classroom.  It's a resource which is seen by thousands
of people all over the world, and which will be stored for
all eternity in dejanews and other archive sites.  
Everything that gets posted here automatically becomes
part of the permanent Perl documentation.  There's no such
thing as a dumb question, however, this newsgroup is a dumb
place to put a question which can quickly be answered in some
other way.  A dumb post does not contribute any new info,
it only contributes noise.  

Without the dogged dedication of a few gurus, I think this
newsgroup would have descended into useless banter a long
time ago.  People who really understand the topic would not
even bother with it.  Each time one person is chided for
posting a FAQ, I'm sure that ten or twenty other newbies
with similar questions (including me) read the chiding 
and decide not to post, but rather to read the documentation  
(which Tom and the other gurus carefully prepared, for free).
That's exactly what we should be doing.  

When I read this newsgroup, I feel like I am reading posts
from people who are smarter than me, and where I can learn 
a lot if I keep reading.  This is definitely not the case
in certain other newsgroups.  I hope this newsgroup continues
to be a good resource.  

--
##--------------------------------
##  John Nolan
##  jpn acm org
##--------------------------------         


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

Date: Fri, 27 Feb 1998 16:19:12 GMT
From: slocum@io.NOSPAM.com (Brett Slocum)
Subject: Re: use system or backticks??
Message-Id: <34f6e6f8.179072203@news.io.com>

On 26 Feb 1998 02:35:11 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:

>You are aware that there are a whole bunch of modules around for
>database connectivity?

It is a little esoteric, but the original poster had this as his
command:

`sqr trsdmp.sqt user/pass -RT -F/export/transfer/records.txt
02/24/1998`;

This is a call to SQRibe, a SQL reporting language, which I'm nearly
certain is not supported by DBI.  SQRibe is the reporting language for
PeopleSoft.



Brett Slocum, slocum AT io DOT com, unSPAM address to reply
http://www.io.com/~slocum/
Tekumel Home Page: www.io.com/~slocum/tekumel.html
GURPS Home Page: www.io.com/~slocum/gurps.html


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1995
**************************************

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