[8209] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1827 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 7 00:08:04 1998

Date: Fri, 6 Feb 98 21:01:39 -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           Fri, 6 Feb 1998     Volume: 8 Number: 1827

Today's topics:
    Re: Perl in a datawarehouse environment <tchrist@mox.perl.com>
    Re: posix::strftime (core dumped) <tchrist@mox.perl.com>
    Re: Post vs. Submit Problems <tchrist@mox.perl.com>
    Re: push (). <tchrist@mox.perl.com>
    Re: Question: Searching files. <tchrist@mox.perl.com>
    Re: quick .signature  hack <philipm@nafohq.hp.com>
    Re: quick .signature  hack <tchrist@mox.perl.com>
    Re: Quickie: regexp for valid e-mail addresses <tchrist@mox.perl.com>
    Re: replacement for ls command? <tchrist@mox.perl.com>
    Re: run another process in backgorund <tchrist@mox.perl.com>
    Re: run another process in backgorund <tchrist@mox.perl.com>
    Re: searching by file creation/modification date? <tchrist@mox.perl.com>
    Re: searching by file creation/modification date? <tchrist@mox.perl.com>
    Re: secure perl <tchrist@mox.perl.com>
    Re: Socket Connections (David Efflandt)
    Re: Socket Connections (David Efflandt)
    Re: Syntax-coloring editor for NT <lutz@muc.de>
    Re: TTY Devices? <tchrist@mox.perl.com>
    Re: unable to capture info. resulting from a system() c <tchrist@mox.perl.com>
    Re: using unix commands in perl <tchrist@mox.perl.com>
    Re: using unix commands in perl <tchrist@mox.perl.com>
    Re: using unix commands in perl <tchrist@mox.perl.com>
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl <Barticus@worldnet.att.spam.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 4 Feb 1998 00:56:49 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl in a datawarehouse environment
Message-Id: <6b8ech$r22$5@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, eweiss@winchendon.com (Eric Weiss) writes:
:You can match or not match just about anything.  

You cannot match recursive patterns.

:And coming
:soon (...real soon :-) ) is a Perl compiler.

Which is not what anyone thinks it is.  The compiler does not make
your program smaller in size, faster in run-time, more portable, more
maintainable, more secure, nor more robust.  In fact, it diminishes all
those things.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    "Sometimes the sins of the fathers are visited on the nephews and nieces."
    	--Larry Wall


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

Date: 5 Feb 1998 13:41:20 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: posix::strftime (core dumped)
Message-Id: <6bcfi0$29n$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Volker Klau <volker@microdata.de> writes:
:POSIX::strftime( "%H:%M, on %D", localtime());
:gives a nice Segmentation fault under 
:- RedHat Linux/Intel 5.0 (glibc)
:- Perl 5.004

I've seen this on SunOS.  It's a tz thing here.  I can confirm the
bug on Linux under RH 5.  I can also confirm that this is a *new bug*.

$ perl -MPOSIX=strftime -le 'print POSIX::strftime("%H:%M, on %D", localtime());'

It works here:
    SunOS 4.1.3_U1 3 sun4m
    FreeBSD 2.2.5-STABLE FreeBSD 2.2.5-STABLE #0: Wed Dec 10 09:24:56 MST 
    Linux 2.0.12 #540 Sun Jan 5 13:11:35 MST 1997 i686
    Linux 2.1.24 #54 Fri Jun 6 12:54:56 EST 1997 ppc unknown

And it fails here:
    Linux 2.0.32 #1 Thu Dec 4 12:57:12 PST 1997 i686 unknown
    Linux 2.0.32 #1 Tue Jan 13 23:19:50 PST 1998 i586 unknown

Oddly enough, it succeeds here:
    Linux 2.0.32 #1 Mon Dec 15 10:51:12 PST 1997 i686 unknown
when running 5.003, not 5.004.  So I wonder what's up.

Perhaps it's a Y2K bug. :-)**2

Forwarded to perlbug for chewing on.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    double value;                /* or your money back! */
    short changed;               /* so triple your money back! */
            --Larry Wall in cons.c from the 4.0 perl source code


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

