[7974] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1599 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 7 23:32:35 1998

Date: Wed, 7 Jan 98 20: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           Wed, 7 Jan 1998     Volume: 8 Number: 1599

Today's topics:
     Re: ActiveState PerlScript on Win95 <rootbeer@teleport.com>
     Re: base64encode/decode <joseph@5sigma.com>
     Re: CGI Bin Locked????? HAY-ELP!! (Sean O'Dwyer)
     Re: CGI Bin Locked????? HAY-ELP!! (Sean O'Dwyer)
     Re: Date of the inclusion of CGI into the HTTP server? <rootbeer@teleport.com>
     Re: file glob restrictions?! <rootbeer@teleport.com>
     Re: h2n perl script (Clay Irving)
     Re: Looping through hashes <sgordon@athena.lbl.gov>
     Re: Modularize non object code <rootbeer@teleport.com>
     Re: Mysterious FileHandle + fork() behavior; possible P <rootbeer@teleport.com>
     Re: newbie: fork and sleep <rootbeer@teleport.com>
     perl on 64 bit HP "merced" platform ?? <richard_england@mentorg.com>
     Re: Perl poetry (Martien Verbruggen)
     Re: Precompiled binaries [DateCalc|DateManip] for WinNT <jamesr@tiac.net>
     Re: Prob: Statusbar or how to show parts of a Line befo <rootbeer@teleport.com>
     Re: Running  a perl script in the background on Windows <jamesr@tiac.net>
     Re: sending email (Net::SMTP).. problem <spam@spam.spam>
     Re: Something equivalent to open("|foo|")? <joseph@5sigma.com>
     Re: Something equivalent to open("|foo|")? <spam@spam.spam>
     Re: Stored Function Call from perl DBI (David Hiltz)
     Re: suid unix help (Martien Verbruggen)
     Re: TEST IF A VALUE EXISTS IN AN ARRAY <rootbeer@teleport.com>
     Re: Trimming blanks <rootbeer@teleport.com>
     Re: unlink return value <rootbeer@teleport.com>
     Re: unlink return value <rootbeer@teleport.com>
     Re: Updating Perl 5.003 to 5.004 on Solaris 2.51 <rootbeer@teleport.com>
     Use of INNER JOINS ith DBD::ODBC <igor@iprint.com>
     username:password crypt module (Darnell Fall)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 7 Jan 1998 18:16:41 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Rainer Keuchel <r_keuchel@smaug.netwave.de>
Subject: Re: ActiveState PerlScript on Win95
Message-Id: <Pine.GSO.3.96.980107181612.28668P-100000@user2.teleport.com>

On 7 Jan 1998, Rainer Keuchel wrote:

> I cannot run the IE3.0 examples on a Win95 machine.  What can be
> wrong? 

I don't know, but the people in a newsgroup about servers should be able
to help you. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 07 Jan 1998 19:20:58 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: base64encode/decode
Message-Id: <34B437EE.B9117127@5sigma.com>

That would be MIME::Base64, that aggravating little module that
the LWP installer is always whining about.

	perldoc Base64

	-joseph
	 http://www.effectiveperl.com

Usha Vas Larson wrote:
> 
> Hi,
> 
> Has anybody written base64encode/decode routine in perl? If so, could
> you point me to it. I'm new to perl and realize that it would take me a
> while to figure it out, and need it asap.


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

Date: Wed, 07 Jan 1998 21:37:21 -0500
From: sean@dcdX.net (Sean O'Dwyer)
Subject: Re: CGI Bin Locked????? HAY-ELP!!
Message-Id: <sean-0701982137210001@p6.ts1.white.ny.tiac.com>

In article <34B40AC5.EFE2536B@megsinet.net>, Ricky <ric@megsinet.net> wrote:

>i use an ftp program called CuteFTP

Great tip, Ricky, thanks a million. I presume this is Mac software and
will search for it as such. If it is, you've just taken a lot of hassle
out of my life. Cheers!

Sean

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
DIGITAL COOKIE DESIGN: graphic design for web and print
http://www.dcd.net/



(remove x to reply via email)


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

Date: Wed, 07 Jan 1998 21:40:22 -0500
From: sean@dcdX.net (Sean O'Dwyer)
Subject: Re: CGI Bin Locked????? HAY-ELP!!
Message-Id: <sean-0701982140230001@p6.ts1.white.ny.tiac.com>

In article <34B40AC5.EFE2536B@megsinet.net>, Ricky <ric@megsinet.net> wrote:

>then again,
>i may be insulting your intelligence.  but i just mean well.

Not at all, all info welcome. I just searched shareware.com for <CuteFTP>
but it found no matches. So I presume it's Windows software? Yep, it is,
just searched under Win SW. Oh well.

Anyone know of a MAC alternative???

Sean

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
DIGITAL COOKIE DESIGN: graphic design for web and print
http://www.dcd.net/



(remove x to reply via email)


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

Date: Wed, 7 Jan 1998 18:20:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: albuquer@ill.fr
Subject: Re: Date of the inclusion of CGI into the HTTP server?
Message-Id: <Pine.GSO.3.96.980107181848.28668Q-100000@user2.teleport.com>

On Wed, 7 Jan 1998 albuquer@ill.fr wrote:

> Is anybody know the date of the inclusion of CGI script into the CERN and
> the NCSA http servers?

Probably somebody does, but people who like to answer questions about
webservers generally read newsgroups which are also about webservers. 
You're likely to get a better and more complete answer there than we can
give you here. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:41:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jakob Fix <jakob@ermine.ox.ac.uk>
Subject: Re: file glob restrictions?!
Message-Id: <Pine.GSO.3.96.980107183937.28668X-100000@user2.teleport.com>

On Wed, 7 Jan 1998, Jakob Fix wrote:

> I try this
> 
> @files = <*.sgm>;  
> 
> to read almost 2000 file names in this array, but it doesn't work.

Globbing will (by default, in most cases) call /bin/csh to do the actual
work, and csh has a limit on what it can return. Although there are other
workarounds, I recommend that you use readdir and friends instead of
globbing. (That's faster than globbing, anyway.) Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 7 Jan 1998 22:45:29 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: h2n perl script
Message-Id: <691i4p$m21@panix.com>

In <690v45$iv2$1@fishgate.efficient.com> craigb@efficient.com (Craig Beckett) writes:

>	I am looking for a perl script written by O'Reilly and Assoc
>called h2n. It is used to create DNS database files from the /etc/hosts
>file. Can anyone help me locate it?

ftp://ftp.ora.com/pub/examples/nutshell/dnsbind/dns.tar.Z

dns.tar.Z   contains the .c files and perl scripts from DNS and 
            BIND, Second Edition.  The files for Chapter 12 in 
            this edition correspond to the files for Chapter 11 of
            the first edition, and the files for Chapter 14 of 
            this edition   correspond to Chapter 13 of the first 
            edition.

This is the script:

#!/usr/bin/perl

#NAME
#
#    h2n - Translate host table to name server file format
#    $Date: 95/10/11 08:10:27 $  $Revision: 1.22 $
#
#SYNOPSIS
#
#    h2n -d DOMAIN -n NET [options]

# Various defaults
$Host = `hostname`;
chop($Host);
$Host =~ s/\..*//;       		
$doaliases = 1;
$domx = 1;
$dowks = 0;
$dotxt = 0;
$dontdodomains = 0;
$Bootfile = "./named.boot";
$Domain = "";
$Hostfile = "/etc/hosts";
$Commentfile = "";
$Commentfileread = 0;
$User = "root";
$Pwd = `pwd`;
$RespHost = "";
$RespUser = "";
$DefSerial = 1;
$DefRefresh = 10800;
$DefRetry = 3600;
$DefExpire = 604800;
$DefTtl = 86400;
$DefMxWeight = 10;
$Defsubnetmask = "";
$ForceSerial = -1;
$UseDateInSerial = 0;
$DateSerial = 0;

push(@bootmsgs, "primary\t0.0.127.IN-ADDR.ARPA db.127.0.0\n");

&PARSEARGS(@ARGV);
&FIXUP;

open(HOSTS, $Hostfile) || die "can not open $Hostfile";

LINE: while(<HOSTS>){
    next if /^#/;        # skip comment lines
    next if /^$/;  	 # skip empty lines
    chop;                # remove the trailing newline
    tr/A-Z/a-z/;	 # translate to lower case 

    ($data,$comment) = split('#', $_, 2);
    ($addr, $names) = split(' ', $data, 2);
    if ($names =~ /^[ \t]*$/) {
	print STDERR "Bad line in hosts file ignored '$_'\n";
	next LINE;
    }

    # Match -e args
    foreach $netpat (@elimpats){
	next LINE if (/[.\s]$netpat/);
    }

    # Process -c args
    foreach $netpat (@cpats){
	if (/\.$netpat/) {
	    ($canonical, $aliases) = split(' ', $names, 2);
	    $canonical =~ s/\.$netpat//; 
	    if($Cnames{$canonical} != 1){
	        printf DOMAIN "%-20s IN  CNAME %s.%s.\n", 
		       $canonical, $canonical, $cpatrel{$netpat};
		$Cnames{$canonical} = 1;
	    }
	    next LINE;
	}
    }

    # Check that the address is in the address list.
    $match = 'none';
    foreach $netpat (@Netpatterns){
	$match = $netpat, last if ($addr =~ /^$netpat\./);
    }
    next if ($match eq 'none');

    ($canonical, $aliases) = split(' ', $names, 2);  # separate out aliases
    next if ($dontdodomains && $canonical =~ /\./);  # skip domain names
    $canonical =~ s/$Domainpattern//;     # strip off domain if there is one
    $Hosts{$canonical} .= $addr . " ";    # index addresses by canonical name
    $Aliases{$addr} .= $aliases . " ";    # index aliases by address
    $Comments{"$canonical-$addr"} = $comment;

    # Print PTR records
    $file = $Netfiles{$match};
    printf $file "%-30s\tIN  PTR   %s.%s.\n", 
	   &REVERSE($addr), $canonical, $Domain;
}

#
# Go through the list of canonical names.
# If there is more than 1 address associated with the
# name, it is a multi-homed host.  For each address 
# look up the aliases since the aliases are associated 
# with the address, not the canonical name.
#
foreach $canonical (keys %Hosts){
    @addrs = split(' ', $Hosts{$canonical});
    $numaddrs = $#addrs + 1;
    foreach $addr (@addrs) {
	#
	# Print address record for canonical name.
	#
	if($Cnames{$canonical} != 1){
	    printf DOMAIN "%-20s IN  A     %s\n", $canonical, $addr;
	} else {
	    print STDERR "$canonical - can't create A record because CNAME exists for name.\n";
	}
	#
	# Print cname or address records for each alias.
	# If this is a multi-homed host, print an address
	# record for each alias.  If this is a single address
	# host, print a cname record.
	#
	if ($doaliases) {
	    @aliases = split(' ', $Aliases{$addr});
	    foreach $alias (@aliases){
		#
		# Skip over the alias if the alias and canonical
		# name only differ in that one of them has the
		# domain appended to it.
		#
    		next if ($dontdodomains && $alias =~ /\./); # skip domain names
		$alias =~ s/$Domainpattern//;
		if($alias eq $canonical){
		    next;
		}

                $aliasforallnames = 0;
		if($numaddrs > 1){
                    #
                    # If alias exists for *all* addresses of this host, we
                    # can use a CNAME instead of an address record.
                    #
                    $aliasforallnames = 1;
                    $xalias = $alias . " ";  # every alias ends with blank
                    @xaddrs = split(' ', $Hosts{$canonical});
                    foreach $xaddr (@xaddrs) {
                        if(!($Aliases{$xaddr} =~ /\b$xalias/)) {
                            $aliasforallnames = 0;
                        }
                    }
                }

		if(($numaddrs > 1) && !$aliasforallnames){
		    printf DOMAIN "%-20s IN  A     %s\n", $alias, $addr;
		} else {
		    #
		    # Flag aliases that have already been used
		    # in CNAME records or have A records.
		    #
		    if(($Cnames{$alias} != 1) && (!$Hosts{$alias})){
			printf DOMAIN "%-20s IN  CNAME %s.%s.\n", 
			       $alias, $canonical, $Domain;
			$Cnames{$alias} = 1;
		    } else {
			print STDERR "$alias - CNAME or A exists already; alias ignored\n";
		    }
		}

                if($aliasforallnames){
                    #
                    # Since a CNAME record was created, remove this
                    # name from the alias list so we don't encounter
                    # it again for the next address of this host.
                    #
                    $xalias = $alias . " ";  # every alias ends with blank
                    @xaddrs = split(' ', $Hosts{$canonical});
                    foreach $xaddr (@xaddrs) {
                        $Aliases{$xaddr} =~ s/\b$xalias//;
                    }
                }
	    }
	}
    }
    if ($domx) {
	&MX($canonical, @addrs);
    }
    if ($dotxt) {
	&TXT($canonical, @addrs);
    }
    if ($Commentfile ne "") {
	&DO_COMMENTS($canonical, @addrs);
    }
}

# Deal with spcl's
if (-r "spcl.$Domainfile") {
    print DOMAIN "\$INCLUDE spcl.$Domainfile\n";
}
foreach $n (@Networks) {
    if (-r "spcl.$n") {
	$file = "DB.$n";
	print $file "\$INCLUDE spcl.$n\n";
    }
}

# generate boot.* files
&GEN_BOOT;

exit;


#
# Generate resource record data for
# strings from the commment field that
# are found in the comment file (-C).
#
sub DO_COMMENTS {
    local($canonical, @addrs) = @_;
    local(*F, @c, $c, $a, $comments);
    
    if (!$Commentfileread) {
	open(F, $Commentfile) || die "Unable to open file $Commentfile: $!";
	$Commentfileread++;
	while (<F>) {
	    chop;
	    ($key, $c) = split(':', $_, 2);
	    $CommentRRs{$key} = $c;
	}
	close(F);
    }
    
    foreach $a (@addrs) {
	$key = "$canonical-$a";
	$comments .= " $Comments{$key}";
    }

    @c = split(' ', $comments);
    foreach $c (@c) {
	if($CommentRRs{$c}){
	    printf DOMAIN "%-20s %s\n", $canonical, $CommentRRs{$c};
	}
    }
}


#
# Generate MX record data
#
sub MX {
    local($canonical, @addrs) = @_;
    local($first, $a, $key, $comments);

    if($Cnames{$canonical}){
	print STDERR "$canonical - can't create MX record because CNAME exists for name.\n";
	return;
    }
    $first = 1;

    foreach $a (@addrs) {
	$key = "$canonical-$a";
	$comments .= " $Comments{$key}";
    }
    
    if ($comments !~ /\[no smtp\]/) {
        # Add WKS if requested
        if ($dowks) {
	    foreach $a (@addrs) {
	        printf DOMAIN "%-20s IN  WKS   %s TCP SMTP\n", $canonical, $a;
	    }
        }
	printf DOMAIN "%-20s IN  MX    %s %s.%s.\n", $canonical, $DefMxWeight, 
	       $canonical, $Domain; 
	$first = 0;
    }
    if ($#Mx >= 0) {
	foreach $a (@Mx) {
	    if ($first) {
		printf DOMAIN "%-20s IN  MX    %s\n", $canonical, $a; 
		$first = 0;
	    } else {
		printf DOMAIN "%-20s IN  MX    %s\n", "", $a; 
	    }
	}
    }

}


#
# Generate TXT record data
#
sub TXT {
    local($canonical, @addrs) = @_;
    local($a, $key, $comments);

    foreach $a (@addrs) {
	$key = "$canonical-$a";
	$comments .= " $Comments{$key}";
    }
    $comments =~ s/\[no smtp\]//g;
    $comments =~ s/^\s*//;
    $comments =~ s/\s*$//;
    
    if ($comments ne "") {
	printf DOMAIN "%s IN  TXT   \"%s\"\n", $canonical, $comments;
    }
}


#
# Create the SOA record at the beginning of the file
#
sub MAKE_SOA {
    local($fname, $file) = @_;
    local($s);

    if ( -s $fname) {
	open($file, "$fname") || die "Unable to open $fname: $!";
	$_ = <$file>;
	chop;
	if (/\($/) {
	    if (! $soa_warned) {
		print STDERR "Converting SOA format to new style.\n";
		$soa_warned++;
	    }
	    if ($ForceSerial > 0) {
		$Serial = $ForceSerial;
	    } else {
		($Serial, $junk) = split(' ', <$file>, 2);
		$Serial++;
                if($UseDateInSerial && ($DateSerial > $Serial)){
                    $Serial = $DateSerial;
                }
	    }
	    if (!defined($Refresh)) {
		($Refresh, $junk) = split(' ', <$file>, 2);
		($Retry, $junk) = split(' ', <$file>, 2);
		($Expire, $junk) = split(' ', <$file>, 2);
		($Ttl, $junk) = split(' ', <$file>, 2);
	    }
	} else {
	    split(' ');
	    if ($#_ == 11) {
		if ($ForceSerial > 0) {
		    $Serial = $ForceSerial;
		} else {
		    $Serial = ++@_[6];
                    if($UseDateInSerial && ($DateSerial > $Serial)){
                        $Serial = $DateSerial;
                    }
		}
		if (!defined($Refresh)) {
		    $Refresh = @_[7];
		    $Retry = @_[8];
		    $Expire = @_[9];
		    $Ttl = @_[10];
		}
	    } else {
		print STDERR "Improper format SOA in $fname.\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
	    }
	}
	close($file);
    } else {
	if ($ForceSerial > 0) {
	    $Serial = $ForceSerial;
	} else {
	    $Serial = $DefSerial;
	}
	if (!defined($Refresh)) {
	    $Refresh = $DefRefresh;
	    $Retry = $DefRetry;
	    $Expire = $DefExpire;
	    $Ttl = $DefTtl;
	}
	close($file);
    }

    open($file, "> $fname") || die "Unable to open $fname: $!";

    print $file "\@ IN  SOA $RespHost $RespUser ";
    print $file "( $Serial $Refresh $Retry $Expire $Ttl )\n";
    foreach $s (@Servers) {
	print $file "  IN  NS  $s\n";
    }
    print $file "\n";
}


#
# Reverse the octets of an IP address and append
# in-addr.arpa.
#
sub REVERSE {
    join('.', reverse(split('\.', $_[0]))) . '.IN-ADDR.ARPA.';
}


#
# Establish what we will be using for SOA records
#
sub FIXUP {
    local($s);

    if ($Host =~ /\./) {
	$RespHost = "$Host.";
    } else {
	$RespHost = "$Host.$Domain.";
    }
    $RespHost =~ s/\.\././g;

    if ($User =~ /@/) {				# -u user@...
	if ($User =~ /\./) {
	    $RespUser = "$User.";		# -u user@terminator.movie.edu
	} else {
	    $RespUser = "$User.$Domain."; 	# -u user@terminator
	}
	$RespUser =~ s/@/./;
    } elsif ($User =~ /\./) {
	$RespUser = "$User.";			# -u user.terminator.movie.edu
    } else {
	$RespUser = "$User.$RespHost";		# -u user
    }
    $RespUser =~ s/\.\././g;			# Strip any ".."'s to "."

    # Clean up nameservers
    if (!defined(@Servers)) {
	push(@Servers, "$Host.$Domain.");
    } else {
	foreach $s (@Servers) {
	    if ($s !~ /\./) {
		$s .= ".$Domain";
	    }
	    if ($s !~ /\.$/) {
		$s .= ".";
	    }
	}
    }

    # Clean up MX hosts
    foreach $s (@Mx) {
	$s =~ s/:/ /;
	if ($s !~ /\./) {
	    $s .= ".$Domain";
	}
	if ($s !~ /\.$/) {
	    $s .= ".";
	}
    }

    # Now open boot file and print saved data
    open(BOOT, "> $Bootfile")  || die "can not open $Bootfile";
    print BOOT "\ndirectory $Pwd\n";
    foreach $line (@bootmsgs) {
	print BOOT $line;
    }
    print BOOT "cache\t. db.cache\n";
    if (-r "spcl.boot") {
        print BOOT "include\tspcl.boot\n";
    }

    # Go ahead and start creating files and making SOA's
    foreach $i (@makesoa) {
	($x1, $x2) = split(' ', $i);
	&MAKE_SOA($x1, $x2);
    }
    printf DOMAIN "%-20s IN  A     127.0.0.1\n", "localhost";
    
    $file = "DB.127.0.0.1";
    &MAKE_SOA("db.127.0.0", $file);
    printf $file "%-30s\tIN  PTR   localhost.\n", &REVERSE("127.0.0.1");
    close($file);
}


sub PARSEARGS {
    local(@args) = @_;
    local($i, $net, $subnetmask, $option, $tmp1);
    local(*F, $file, @newargs, @targs);
    local($sec,$min,$hour,$mday,$mon,$year,$rest);

    $i = 0;
    while ($i <= $#args){
	$option = $args[$i];
	if($option eq "-d"){
            if ($Domain ne "") {
		print STDERR "Only one -d option allowed.\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
            }
	    $Domain = $args[++$i];
	    $Domainpattern = "." . $Domain;
	    $Domainpattern =~ s/\./\\./g;        # for stripping off domain

	    # Add entry to the boot file.
	    $Domainfile = $Domain;
	    $Domainfile =~ s/\..*//;
	    push(@makesoa, "db.$Domainfile DOMAIN");
	    push(@bootmsgs, "primary\t$Domain db.$Domainfile\n");

	} elsif ($option eq "-f"){
	    $file = $args[++$i];
	    open(F, $file) || die "Unable to open args file $file: $!";
	    while (<F>) {
		next if (/^#/);
		next if (/^$/);
		chop;
		@targs = split(' ');
		push(@newargs, @targs);
	    }
	    close(F);
	    &PARSEARGS(@newargs);

	} elsif ($option eq "-z"){
	    $Bootsecsaveaddr = $args[++$i];
	    if (!defined($Bootsecaddr)) {
		$Bootsecaddr = $Bootsecsaveaddr;
	    }

	} elsif ($option eq "-Z"){
	    $Bootsecaddr = $args[++$i];
	    if (!defined($Bootsecsaveaddr)) {
		$Bootsecsaveaddr = $Bootsecaddr;
	    }

	} elsif ($option eq "-b"){
	    $Bootfile = $args[++$i];

	} elsif ($option eq "-A"){
	    $doaliases = 0;

	} elsif ($option eq "-M"){
	    $domx = 0;

	} elsif ($option eq "-w"){
	    $dowks = 1;

	} elsif ($option eq "-D"){
	    $dontdodomains = 1;

	} elsif ($option eq "-t"){
	    $dotxt = 1;

	} elsif ($option eq "-u"){
	    $User = $args[++$i];

	} elsif ($option eq "-s"){
	    while ($args[++$i] !~ /^-/ && $i <= $#args) {
		push(@Servers, $args[$i]);
	    }
	    $i--;

	} elsif ($option eq "-m"){
	    if ($args[++$i] !~ /:/) {
		print STDERR "Improper format for -m option ignored ($args[$i]).\n";
	    }
	    push(@Mx, $args[$i]);

	} elsif ($option eq "-c"){
	    $tmp1 = $args[++$i];
	    if ($tmp1 !~ /\./) {
		$tmp1 .= ".$Domain";
	    }
            if ($Domain eq $tmp1) {
		print STDERR "Domain for -c option must not match domain for -d option.\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
            }
	    $tmp2 = $tmp1;
	    $tmp2 =~ s/\./\\./g; 
	    $cpatrel{$tmp2} = $tmp1;
	    push(@cpats, $tmp2);

	} elsif ($option eq "-e"){
	    $tmp1 = $args[++$i];
	    if ($tmp1 !~ /\./) {
		$tmp1 .= ".$Domain";
	    }
	    $tmp1 =~ s/\./\\./g; 
	    push(@elimpats, $tmp1);

	} elsif ($option eq "-h"){
	    $Host = $args[++$i];

	} elsif ($option eq "-o"){
	    if (   $args[++$i] !~ /^[:\d]*$/ 
		|| split(':', $args[$i]) != 4) {
		print STDERR "Improper format for -o ($args[$i]).\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
	    }
	    ($DefRefresh, $DefRetry, $DefExpire, $DefTtl) = split(':', $args[$i]);

	} elsif ($option eq "-i"){
	    $ForceSerial = $args[++$i];

	} elsif ($option eq "-H"){
	    $Hostfile = $args[++$i];
	    if (! -r $Hostfile || -z $Hostfile) {
		print STDERR "Invalid file specified for -H ($Hostfile).\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
	    }

	} elsif ($option eq "-C"){
	    $Commentfile = $args[++$i];
	    if (! -r $Commentfile || -z $Commentfile) {
		print STDERR "Invalid file specified for -C ($Commentfile).\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
	    }

	} elsif ($option eq "-N"){
	    $Defsubnetmask = $args[++$i];
	    if (   $Defsubnetmask !~ /^[.\d]*$/ 
		|| split('\.', $Defsubnetmask) != 4) {
		print STDERR "Improper subnet mask ($Defsubnetmask).\n";
		print STDERR "I give up ... sorry.\n";
		exit(1);
	    }
	    if ($#Networks >= 0) {
		print STDERR "Hmm, -N option should probably be specified before any -n options.\n";
	    }

	} elsif ($option eq "-n"){
	    ($net, $subnetmask) = split(':',$args[++$i]);
	    if ($subnetmask eq "") {
		foreach $tmp1 (&SUBNETS($net, $Defsubnetmask)) {
		    &BUILDNET($tmp1);
		}
	    } else {
		if (   $subnetmask !~ /^[.\d]*$/ 
		    || split('\.', $subnetmask) != 4) {
		    print STDERR "Improper subnet mask ($subnetmask).\n";
		    print STDERR "I give up ... sorry.\n";
		    exit(1);
		}
		foreach $tmp1 (&SUBNETS($net, $subnetmask)) {
		    &BUILDNET($tmp1);
		}
	    }

	} elsif ($option eq "-y"){
            $UseDateInSerial = 1;
            ($sec,$min,$hour,$mday,$mon,$year,$rest) = localtime(time);
            $DateSerial = ($mday * 100) + 
                          (($mon + 1) * 10000) + 
                          (($year + 1900) * 1000000);
	} elsif ($option eq "-1"){
	    print STDERR "Option -1 is obsolete ... ignored.\n";

	} elsif ($option eq "-F"){
	    print STDERR "Option -F is now the default (and only) way ... ignored.\n";

	} else {
	    if($option =~ /^-.*/){
		print STDERR "Unknown option: $option ... ignored.\n";
	    }
	}
	$i++;
    }
    
    if (!defined(@Networks) || $Domain eq "") {
	print STDERR "Must specify one -d and at least one -n.\n";
	print STDERR "I give up ... sorry.\n";
	exit(1);
    }
}


sub BUILDNET {
    local($net) = @_;

    push(@Networks, $net);
    #
    # Create pattern to match against.  
    # The dots must be changed to \. so they 
    # aren't used as wildcards.
    #
    $netpat = $net;
    $netpat =~ s/\./\\./g;
    push(@Netpatterns, $netpat);

    #
    # Create db files for PTR records.
    # Save the file names in an array for future use.
    #
    $netfile = "DB.$net";
    $Netfiles{$netpat} = $netfile;
    push(@makesoa, "db.$net $netfile");

    # Add entry to the boot file.
    $revaddr = &REVERSE($net);
    chop($revaddr);   # remove trailing dot
    push(@bootmsgs, "primary $revaddr db.$net\n");
}


#
# Calculate all the subnets from a network number and mask.
# This was originally written for awk, not perl.
#
sub SUBNETS {
    local($network, $mask) = @_;
    local(@ans, @net, @mask, $buf, $number, $i, $j, $howmany);

    @net = split(/\./, $network);
    @mask = split(/\./, $mask);
    $number = '';
    #
    # Only expand bytes 1, 2, or 3
    # for DNS purposes
    #
    for ($i = 0; $i < 3; $i++) {
	if ($mask[$i] == 255) {
	    $number = $number . $net[$i] . '.';
	} elsif (($mask[$i] == 0) || $mask[$i] eq '') {
	    push(@ans, $network);
	    last;
	} else {
	    #
	    # This should be done as a bit-wise or
	    # but awk does not have an or symbol
	    #
	    $howmany = 255 - $mask[$i];
	    for ($j = 0; $j <= $howmany; $j++) {
		if ($net[$i] + $j <= 255) {
		    $buf = sprintf("%s%d", $number, $net[$i] + $j);
		    push(@ans, $buf);
		}
	    }
	    last;
	}
    }

    if ($#ans == -1) {
	push(@ans, $network);
    }
    
    @ans;
}


sub GEN_BOOT {
    local(*F, $revaddr, $n);

    if (! -e "boot.cacheonly") {
	open(F, ">boot.cacheonly") || die "Unable to open boot.cacheonly: $!";
	print F "directory\t$Pwd\n";
	print F "primary\t\t0.0.127.IN-ADDR.ARPA    db.127.0.0\n";
	print F "cache\t\t.                       db.cache\n";
        if (-r "spcl.cacheonly") {
            printf F "include\t\tspcl.cacheonly\n";
        }
	close(F);
    }
    
    if (defined($Bootsecaddr)) {
	open(F, ">boot.sec") || die "Unable to open boot.sec: $!";
	print  F "directory\t$Pwd\n";
	print  F "primary\t\t0.0.127.IN-ADDR.ARPA    db.127.0.0\n";
	printf F "secondary\t%-23s $Bootsecaddr\n", $Domain;
	foreach $n (@Networks) {
	    $revaddr = &REVERSE($n);
	    chop($revaddr);
	    printf F "secondary\t%-23s $Bootsecaddr\n", $revaddr;
	}
	print  F "cache\t\t.                       db.cache\n";
        if (-r "spcl.boot") {
            printf F "include\t\tspcl.boot\n";
        }
	close(F);

	open(F, ">boot.sec.save") || die "Unable to open boot.sec.save: $!";
	print  F "directory\t$Pwd\n";
	print  F "primary\t\t0.0.127.IN-ADDR.ARPA    db.127.0.0\n";
	printf F "secondary\t%-23s $Bootsecsaveaddr db.%s\n", 
	       $Domain, $Domainfile;
	foreach $n (@Networks) {
	    $revaddr = &REVERSE($n);
	    chop($revaddr);
	    printf F "secondary\t%-23s $Bootsecsaveaddr db.%s\n", 
		   $revaddr, $n;
	}
	print  F "cache\t\t.                       db.cache\n";
        if (-r "spcl.boot") {
            printf F "include\t\tspcl.boot\n";
        }
	close(F);
    }
}

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Wed, 07 Jan 1998 17:58:08 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
To: Boris Statnikov <boromir@mindspring.com>
Subject: Re: Looping through hashes
Message-Id: <34B432AF.13373827@athena.lbl.gov>

Boris Statnikov wrote:
> 
> 1.
> Is there a way to know the number of elements in a hash IN ONE OPERATION
> (is there an equivalent of $# for hashes)?  I don't think so, but maybe
> someone knows better.

How about: scalar(keys(%hash)) ?

> 
> 2.
> It turns out one is not supposed to do this:
> 
> for (($key, $val) = each %myhash) {
>     if ($val eq "donkey") {
>         $myhash{"parrot"} = "silly bird";
>     }
> }
> 
> In other words, one is not permitted to ADD elements to a hash while
> EACHing through it.  Now, how do I accomplish the same thing (and how do
> I break out of each loop in order to accomplish it)?
> 
> Boris

It appears to me that your have written your code incorrectly.
With the above hunk of code, you remove the first two elements of
the hash and place them in a list - it is that list that is cycled
over in the for loop.  Try this:

%hash = ('test1' => 1,
        'test2' => 2,
        'test3' => 'donkey');

for (($key, $val) = each %hash) {
#     ^^^^^^^^^^^ list that 'for' is looping over
        print ++$i,":",$_,"\n";
}

The output should be:

1:test1
2:1

What you really want to do is the following: 

foreach $key (keys(%hash) {
	if($hash{$key} eq "donkey") {
		$hash{"parrot"} = "silly bird";
	}
}

You want to avoid 'each' when inserting elements into a hash because
'each' uses an internal iterator to loop over the hash, and this
iterator
is not safe for insertions.  The above foreach loop calls keys to
create a list that is then used by foreach - inside the loop, the 
hash is not accessed, so the hash can now be added to.  

shawn


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

Date: Wed, 7 Jan 1998 18:57:24 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Barry G Reville <breville@uoguelph.ca>
Subject: Re: Modularize non object code
Message-Id: <Pine.GSO.3.96.980107185545.28668l-100000@user2.teleport.com>

On 7 Jan 1998, Barry G Reville wrote:

> 	I have written a non object perl program that works fine but I 
> would like to modularize it for maintainability and reusability.  There 
> are many subroutines - many that I use multiple times.  Some of these are 
> general utilities that I would like to keep all in one file and somehow 
> be able to call the subroutines like normal.
> 	Is this possible, and if so how?

Have you seen the Perl docs on making module? Those - along with some of
the completed modules which come with Perl - should help you to get
started. If you still have questions about making modules after you've
read the docs, the newsgroup c.l.p.modules would be a good place to ask.
Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:01:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Allen Chen <achen@nssdc.gsfc.nasa.gov>
Subject: Re: Mysterious FileHandle + fork() behavior; possible Perl bug?
Message-Id: <Pine.GSO.3.96.980107180018.28668N-100000@user2.teleport.com>

On Tue, 6 Jan 1998, Allen Chen wrote:

> I wrote some quick C code which demonstrates the exact same
> behavior!  

Well, at least now Perl is exonerated! So now, do we blame the algorithm
or the OS? :-)

> The problem must have something to do with the fork() system
> call.  

Or perhaps with the IO libraries, or something else. Let us know when you
find out what's really happening!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:11:31 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter Wirdemo <Peter.Wirdemo@wirdemo.pp.se>
Subject: Re: newbie: fork and sleep
Message-Id: <Pine.GSO.3.96.980107180955.28668O-100000@user2.teleport.com>

On Wed, 7 Jan 1998, Peter Wirdemo wrote:

> Could anyone please explain why I must have 2 sleep's ( in the 
> while loop ) to get the process to sleep. If I dont have 2 sleep's,
> the process runs away forking as fast as it can.

The signal you're getting from the dead child process interrupts the first
sleep. Since sleep returns the number of seconds actually slept, you can
manually restart it if it wasn't long enough. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 07 Jan 1998 17:41:12 -0800
From: "Richard L. England" <richard_england@mentorg.com>
Subject: perl on 64 bit HP "merced" platform ??
Message-Id: <34B42EB8.EFB59CF5@mentorg.com>

Has anyone here had any experience with the new 64 bit HP platform ( I
believe it's code name is
Tahoe) and porting/using perl thereon?

Is the perl porter mail list still available.

--Richard

--
//         Richard L. England           richard_england@mentorg.com
// Mentor Graphics Corp., Wilsonville, OR 97070-7777     503.685.1240
//        ``The lyf so short, the craft so long to lerne.'' - Chaucer




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

Date: 8 Jan 1998 01:19:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl poetry
Message-Id: <6919j4$fqf$1@comdyn.comdyn.com.au>

In article <34B4084C.CFB7064B@enterprise.net>,
	Richard Allan <amallan@enterprise.net> writes:
> Does anyone have any Perl poems (like those in the Programming Perl
> book) as I am looking for some to do a review on for an English folio at
> school.

Have you tried an Altavista search for "perl poem" or something like
that?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: Wed, 7 Jan 1998 21:47:03 -0500
From: "James " <jamesr@tiac.net>
Subject: Re: Precompiled binaries [DateCalc|DateManip] for WinNT
Message-Id: <691ekg$ah9@news-central.tiac.net>

I use Manip.pm downloded from Cpan as is on Win95 -- why would you need to
recompile anything?

Regards
James :-)

============================================
James Ringrose
Boston MA
============================================
Joern Bodemann wrote in message <34B37A2C.D0EC5853@do.isst.fhg.de>...
>I want to use DateCalc or DateManip, but I cannot install them
>under WinNT 4 because I have no C compiler avaible.
>
>Are precompiled .dll files or whatever is needed out there?
>
>Thanks, Joern
>




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

Date: Wed, 7 Jan 1998 18:43:17 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephan Seitz <sseitz@suk.com>
Subject: Re: Prob: Statusbar or how to show parts of a Line before printing Return
Message-Id: <Pine.GSO.3.96.980107184258.28668Y-100000@user2.teleport.com>

On Wed, 7 Jan 1998, Stephan Seitz wrote:

> How can I print parts of a Line (and make them visible!) using a
> Perl-Script befor printing the Return?

Check out buffering and the magical $| variable. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 21:41:24 -0500
From: "James " <jamesr@tiac.net>
Subject: Re: Running  a perl script in the background on Windows(95/NT)
Message-Id: <691eaa$9vd@news-central.tiac.net>

I use the Task Scheduler on Win95 (the noew onw that is part of the IE4.0
upgrade) and run a .bat file as a minimized icon. On my 266PII you barely
notice that a Perl script is running except for the appearance of a DOS icon
on the task bar. My application runs for about 5 minutes and is both disk
and resource intensive (including using the WININET.DLL for Internet
access). The only issue I have with the Task Scheduler is that it can't tell
if my Perl script exits abnormally (that is hidden by the batch file). I use
a 'panic' file and a .log file to record process events to get round this.


Regards
James :-)
============================================
James Ringrose
Boston MA
============================================

Mike Noel wrote in message <01bd1b5d$f048e720$1512eecd@stephen>...
>Please forgive me if this is the wrong newsgroup.  My newserver doesn't
>carry comp.lang.perl (but it carries c.l.p.misc...).
>
>I've written a perl script on a Windows95/NT system that I would like to
>run and have sit in the background.  The script itself does a bit of
>processing, then sleeps for 5 minutes, over and over again.
>
>I come from a UNIX background where this sort of thing is trivial but I
>can't figure out how to do it in Windows.  Right now, when the script
>starts, it seems to run through a DOS window.  As long as the script is
>running the DOS window is on the screen (or minimized and on the taskbar).
>If I kill the DOS window the process quits.  I'd like to set up the script
>so that it doesn't use the DOS window.  I don't want it to show up on the
>taskbar.
>
>From looking at the task manager I see that Windows95/NT recognizes a
>difference between applications and processes.  It seems that applications
>have an associated window and processes don't.  So I guess I want to
>convert my perl script from an application to a process.
>
>How can I do this?
>
>Thanks.
>
>_M_
>noel@integrityonline.com
>




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

Date: Thu, 08 Jan 1998 01:52:30 +0000
From: catty <spam@spam.spam>
Subject: Re: sending email (Net::SMTP).. problem
Message-Id: <34B4315E.7B17107C@spam.spam>

Jacqui Caren wrote:

> Funny having re-read his comments I cannot see where he says
> not to use Net::SMTP to send mail to him.

That was not the issue ... I don't use it (or intend to),
haven't looked at it, and said nothing about it.

> >Email spammers usually relay and falsify headers, but they
> >cannot prevent the last "received" line from being accurate.
> 
> Bzzzt!!!
> The MTA is responsible for this and some MTA accept HELO
> unverified so in some cases (usually edu's :-[ ) you could
> generate an untracable message.

They need to get up to date. All ISPs should refuse
to relay blindly. That was a major spammer technique.
So my comment stands.

> >That isn't what I filter by; I filter those that have obviously
> >false header lines or lack the usual to/from/subject.
> 
> Date is supposed to be mandatory and our mailgate (PP) has a
> strict option which requires a valid Date: header. I cannot
> even enable this as many emails have broken or missing Date:
> headers. to/from/subject is a good start but does not cover
> all spam.

Good point. I was too lazy, will add the "Date:" generation.
But I haven't had any mail bounced yet, and if it ever did,
it would be visible immediately. That is why I mail direct,
to get immediate feedback. Gets there faster, too. Such as:

>> header: From: catty@xxxxx.com
>> header: To: xxxxx@xxxxx.com
>> header: Subject: can you understand this?
>> header: Organization: http://www.xxxxx.com/whatever
>> header:
>> from:   xxxxx@xxxxx.com
>> target: xxxxx@xxxxx.com is xxxxx at xxxxx.com
>> try:    mail.xxxxx.com
>> server: 220 xxxxxxxxxx.com ESMTP Sendmail 8.8.5/8.8.5; Wed, 7 Jan 1998 17:40:45 -0800 (PST)
>> server: 250 xxxxxxxxxx.com Hello xxxxxxxxxxx.com [111.111.111.111], pleased to meet you
>> server: 250 <xxxxx@xxxxx.com>... Sender ok
>> server: 250 <xxxxx@xxxxx.com>... Recipient ok
>> server: 354 Enter mail, end with "." on a line by itself
>> server: 250 RAA16994 Message accepted for delivery

Now, I suppose a message "accepted for delivery" might still
get kicked out or filtered but when that starts happening
then I'll start worrying about it. An overly-aggressive
spam filter is not my problem, really.

> Generating consistent
> mail via SMTP is not hard - I used to do this via telnet
> for a good few years when testing a 822<->X.400 gateway.

Indeed. I'm doing it in just a few lines of Perl.


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

Date: Wed, 07 Jan 1998 18:54:12 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Something equivalent to open("|foo|")?
Message-Id: <34B431A9.8C3C6679@5sigma.com>

One option is to write with one process and read with another.
Simpler than it sounds, under Unix anyway. I should probably 
post an example.

Open2 and Open3 are also (somewhat tricky) possibilities.

	-joseph
	 http://www.effectiveperl.com

Quixote Digital Typography wrote:
> 
> I would find it helpful to be able to do have a perl program send data
> to a program's stdin and get its stdout back.[...]


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

Date: Thu, 08 Jan 1998 02:04:52 +0000
From: catty <spam@spam.spam>
Subject: Re: Something equivalent to open("|foo|")?
Message-Id: <34B43444.36526FB1@spam.spam>

Quixote Digital Typography wrote:

> I would find it helpful to be able to do have a perl program send data
> to a program's stdin and get its stdout back.

I was playing around with resetting stdin to a tcp socket,
and then noticed it is possible (at least on my pc)
to both read and right from stdout i.e. my keyboard/display.
Weird, yet useful. But the "expect" (TCL) package might be
what you'd really want, to drive one program with another.


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

Date: 8 Jan 1998 02:13:18 GMT
From: dhiltz@whsun2.whoi.edu (David Hiltz)
Subject: Re: Stored Function Call from perl DBI
Message-Id: <691cnu$il31@dilbert.whoi.edu>

Evan Wetstone (evanw@netops.com) wrote:
: I'm writing a perl script that needs to call a stored function from
: an Oracle database.  I'm using perl 5.004_04, DBI, and DBD-Oracle.

: The stored function takes an integer and a string as parameters,
: and returns an integer.

: Any ideas on how to do this?  I've been racking my brain and searching
: the docs but can't seem to find any reference to it.

  Try looking at:

     www.hermetica.com/technologia/DBI

  You can join a mailing list here and then ask your question if 
  the answer is not somewhere on this page.

   -----------
   David Hiltz
   Email: dhiltz@whsun1.wh.whoi.edu
   Unix System and Network Administrator
   Northeast Fisheries Science Center
   ######&@&######


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

Date: 8 Jan 1998 01:41:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: suid unix help
Message-Id: <691asc$fqf$3@comdyn.comdyn.com.au>

In article <19980108011100.UAA19658@ladder01.news.aol.com>,
	webservice@aol.com (WebService) writes:
> Any ideas

perldoc perlsec

Will give you all the information on suidperl, wrapsuid, tainting,
untainting etc. that you will need.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | Curiouser and curiouser, said Alice.
NSW, Australia                      | 


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

Date: Wed, 7 Jan 1998 18:39:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Smellymama <smellymama@aol.com>
Subject: Re: TEST IF A VALUE EXISTS IN AN ARRAY
Message-Id: <Pine.GSO.3.96.980107183856.28668W-100000@user2.teleport.com>

On 7 Jan 1998, Smellymama wrote:

> Subject: TEST IF A VALUE EXISTS IN AN ARRAY

READ THE FAQ AND YOU CAN STOP YELLING.

:-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:38:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: canugi Yorugua <canugi@hotmail.com>
Subject: Re: Trimming blanks
Message-Id: <Pine.GSO.3.96.980107183709.28668V-100000@user2.teleport.com>

On Wed, 7 Jan 1998, canugi Yorugua wrote:

> I used to "trim" strings (get rid of surrounding blanks) by using
>=20
> $str =3D~ s/^\s*(.*?)\s*$/$1/;   # Get rid of surrounding blanks

> Now we have ported to a HP box and the @#!?&=A3&!! is not working properl=
y=20
> anymore. It trims *only* blanks preceding the string but not those after=
=20
> the after.

Maybe you've found a bug in your copy of perl. Or maybe your string
contains internal newlines and you want to use the /s modifier. If you're
not sure which it is, could you post some sample code which demonstrates
the behavior you're seeing? Thanks!=20

--=20
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:35:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: unlink return value
Message-Id: <Pine.GSO.3.96.980107182441.28668T-100000@user2.teleport.com>

On Wed, 7 Jan 1998, Dave Barnett wrote:

> I'm a bit confused.  If I understand things correctly, I would expect
> that this statement (assuming all variables are assigned--they are)
> 
> unlink ("$::logFile") or 
> 	&interrupt("Error on $::systemName","Cannot remove
> file","$::logFile","$!");
> 
> should unlink the file specified in $::logFile.  

Or, at least, it should try. :-)  (But you've got some meaningless quote
marks in there around variable names. They may be meaningful in "$!", but
probably not in "$::logFile". I'd take the extra ones out, on general
principles.) 

> If that returns 0, the subroutine interrupt should be called.  The
> interrupt subroutine either emails an error (non-interactive mode) or
> prints to STDERR in interactive mode. 

Does &interrupt also halt the script at that point, or does it let it
proceed from there? (Either behavior is acceptable, but it does matter
which it is.)

> What I'm seeing is that the job appears to be completing normally, AND
> is issuing the following error message through email:
> 
> Cannot remove file
> /opt/workSpaceCheck/logs/error_log
> No such file or directory

So, it looks as if the unlink failed and &interrupt reported that fact
properly. (And then &interrupt let the program proceed.)

> An ls -al shows:
> es10a:barnett [22] l /opt/workSpaceCheck/logs/error_log
> -rw-r--r--   1 root     other       7568 Jan  7 02:00
> /opt/workSpaceCheck/logs/error_log

Well, it looks as if it exists. But maybe there are some hard-to-see
characters in the filename (either on disk, or in $::logFile). Could it be
that $::logFile needs to be chomp()ed, perhaps? 

> 1.  What is the return value of unlink on success?  On Failure?

As documented, it's the number of files successfully unlinked.

> 2.  Is there a special variable that returns the error number given by
> the system (rather than the verbose wording)?

Yes; that's the magical $! variable. It's magical because it holds both a
number and a string. (That's why the double quotes in "$!" might be
meaningful: They force the string interpretation.) But you can also test
whether $! == 7, for example, if you know what error number 7 is on your
system. (Beware! Error numbers aren't all that portable.) 

> 3.  Does unlink have to be checked like a system call:  system(command)
> == 0 or die?

Only if you care about its success. And you seem to care. :-)

If you still can't find out what's happening here, post again, and we can
try some debugging code that may give the answer. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 18:36:24 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Keith Willis <keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com>
Subject: Re: unlink return value
Message-Id: <Pine.GSO.3.96.980107183521.28668U-100000@user2.teleport.com>

On Wed, 7 Jan 1998, Keith Willis wrote:

> >1.  What is the return value of unlink on success?  On Failure?
> 
> Had you simply done 'man unlink' you would realize the answer.
> 
>  RETURN VALUE
>       unlink() returns the following values:
> 
>             0   Successful completion.
>            -1   Failure.  errno is set to indicate the error.
> 
> For Grud's sake, doesn't anyone read a man page these days?

Of course, that's the return value from the unlink system call, which is
not the same as the return value of Perl's unlink function. 

> When emailing me, please note that there is no '.junk' in my address.

When posting, please take the .junk out of your address. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 7 Jan 1998 17:48:24 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Craig A. Keefner" <keefner@kinetic.com>
Subject: Re: Updating Perl 5.003 to 5.004 on Solaris 2.51
Message-Id: <Pine.GSO.3.96.980107174725.28668L-100000@user2.teleport.com>

On Tue, 6 Jan 1998, Craig A. Keefner wrote:

> I need to update my 5.003 with 5.004 so some new modules
> i need to use work.
> 
> forgive me for asking but, will i need to reinstall any/all of the
> already installed modules on my 5.003 (like CGI.pm and/or others). 

That depends, but the docs that come with 5.004's sources do a pretty good
job of explaining what it depends upon. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 07 Jan 1998 17:29:14 +0000
From: igor <igor@iprint.com>
Subject: Use of INNER JOINS ith DBD::ODBC
Message-Id: <34B3BB6A.577E@iprint.com>

I have two queries:

1. SELECT ProductID
FROM Product, Size
WHERE Product.ProductID = Size.ProductID AND Product.Product = 'some
product' 

2. SELECT ProductID
FROM Product INNER JOIN Size ON Product.ProductID = Size.ProductID
WHERE Product.Product = 'some product' 

They both work and return the same result if I paste them in MA Access
or MS SQL server, also both work from the code if I use Win32::ODBC.
But, If I use DBI with DBD::ODBC, the second one (with INNER JOIN) is
failing in $sth->execute().

The error is:  [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect
syntax near the keyword 'SET'. (SQL-37000)(DBD:
dbd_describe/SQLNumResultCols err=-1)
What keyword 'SET' is it talking about?!

Did anybody have the same problem? My first guess was DBI::ODBC driver
for DBI does not understand INNER JOIN but this is the same driver with
the one Win32::ODBC!

Thank you. 
Igor


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

Date: 8 Jan 1998 03:05:47 GMT
From: hpcwire@nic.cerf.net (Darnell Fall)
Subject: username:password crypt module
Message-Id: <691fqb$92g$1@news.cerf.net>

Keywords: 

Somewhere there has to be a quick and dirty module that will accept
a username and password as input, and squirt out a username and 
encrypted password.

Alternatively, a module that just squirts the encrypted password,
I can handle the other stuff.

It's the time pressure that's killing me.  I can chop a chunk of
C, but I'm trying to save an hour, and this is going to be used
in a perl script anyway.



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

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

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