Date: 5 Feb 1998 02:22:24 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Post vs. Submit Problems
Message-Id: <6bb7p0$i6r$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Shane Hill <shill@ipa.net> writes:
:  I'm trying to get a query form to call a perl script, but my problem
:is that everytime I use the ACTION=POST in the form to call the script,
:ALL the variables never have values, although they get set.  If I use an
:ACTION=SUBMIT in my form everything works okay.  Why am I losing the
:values?

You've mistaken this for a CGI newsgroup.  Try there.
:
:This a readily available script and I know it should work without having
:to change POST to SUBMIT.

Last time I checked, there was no such thing as METHOD="SUBMIT".

Get GET for read requests, POST for write requests.  Switching
them can screw you.

:I am using IIS 3.0.

Some sins carry with them their own punishments.  Convenient, eh?

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "Just because you're screwed *up* doesn't mean your screwed." --Larry Wall


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

Date: 4 Feb 1998 13:48:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: push ().
Message-Id: <6b9rje$5ma$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, abigail@fnx.com writes:
:What I am trying to find out is the run time complexity of constructs
:like:
:
:     my @array = ();
:     foreach my $num (1 .. $N) {
:         push @array, $num;
:     }

My hunch is that its log2($N).

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "Don't let it get to you.  Shout happens." --Larry Wall


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

Date: 5 Feb 1998 03:42:36 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Question: Searching files.
Message-Id: <6bbcfc$m2m$4@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, email@business-links.co.uk writes:
:I've got a file of tab delimited information in the following format:
:
:aa   bb   cc   dd   http:\\www.website1.com

That's an illegal URL with that double badslash, BTW.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
        "Every normal man must be tempted at times to spit on his
	 hands, hoist the black flag, and begin slitting throats."
					 --H.L. Mencken


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

Date: Fri, 06 Feb 1998 18:04:03 -0800
From: Philip Mikal <philipm@nafohq.hp.com>
Subject: Re: quick .signature  hack
Message-Id: <34DBC113.331E1FC9@nafohq.hp.com>

Here... this might help you on your way. Then you can maybe have an
alias in your .cshrc (or whatever) for something like "randpine"...
(alias    randpine    'name_of_random_script_below.pl; pine')

I think that will work!?.  If it does, let me know.

Regards,

Philip-


##################################################
#!/usr/bin/perl5

$path_to_sig_file = "";
$path_to_sig_data = "";

# put all your sigs in a file 1 sig per line

# now we get them all
open (SIGDATA, "$path_to_sig_data");
while (<SIGDATA>) {
        push (@the_sigs, $_);
        }
close (SIGDATA);

# pick a random one
srand;
$num = int(rand(@the_ways));

# write new sig over old
open (SIGFILE, ">$path_to_sig_file");
print SIGFILE "$the_sigs[$num];
close (SIGFILE);

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







Mark Crane wrote:

> This is a pathetic attempt to get some perl wizard to write a
> simple script for me.  Please stop reading now if you find this
> annoying, etc.
>
> <plead>
>
> I am trying to figure out how to do the following:
>
> In order to use multiple random sigs on Pine, I am trying to
> cobble a
> script together that will
>
> 1. look at a file of quotes or sigs delimited by  multiple
> returns or some pre-chosen character string, like "$$$$"
>
> 2. select a quote at random.
>
> 3. write it to the file ".sig"
>
> That's it.  I would have it run every time I went into pine.  Is
> this doable in 4 lines or less? (not that it matters--I'm trying
> to goad someone into writing it for me because I am
> lazy/busy/newbie)
>
> </plead>
>
> thanks,
>
> Mark Crane





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

Date: 7 Feb 1998 01:57:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: quick .signature  hack
Message-Id: <6bgf30$b1b$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Mark Crane <mecran01@homer.louisville.edu> writes:
:
:This is a pathetic attempt to get some perl wizard to write a
:simple script for me.  Please stop reading now if you find this
:annoying, etc.

I do, but I'll give you the answer anyway.  However, I won't
explain it, nor help you install it.  That I leave as an 
exercise for the reader.

--tom

#!/usr/bin/perl
#
# sigrand -- supply random fortunes for .signature file

################################################################
# begin configuration section 

$MKNOD = "/bin/mknod";

$SIG{PIPE} = IGNORE;  # idiot vi

&gethome;

# for rec/humor/funny instead of rec.humor.funny
$NG_IS_DIR 	= 1; 	

$FULLNAME 	= "$HOME/.fullname";
$FIFO 		= "$HOME/.signature";
$ART 		= "$HOME/.article";
$NEWS 		= "$HOME/News";
$SIGS 		= "$NEWS/SIGNATURES";
$SEMA		= "$HOME/.sigrandpid";
$GLOBRAND	= 1/4;	# chance to use global sigs anyway

# end configuration section -- HOME and FORTUNE get autoconf'd
################################################################

&setup;

&justme;

#fork && exit; 	# be a daemon 

open (SEMA, ">$SEMA") || die "can't write $SEMA: $!";
print SEMA "$$\n";
close SEMA || die "can't close $SEMA: $!";

MAIN: while (1) {
    open (FIFO, "> $FIFO") || die "can't write $FIFO: $!";
    &load_sigs;
    $sig = $sig[rand @sig];
    print FIFO $name, "\n" x (3 - ($sig =~ tr/\n//)), $sig;
    close FIFO;
    #sleep 2; 
    # i don't know why, but if i don't do this, the open 
    # happens so faste people get multiple signatures.
    # 1/100th of a second seems enough
    select(undef, undef, undef, 0.1);
}
die "NOT REACHED";

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

sub setup {
    if (-e $FULLNAME) {
	$name = `cat $FULLNAME`;
	die "$FULLNAME should contain only 1 line, aborting" 
	    if $name =~ tr/\n// > 1;
    } else {
	chop($host = `hostname`);
	($host) = gethostbyname($host) unless $host =~ /\./;
	$user = $ENV{USER} || $ENV{LOGNAME} || $pw[0] || die "intruder alert";
	($name = $pw[6]) =~ s/,.*//;
	$name =~ s/&/\u\L$user/g; # can't believe some folks still do this
	$name = "\t$name\t$user\@$host\n";
    } 


    &check_fortunes if !-e $SIGS;

    unless (-p $FIFO) {
	if (!-e _) {
	    system("$MKNOD $FIFO p") && die "can't mknod $FIFO";
	    warn "created $FIFO as a named pipe\n";
	} else {
	    die "$0: won't overwrite file .signature\n";
	} 
    }


    srand(time|$$);
}

sub load_sigs {
    local($sigfile) = &ng;
    if (!-e $sigfile) {
	@sig = (&fortune);
	return;
    } 
    open (SIGS,$sigfile) || die "can't open $sigfile";
    local($/) = "%%\n";
    undef @sig;
    while (<SIGS>) {
	s!$/$!!o;
	push(@sig,$_);
    } 
    close SIGS;
} 

sub ng {
     (rand(1.0) > ($GLOBRAND) && open ART) || return $SIGS;   
     local($/) = '';
     $_ = <ART>;
     ($ng) = /Newsgroups:\s*([^,\s]*)/;
     $ng =~ s!\.!/!g if $NG_IS_DIR; 	# if rn -/,  or SAVEDIR=%p/%c
     $ng = "$NEWS/$ng/SIGNATURES";
     -f $ng ? $ng : $SIGS;
} 

sub fortune {
   local($_, $tries);
   do { 
       $_ = `$FORTUNE -s`; 
   } until tr/\n// < 4 || $tries++ > 20;
   local($*) = 1;
   s/^/ /g;
   $_ || " SIGRAND: deliver random signals to all processes.\n";
} 

sub check_fortunes {
    return if $FORTUNE;
    foreach $dir (split(/:/, $ENV{PATH}), '/usr/games') {
	return if -x ($FORTUNE = "$dir/fortune");
    } 
    die "Need either $SIGS or a fortune program, bailing out";
} 

sub gethome {
    @pw = getpwuid($<);
    $HOME = $ENV{HOME} || $ENV{LOGDIR} || $pw[7]
		       || die "no home directory for user $<";
}

# "There can be only one."  --the Highlander
sub justme {
    if (open SEMA) {
	chop($pid = <SEMA>);
	kill(0, $pid) && die "$0 already running (pid $pid)\n";
	#warn "COOL: no $pid: $!";
	close SEMA;
    } 
} 

__END__
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    "You can't have filenames longer than 14 chars.  
     You can't even think about them!"
        --Larry Wall in Configure from the perl distribution


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

Date: 4 Feb 1998 03:37:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <6b8np7$5t4$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Dan Sanderson <dsanders@u.washington.edu> writes:
:I know it's been done before, so I thought I'd ask before trying to compile my
:own.

:What's a good regexp that will only match valid e-mail addresses (i.e.
:name@subdomain.whatever.domain), that includes all the valid characters that
:can be seen in the domain name, etc., and requires the @ symbol?

No, it hasn't been done before.  You know why?  Because it
can't be done.  See the FAQ.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "Winter is worth its wait in cold." --Larry Wall


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

Date: 4 Feb 1998 00:59:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: replacement for ls command?
Message-Id: <6b8eif$r22$6@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Shimpei Yamashita <shimpei+this+address+is+NOT+munged+.mil+.gov@socrates.caltech.edu> writes:
:Well, if you really want ls, you can have it.
:#! /opt/bin/perl
:use Shell qw(ls);
:@found=ls(<*>);
:print "output of ls:\n", @found;

While this is correct, one questions just how different that 
result is from

    @found = <*>;

The answer, of course, lies in the newlines, but perhaps a broader
solution could have been given .:-)

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    I won't mention any names, because I don't want to get sun4's into
    trouble...  :-)     --Larry Wall in <11333@jpl-devvax.JPL.NASA.GOV>


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

Date: 5 Feb 1998 14:01:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: run another process in backgorund
Message-Id: <6bcgnj$4jm$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Daryl Sayers <daryl@stonemicro.com.au> writes:
:I want to spawn off a process from my perl script that will run
:in the background. I dont wish to wait for its return etc. The
:child process should be run as a background process and may last
:longer than the life of the perl script it was started from. Basically
:I want the same function as the & on a shell.

So use that.  

    system("cmd @args &");

Or look at a couple of my articles in the last few days for how
to manage forks on your own.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
                /* And you'll never guess what the dog had */
                /*   in its mouth... */
        --Larry Wall in stab.c from the v4.0 perl source code


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

Date: 5 Feb 1998 21:24:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: run another process in backgorund
Message-Id: <6bdalv$4s8$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Real" <real@earthling.net> writes:
:This piece of Perl comes directly from a tutorial (forgot which one).

And it's wrong.  Please see my recent postings using fork.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

Besides, it's good to force C programmers to use the toolbox occasionally.  :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>


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

Date: 4 Feb 1998 14:33:39 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: searching by file creation/modification date?
Message-Id: <6b9u83$7pr$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    jess@links.magenta.com writes:
:  Im completely at a loss to find a way within perl to look at file
:creation dates and sort them out into an HTML file. Im trying to create 
:a perl program that will automatically create a "Whats New" section on a
:web page, based on date stamps of all files within a tree. Im a novice
:at this but have spent hours looking through books and searching
:dejanews for anything relating to this process but I can't seem to find
:anything.

$ find dir -name '*.html' -mtime -3 -print

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    OK, enough hype.
            --Larry Wall in the perl man page 


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

Date: 5 Feb 1998 02:15:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: searching by file creation/modification date?
Message-Id: <6bb7ce$i6r$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, mwang@alhena.ibk.ml.com (Michael Wang) writes:
:What I do not know is under at what circumstances can access time be 
:earlier than modification time?

When the file has been written since it was read:

% stat /tmp/a | grep time
        atime           886612323 Wed Feb  4 10:12:03 1998
        mtime           886612321 Wed Feb  4 10:12:01 1998
        ctime           886612321 Wed Feb  4 10:12:01 1998
% echo foo >> /tmp/a
% stat /tmp/a | grep time
        atime           886612323 Wed Feb  4 10:12:03 1998
        mtime           886644886 Wed Feb  4 19:14:46 1998
        ctime           886644886 Wed Feb  4 19:14:46 1998

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
If you consistently take an antagonistic approach, however, people are
going to start thinking you're from New York.   :-)
        --Larry Wall to Dan Bernstein in <10187@jpl-devvax.JPL.NASA.GOV>


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

Date: 6 Feb 1998 16:11:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: secure perl
Message-Id: <6bfcoe$4f4$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, mpach@post.cz writes:
:I've been wondering if there's a way to run perl in a "secure mode".
:Something like the script would not be allowed to open files, call exec
:or system, etc. If this is possible I can easily let users embed some
:perl code in their html, which after some parsing would be passed to
:perl. 

I think you should look at the Safe module, at apache's mod_perl,
and the safe cgi environment from 

http://www.perl.comCPAN/modules/by-authors/Malcolm_Beattie/safecgiperl-b1.tar.gz

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    X-Windows: Warn your friends about it.
	--Jamie Zawinski


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

Date: Sat, 07 Feb 1998 03:01:04 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Socket Connections
Message-Id: <34dbcdff.894335@flood.xnet.com>

Oops! forget what I just said.  I was thinking of strings used to grep
or compare one IP to another.  Sorry.

David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Sat, 07 Feb 1998 03:27:17 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Socket Connections
Message-Id: <34dcd11d.1692729@flood.xnet.com>

This is a pair of subroutines I use in Linux or Solaris to return web
page contents (without http headers) if you pass the first one a URL.
See commented out alternatives to get page with headers or just the
http headers.  The LWP module could also be helpful, but I don't think
my ISP has it.  Not sure how well this works on WinNT.

sub wwwgrab {
#########################################################
#       sub wwwgrab based on modified 'wwwgrab' by      #
#       Jeff Ballard (ballard@cae.wisc.edu) 7/2/95      #
#       URL:  http://www.engr.wisc.edu/~ballard/        #
#########################################################
  my @data;
  ($_) = @_;
  /http:\/\/([^\/]*)\/*([^ ]*)/;
  my $site = $1;
  my $file = "/".$2;

  unless ($site) {
    die "$0:  Fatal Error.  Munged URL address.
        It must be in the form of http://www.any.site/location\n";
  }
   
  $site =~ /^([^:]*):*([^ ]*)/;
  my $hostname = $1;
  my $port = $2;
  $port = 80 unless $port;

  # Open a socket and get the data
  my ($sockaddr,$there,$response,$tries) = ("Snc4x8");
  $there = pack($sockaddr,2,$port, &getaddress($hostname));
  my $proto = (getprotobyname ('tcp'))[2];
  if (!socket(S,AF_INET,SOCK_STREAM,$proto))
    { die "$0:  Fatal Error. $!\n"; }
  if (!connect(S,$there)) { die "$0:  Fatal Error.  $!\n"; }
  select S; $| = 1;
  select STDOUT; $| = 1;
  print S "GET $file\n\n";		# page contents only
#  print S "GET $file HTTP/1.0\n\n";	# page with headers
#  print S "HEAD $file HTTP/1.0\n\n";	# just http headers
  while (<S>) {
    push @data, $_;
  }
  close S;
  @data;
}

sub getaddress {
  my ($host) = @_;
  my (@ary);
  @ary = gethostbyname($host);
  return(unpack("C4",$ary[4]));
}


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Fri, 06 Feb 1998 17:34:45 +0100
From: Lutz Albers <lutz@muc.de>
To: Shawn McMahon <smcmahon@pplsi.com>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <34DB3BA4.43F216B7@muc.de>

Shawn McMahon wrote:

> Anybody know of a 32-bit NT editor that will do syntax-coloring for Perl?
>
> I know I can program Winedit or AY Pad to do it, but I'd kind of like to
> find something already done.  Maybe a config for either of those programs,
> or an entirely different program.

Well, there is always emacs :-) (Yes, there is a Win32 port ..)

--
Lutz Albers, lutz@muc.de
Do not take life too seriously, you will never get out of it alive.





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

Date: 4 Feb 1998 00:42:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: TTY Devices?
Message-Id: <6b8dic$r22$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, greg@geographe.com.au writes:
:Does anyone know of a module which interfaces to TTY devices in a Unix
:environment??

You mean besides the ones talked about in the standard perlfaq5
and perlfaq8 manpages, or listed on CPAN?

Nope.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    In general, they do what you want, unless you want consistency.
            --Larry Wall in the perl man page


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

Date: 5 Feb 1998 21:51:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: unable to capture info. resulting from a system() call
Message-Id: <6bdc9o$7m4$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Bhanu P. Suravarapu" <bhanu@usl.edu> writes:
:I have system() call in my cgi program (perl script). After this
:call is made the script prints out some html text onto the web 
:browser by default.

The read the FAQ.  perlfaq8 covers this issue.  Essentially, 
you are using the wrong function call.  Why people do this
is beyond me.  Probably lack of real shell programming experience
and decent books.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    Hey, I had to let awk be better at *something*...  :-)
            --Larry Wall in <1991Nov7.200504.25280@netlabs.com>1


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

Date: 4 Feb 1998 03:29:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: using unix commands in perl
Message-Id: <6b8nae$5t4$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Gil Brown <gbrown@cae.ca> writes:
:In Perl4 I use to put qx%cp help.html fun/html%;

Void backticks are considered scary.  See the faq.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    Perl programming is an *empirical* science!  
	    --Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>


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

Date: 4 Feb 1998 00:49:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: using unix commands in perl
Message-Id: <6b8dvh$r22$4@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Kimbrough Gray <kigray@cs.utexas.edu> writes:
:I'm trying to copy a file from one directory to another.
:I've been typing in 
:cp help.html fun/help.html;
:And I have been getting an error which reads
:"Search pattern not terminated at add.cgi line 14"
:Line 14 is "cp help.html fun/help.html;"
:I thought I had heard that you could type in Unix commands directly
:into your perl code but maybe I am incorrect.

That's right.  You're wrong.  You have to use system() 
to run commands:

    $that_didn't_work = system("cp help.html fun/help.html");

    if ($that_didn't_work) {
	die "The copy failed.  I hope it told you why.";
    } 

Not that this is quite different from fetching the standard
output and/or standard error from the command.  In this case,
it doesn't actually matter too much.  See perlfaq8 for details.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    Actually, you'll know we're nearing the end when I make |$foo| mean
    "absolute value"...  :-) Larry Wall in <1994Feb25.192042.17196@netlabs.com>


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

Date: 4 Feb 1998 13:46:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: using unix commands in perl
Message-Id: <6b9rgc$5ma$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, fl_aggie@thepentagon.com (I R A Aggie) writes:
:use File::Copy;
:copy("help.html","fun/help.html");

And how do you find out which of those two files was
the problem in the case of failure?

File::Copy sucks in this regard.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

	    Seven is right, but so is even,
	    Hyphen, roughen, nephew Stephen,


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

Date: Fri, 06 Feb 1998 20:22:03 -0800
From: RandallBart <Barticus@worldnet.att.spam.net>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6bgo2l$klk@bgtnsc03.worldnet.att.net>

Tom Christiansen wrote:
> 
> The first lie routinely recounted is that the Y2K problem historically
> derived from expensive computers of yesteryear whose memory was so
> dear that programmers maintained dates in a two-digit format to keep
> costs under control.
> 
> This assertion is demonstrably false.  Think about it.  A two-digit
> number requires how much storage?  Two bytes, that is, sixteen bits?
> No, much less: numeric data are seldom stored in text format, since a more
> compact representation is readily available.  A two-digit year would be a
> number ranging between 00 and 99.  That can be represented in just 7 bits.

No lie:  The data enters the system in decimal.  Historically the date
was punched on a card, later it was entered by key to tape and later
interactive terminals, but the dates are typed in decimal by a human
being.  Punching two more digits on a card would be expesive -- every
keystroke is an opportunity for error.  Further input formats grew to
fit the card.  It was terribly traumatic when data had to be split
accros two cards.  So it would have been preposterous to get them to
punch four digit years on cards.

Once you read in this decimal data, why change its format?  Converting
decimal to binary and back was a very expensive operation.  It would add
extra code to your program, and in olden days it was a constant battle
to keep programs in core.  Extra code to convert a date, using extra
tape and disk space was simply viewed as a waste of time.

Why do you think it's a lie?  Who could make up such a lie?  Do you
think that some commie conspiracy boobie-trapped all your software, and
this is the cover story?

Have you ever tried to fit a program in 2K?

-- 
I  |\   Randall Bart                      mailto:Barticus@usa.spam.net
L  |/   
o  |\        Barticus@worldnet.att.spam.net  Barticus@hotmail.spam.com
v  | \  1-818-985-3259                       Please reply without spam
e    |\ 
Y    |/ Panic in the Year Zero Zero:  http://members.aol.com/PanicYr00
o    |\ The 28th Term Revealed:
u    |/                 http://members.aol.com/PanicYr00/Sequence.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 1827
**************************************

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