[7251] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 876 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 15 20:08:09 1997

Date: Fri, 15 Aug 97 17:00:22 -0700
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, 15 Aug 1997     Volume: 8 Number: 876

Today's topics:
     Re: ** redirection question. ** (Malcolm Hoar)
     Re: .htgroup files and HTTPD:GroupAdmin:Text.pm <dougm@osf.org>
     Re: bug passing alists as sub arguments <dbenhur@egames.com>
     Re: Capitals <jefpin@bergen.org>
     Re: converting from hex (Terry Michael Fletcher - PCD ~)
     cross-referencer for C/C++? <elias@telcontar.tc.cornell.edu>
     Re: Help with catman/makewhatis (Trey Valenta)
     Re: How to fix "Can't locate Curses.pm in @INC" <paul.stevenson@balliol.ox.ac.uk>
     How to return to perl from a shell? <kerr_tung@sdt.com>
     Is this a permissions problem? <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
     Re: MD5 in PERL? (John L. Allen)
     modules??? <kurt@rfpi.com>
     perl -v seems to be lying <usenet-tag@qz.little-neck.ny.us>
     perl 5.004_02 on Dig Unix 4.0B - compile problem (Brian C Hill)
     Re: Perl and HTTP (Christian Roy)
     Perl script to send email to a pager <larry@acomplist.com>
     Re: Problems with eval. <rootbeer@teleport.com>
     Re: Question of using stat function <rootbeer@teleport.com>
     Re: Removing elements in the middle of arrays? (Andrew M. Langmead)
     Re: Seeking object enlightenment (Ken Irving)
     Re: split perl string (Aaron Sherman)
     Re: Split strings in perl (Aaron Sherman)
     Re: Split strings in perl <jefpin@bergen.org>
     Re: Walking the tree <jefpin@bergen.org>
     Year 2038 (was Re: Help! - Reformatting Date) (Bennett Todd)
     Re: Year 2038 (was Re: Help! - Reformatting Date) (Scott McMahan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 15 Aug 1997 20:01:47 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: ** redirection question. **
Message-Id: <5t2cj8$9dd$1@nntp1.ba.best.com>

In article <5t26n9$pdg$1@news.fm.intel.com>, tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~) wrote:

>strange.  even though this is an HTML/CGI problem, i dont see why it is a
>problem.  i have had no problem doing that before, or even:
>
>print "Location: document.html?$some_query_string\n\n";
># or
>print "Location: document.html#$some_name_ref\n\n";

Location: headers should contain an *absolute* URL (including
the http://....).

You can get away with relative addresses on some server/browser
combinations but not on others.



-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Fri, 15 Aug 1997 18:26:26 -0400
From: Doug MacEachern <dougm@osf.org>
To: jwyates@netcom.com
Subject: Re: .htgroup files and HTTPD:GroupAdmin:Text.pm
Message-Id: <33F4D792.37C0@osf.org>

John W. Yates wrote:
> 
> Hi,
> 
>   I'm coding some stuff using HTTPD::GroupAdmin and think it has
> a bug, or at least and incompatability with in "Text" mode Apache:
> It creates .htgroup files comma delimited.  I believe Apache is
> interpreting the comma as part of the logon name in the group list
> and thus all but the last name in the list fail authentication when
> I try to use group authentication.
> 
>   If I had control over the files (they are "owned" by the ISP),
> I would change the code in HTTPD::GroupAdmin::Text.pm to not add
> the comma, but I can't.  Can anyone confirm that this is a problem,
> at least, so that I can set the admin people at the ISP at ease
> that it IS indeed a problem?

That behavior dates back to when Apache and NCSA shared the same file 
format.  To use the new Apache format, try this:

 my $group = HTTPD::GroupAdmin->new(
                    DBType => "Text", 
                    Server => "apache",
                    ...);

See also, t/apache-groups.t

-Doug


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

Date: Fri, 15 Aug 1997 14:00:20 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: biestw01@popmail.med.nyu.edu
Subject: Re: bug passing alists as sub arguments
Message-Id: <33F4C364.757E@egames.com>

[mail&post]
William Biesty wrote:
>         Odd number of elements in hash list at iceflow.pl line nnn
> in Perl 5.004 on a DEC Alpha UNIX (Digital UNIX V4.0B  (Rev. 564);) when I
> pass an associative array as the middle argument to a subroutine.
> 
>         sub bob {
>                 local ($x, %y, $z) = @_;
[...]
> When I move the list to the end of the arguments, I don't
> get the error. This code worked fine in version 4.0.1.7
> patch level 35 on ULTRIX V4.2A (Rev. 47).
> 
> Is there a patch for this?

You already found the "patch".  If you write correct Perl code,
it runs fine.   When assigning a list to a list, the first list-var
(array or hash) in the lvalue list will soak up all the remaining
values in the rvalue list:

  ($a,$b,@c,@d,$e) = (1,2,3,4,5,6,7);
results in:
  $a = 1;
  $b = 2;
  @c = (3,4,5,6,7);
  @d = undef;
  $e = undef;

(See Camel p48-49)

The "bug" was in your older ULTRIX perl4 which failed to complain.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
Warning: Dates in Calendar are closer than they appear.



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

Date: Fri, 15 Aug 1997 17:44:08 -0400
From: Anagrams of the Word 'A' <jefpin@bergen.org>
To: John Grimm <jgrimm@wireedm.com>
Subject: Re: Capitals
Message-Id: <Pine.SGI.3.95.970815174333.18662A-100000@vangogh.bergen.org>

>How can I convert a string to all capitals?


Perl 4:
	$string =~ tr/a-z/A-Z/;

Perl 5:
	uc($string);


----------------
| "Here we are now, entertain us!"
| 	- Nirvana
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem?  Let me know!

webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS



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

Date: 15 Aug 1997 22:10:29 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: converting from hex
Message-Id: <5t2k4l$395$1@news.fm.intel.com>

Scott Houck (scott@radix.net) so eloquently and verbosely pontificated:
> Darrell Johnson <" darrell_johnson"@nmisq2.miss.nt.com> wrote:
> 
> An excellent refinement!  However, I was SHOCKED :-) to notice your
> *inefficient* use of "a1" to unpack something that was never going to
> be used!  Use "x" instead!  Then you don't have to shift @ret, and you
> won't even *need* @ret!  And while we're at it, who needs my $input?
> (Literally, not figuratively :-)
> 
> sub tohex ($) {
>    return map{hex} unpack "xa2a2a2", shift;
> }

but that return needs to be evaluated in LIST context, not scalar.  it
needs a join or something.  here is my version, but with the "#" optional:

print "RGB value #4aBabe is (".rgbval(4aBabe).")\n";
sub rgbval {
	shift =~ /#?(..)(..)(..)/;
	return join ",",map{hex}$1,$2,$3;
}

--
               "Give me ambiguity or give me something else."
 ______                       ______ _               _               
(_) |                        (_) |  | |             | |              
    | _   ,_    ,_              _|_ | |  _ _|_  __  | |     _   ,_   
  _ ||/  /  |  /  |  |   |     / | ||/  |/  |  /    |/ \   |/  /  |  
 (_/ |__/   |_/   |_/ \_/|/   (_/   |__/|__/|_/\___/|   |_/|__/   |_/
*+*+*+*+*+*+*+*+*+*+*+* /| *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+* 
                        \|    tfletche@pcocd2.intel.com
*+*+*+*+*+ Views expressed...not INTeL's...yadda yadda yadda.... *+*+*+*+*+*





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

Date: 15 Aug 1997 15:07:26 -0400
From: Doug Elias <elias@telcontar.tc.cornell.edu>
Subject: cross-referencer for C/C++?
Message-Id: <s9pwwlnjmdt.fsf@telcontar.tc.cornell.edu>



G'day ...


Has anyone done a package/module that can produce a symbol (variables
and defined-names) cross-referencer for C/C++?  Just did a real-fast
pass thru CPAN and didn't see anything that looked appropriate, so
figured i'd waste all of your time by asking (;-)

Thanks,
doug

-- 
  __|_        Internet:   elias@tc.cornell.edu
dr _|_)oug    USmail:     Sci.Comp.Support/Cornell Theory Center
  (_|                     737 Rhodes Hall/C.U./Ithaca/N.Y./14853-3801
  (_|__       MaBelle:    607-254-8686   Fax: 607-254-8888
    |         MOOs:       doug/DougE/Strider/Dun'a'dan
        


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

Date: 15 Aug 1997 23:33:42 GMT
From: trey@zipcon.net (Trey Valenta)
Subject: Re: Help with catman/makewhatis
Message-Id: <871688011.947353@ran.zipcon.net>


I'm crossposting this since I've seen this question in all three places
now and no one had an answer (at least that I got).

The problem was that Solaris was not properly creating the windex file
for various non Sun man pages and unfortunately, the only thing anyone
ever said what "did you try catman or makewhatis?" The real problem was
that Sun's supplied /usr/lib/getNAME didn't account for man pages which
have ".IX Header "NAME"" following the .SH NAME entry as almost (all?)
the perl pages do. My solution was to hack this script out, reanme
/usr/lib/getNAME to getNAME.sun and replace getNAME with this. So far, I
haven't found any problems using it. Still, I think this should go in an
FAQ somewhere.

----cut here----
#!/usr/local/bin/perl

# 980815 -- Trey Valenta trey@zipcon.net

# Arguments are filenames to parse. Don't know if catman/makewhatis
# also ever sends any options. Guess I will find out.

# Sun's /usr/lib/getNAME assumes that the line after the .SH NAME
# macro is the relevant information for the program (name and
# purpose.) This fails on perl man pages and others that follow
# .SH "NAME" with .IX Header "NAME".

while ( @ARGV ) {
    my $filename = shift;
    my $TH;
    my $SH;
    open($filename, "$filename") || warn "Can't read $filename: $!\n";
    while (<$filename>){
        chomp;
        if ( /^\.TH\s+.*$/ ) { $TH = $_ }
        if ( /^\.SH\s+.*NAME.*/ ) {
            chomp($SH = <$filename>);
            if ( $SH =~ /^\.IX/ ) { chomp($SH = <$filename>) }
        }
        # Do we have the two fields we need?
        if ( $TH && $SH ) { last }
    }
    close($filename);
    if ( $TH && $SH ) { print STDOUT "$TH\t$SH\n" }
}

__END__


--
Trey Valenta	trey@zipcon.net	 Seattle, WA



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

Date: 15 Aug 1997 21:12:58 +0100
From: Paul Stevenson <paul.stevenson@balliol.ox.ac.uk>
Subject: Re: How to fix "Can't locate Curses.pm in @INC"
Message-Id: <lpen7vyzlh.pilchard@meta.physics.ox.ac.uk>

>>>>> "Kerr" == Kerr Tung <kerr_tung@sdt.com> writes:

    Kerr> Hi all, I downloaded perlmenu.v4.0 and tried to run the demo
    Kerr> program, got the following error message:

    Kerr> Can't locate Curses.pm in @INC at demo line 23.  BEGIN
    Kerr> failed--compilation aborted at demo line 23.

    Kerr> Maybe the perl v5.003 was not installed correctly. What is
    Kerr> missing. How do I fix this?

    Kerr> Thanks, Kerr

Curses.pm doesn't come in the standard tarfile - you need to download it 
from CPAN. Go to http://www.perl.com and thence to CPAN, a search for
"Curses" will lead you to the appropriate file. Once downloaded and
unpacked, the README file contains installation information.

Hope this helps

Paul


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

Date: Fri, 15 Aug 1997 16:30:02 -0500
From: Kerr Tung <kerr_tung@sdt.com>
Subject: How to return to perl from a shell?
Message-Id: <33F4CA5A.1149@sdt.com>

Hi all,

In my perl program, I have a system call to ClearCase setview command
which spawns a shell. How do I have it automatically exit the shell and
return back to my perl program to execute the commands followed?

Thanks,
Kerr


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

Date: 15 Aug 1997 21:38:26 GMT
From: "Henry Wolff" <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Subject: Is this a permissions problem?
Message-Id: <01bca9c3$25af65e0$b11de4cf@hatsoftnevada.lovelock.nv.us>

I got a minor problem (I hope) here that I am pulling my hair out on :)
When I call a perl script from the browser url line like
http://.../cgi/ad.cgi?pege it works just fine.
But when I call it from the HTML page like
<!--#exec cgi="cgi/ad.cgi?pege" -->
it gives me an error processing this directive.
BUT if I leave off the ?pege it works though.
this is the code I am using to get the 'pege':
$site_name=$ENV{'QUERY_STRING'};
The permissions are set for the cgi as rwxr-xr-x
Any suggestions?

Thanks in advance,
Henry Wolff
Star Trek Collectibles Trading Post
Free4All Classifieds, Clipart, Animations, Sounds, Fonts, Pictures and
more...
http://www.hatsoft.com/newtrek/index.html



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

Date: 15 Aug 1997 16:04:16 -0400
From: allen@gateway.grumman.com (John L. Allen)
Subject: Re: MD5 in PERL?
Message-Id: <5t2co0$1ve@gateway.grumman.com>

In article <01bc9772$2c405210$b454f026@uslbpc80>, lmm <lmm@vasco.com> wrote:
>Tom,
>
>I thank you sincerely for your prompt response. Your information is
>enlightening, but I  still must continue my search for an implementation of
>MD5 in PERL, so if anyone out there knows of somewhere I can obtain it, I
>would be thankful

Here, try this.

#!/bin/perl -- RSA's MD5 in perl5 - "Fast" version.
#
# Usage:
#	md5 < file
#
# Test Case:
#	$ echo 1234567890 | md5
#	7c12772809c1c0c3deda6103b10fdfa0
#
# This version has been somewhat optimized for speed, and gets about
# 16 KB per second on a PPC604-120 42T workstation.  Still pitiful
# compared with C.  Feel free to improve it if you can.
#
# Author: John L. Allen, allen@gateway.grumman.com, 3/8/97
#

	# "Magic" <K>onstants, one for each of 64 rounds.
	# These _must_ be defined before ``use integer''.

my @K = map { int abs 2**32 * sin $_ } 1..64;

use integer;

	# Which word of the input <B>lock to operate on for all 64 rounds

my @B = (
	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, # rounds  0 - 15
        1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, # rounds 16 - 31
        5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, # rounds 32 - 47
        0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9, # rounds 48 - 63
);

	# <L>eft roll amounts in bits for all 64 rounds

my @L = (
	( 7, 12, 17, 22) x 4,   # rounds  0 - 15
        ( 5,  9, 14, 20) x 4,   # rounds 16 - 31
        ( 4, 11, 16, 23) x 4,   # rounds 32 - 47
        ( 6, 10, 15, 21) x 4,   # rounds 48 - 63
);

	# Initial Accumulator Values

my ($aa, $bb, $cc, $dd) = (0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);

	# <M>ask values for right shifts to prevent sign propagation

my @M = map { 2**$_ - 1 } 0..32;

my @a = (0..15);
my @b = (16..31);
my @c = (32..47);
my @d = (48..63);

my ($a, $b, $c, $d, $t, $n, $l, $r, $p);

my @W;

do{
  $l += $r = read STDIN, $_, 64;
  $r++, $_ .= "\x80" if $r<64 && !$p++;
  @W = unpack V16, $_."\0"x7;
  $W[14] = $l*8 if $r<57;
  $a=$aa, $b=$bb, $c=$cc, $d=$dd;
  for(@a){
    $x=($b&$c|$d&~$b)+$W[$B[$_]]+$K[$_]+$a;	$n=$L[$_];
    $t=$b+($x<<$n|$M[$n]&$x>>32-$n), $a=$d, $d=$c, $c=$b, $b=$t
  }
  for(@b){
    $x=($b&$d|$c&~$d)+$W[$B[$_]]+$K[$_]+$a;	$n=$L[$_];
    $t=$b+($x<<$n|$M[$n]&$x>>32-$n), $a=$d, $d=$c, $c=$b, $b=$t
  }
  for(@c){
    $x=($b^$c^$d)+$W[$B[$_]]+$K[$_]+$a;		$n=$L[$_];
    $t=$b+($x<<$n|$M[$n]&$x>>32-$n), $a=$d, $d=$c, $c=$b, $b=$t
  }
  for(@d){
    $x=($b|~$d^$c)+$W[$B[$_]]+$K[$_]+$a;	$n=$L[$_];
    $t=$b+($x<<$n|$M[$n]&$x>>32-$n), $a=$d, $d=$c, $c=$b, $b=$t
  }
  $aa+=$a, $bb+=$b, $cc+=$c, $dd+=$d
} while $r>56;

print unpack(H32, pack V4, $aa, $bb, $cc, $dd), "\n";
-- 
_/JohnL\_allen@gateway.grumman.com <Sun>: 9.5 billion pounds per sec to energy
~\Allen/~Fax: 516-575-7428    <Universe>: 1e22 stars = 22 solar masses per sec


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

Date: Fri, 15 Aug 1997 19:08:37 -0400
From: Kurt <kurt@rfpi.com>
Subject: modules???
Message-Id: <33F4E175.8EB102A9@rfpi.com>

OK, I am the dummy here. I have been learning Perl for a few months now
and am progressing very quickly. However, I am really stuck on a few
things.

I understand what CPAN is ( I think). It is a source of Perl modules to
use with your Perl scripts. i have actually tried to go to some of the
CPAN sites but quickly found myself lost. Is there any good
documentation on it.

Also, how does one actually use a module? Is it something like this?

require module;

Or am I completely missing the point here?

Is the whole idea behind modules similiar to object orientated concepts?

Are there modules for creating web based databases that I can use with
Perl and SQL?

Do all the modules have documentation that tell me how to install it,
how to reference it, what it's purpose is, etc...?

Are databases nothing more than super Perl associative arrays?

Thanks for all your help?

Kurt




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

Date: 15 Aug 1997 20:15:27 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: perl -v seems to be lying
Message-Id: <eli$9708151601@qz.little-neck.ny.us>

Anyone want to suggest where I have gone wrong applying the 
perl 5.0401 patch?

:r! make 2>&1 | tail -2
 
        Everything is up to date.

:r! head -2 patchlevel.h
#define PATCHLEVEL 4
#define SUBVERSION 1

:r! ./perl -v | head -2

This is perl, version 5.004

I am strongly guessing that perl is finding the libperl.so from
my previous version, but I do not want to remove that until I
can complete 'make test'. Unfortuneately 'make test' has lots
of tests that check the version number.... The LD_LIBRARY_PATH
variable seems to be ignored.

Elijah
------
annoyed



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

Date: 15 Aug 1997 20:08:45 GMT
From: bchill@gis.ucdavis.edu (Brian C Hill)
Subject: perl 5.004_02 on Dig Unix 4.0B - compile problem
Message-Id: <5t2d0d$9t1$1@mark.ucdavis.edu>

	I keep getting this error - even with a simple Configure and make:

        Making IO (dynamic)
Running '../../miniperl -I../../lib ../../lib/ExtUtils/xsubpp -v 2>&1' exits wit
h status 1 at (eval 26) line 16.
Running '../../miniperl ../../lib/ExtUtils/xsubpp temp000 2>&1' exits with statu
s 1 at (eval 26) line 41.
Writing Makefile for IO
Warning: No Makefile!
make[1]: Entering directory `/usr/pkg-src/contrib/src/perl5.004_02/ext/IO'
make[1]: *** No rule to make target `config'.  Stop.
make[1]: Leaving directory `/usr/pkg-src/contrib/src/perl5.004_02/ext/IO'
/pkg/gnu/bin/make config failed, continuing anyway...
make[1]: Entering directory `/usr/pkg-src/contrib/src/perl5.004_02/ext/IO'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/usr/pkg-src/contrib/src/perl5.004_02/ext/IO'
gmake: *** [lib/auto/IO/IO.so] Error 2

	Any clues?

   ____________________________________________________________________
  / Brian C. Hill                   bchill@ucdavis.edu  (916) 753-0358 \ 
  | Systems Programmer              University of California, Davis    |
  | Graduate School of Management & GIS Research Lab                   |


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

Date: Fri, 15 Aug 1997 19:43:14 GMT
From: roychri@total.net (Christian Roy)
Subject: Re: Perl and HTTP
Message-Id: <33f4a511.156243351@news.total.net>

On Wed, 13 Aug 1997 11:41:03 -0600, rob@persimmon.com wrote:

>Does anyone have a Perl script that initiates an HTTP connection
>and performs a POST action, or even a GET?  I'm new to sockets
>and am just looking for some examples.
>

If you are using BSDI, there is a program call EXPECT that you could
use. That's what I use. It's pretty simple. 

Here is an example of a EXPECT SCRIPT :

#!/usr/contrib/bin/expect

#Make sure that the 'telnet' command do not sohw in the result
log_user 0
#Set the time to wait for the web server to answer. If the web server
# is slow, increment this value
set timeout 5

#Get the command line parameters. Store those parameters in variables.
set hostname [lindex $argv 0]
set port [lindex $argv 1]
set document [lindex $argv 2]

#Connect to the web server on the web port (usualy 80)
spawn telnet $hostname $port

#Wait for something to happen
expect {
#If what is received from the webserver if Connected to... continue
        "Connected to $hostname." {
	#Wait for the 'Escape charachter is' text. This also prevent
	#the text from appearing. If your telnet client do not return 
	#this text, you have to modify this line
        expect "Escape character is"
	#Show the result of the next HTTP command.
        log_user 1
        }
	#If anything else happen, hsow an error message.
        default {
        puts "Unexpected Error"	
	#You can trap this error number using Perl
        exit(-2)
        }
}

#send the document's path to the web server.
send 'GET $document HTTP/1.0\r'
#Wait for the end of the document.
expect eof


If you call this script like this : 

GetWebPage www.somewhere.com 80 /a-file-who-do-not-exist

You will get this : 

GET /a-file-who-do-not-exist HTTP/1.0

HTTP/1.0 404 Not found
Date: Fri, 15 Aug 1997 19:42:33 GMT
Server: Apache/1.1.1
Content-type: text/html

<HEAD><TITLE>File Not found</TITLE></HEAD>
<BODY><H1>File Not found</H1>
The requested URL /a-file-who-do-not-exist was not found on this
server.<P>
</BODY>
Connection closed by foreign host.


There is a lot of information you don't need but you can use Perl to
parse and extract only the information you want.
That's what I do.

I Hope it helps.



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

Date: Fri, 15 Aug 1997 15:39:12 -0700
From: Larry David <larry@acomplist.com>
Subject: Perl script to send email to a pager
Message-Id: <33F4DA90.1585@acomplist.com>

Does anyone have a perl script (or c program) that can be used to send
selected email messages to a text pager?

Thanks,

--Larry


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

Date: Fri, 15 Aug 1997 15:50:46 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Joel B. Stalder" <joel@uptimecomputers.com>
Subject: Re: Problems with eval.
Message-Id: <Pine.GSO.3.96.970815154613.11870I-100000@julie.teleport.com>

On Thu, 14 Aug 1997, Joel B. Stalder wrote:

>   eval "\$self->$fmt( \$permit, \@_ );";

As near as I can see, that's the same as this. (No?)

    eval '$self->' . $fmt . '( $permit, @_ );'

> Here's the thing: Perl is treating this latter eval as if I have used
> the block method, hence, its not re-compiling each time as it should.

Are you changing $fmt? If not, I think Perl won't see any need to
recompile. I know I don't. :-) 

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/



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

Date: Fri, 15 Aug 1997 15:41:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jerry Xia <jxia@worldnet.att.net>
Subject: Re: Question of using stat function
Message-Id: <Pine.GSO.3.96.970815153010.11870F-100000@julie.teleport.com>

On 15 Aug 1997, Jerry Xia wrote:

> I tried to get the access permission for a file. I got file mode(big
> integer number) by using stat() function. But how can I interpret that
> mode in Perl?

If you need only to find out whether it's readable, writable, and so on,
the -r -w -x filetests are easier. But if you need the whole set of flags,
you'll probably want to use bitwise operations to work with the mode,
possibly with code like this. 

    # Print numeric mode
    $bits = $mode & 0777;	# Mask off high bits
    printf "Numeric mode is %04o\n", $bits;

    # Find ls-style mode (after first character)
    $flags = join '',
	map +(qw# --- --x -w- -wx r-- r-x rw- rwx # )[$_],
	split //, sprintf("%03o", $mode & 0777);

The higher bits are used to indicate things like whether it's a file,
directory, symlink, setuid, and so on. If you need those, they're in your
system's manpages.

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/



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

Date: Fri, 15 Aug 1997 21:08:35 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Removing elements in the middle of arrays?
Message-Id: <EEz42C.C1C@world.std.com>

Yuzo Watanabe <yuzow@sec.sel.sony.com> writes:


>	Essentially, I want to delete a record from an array that's not
>associative (or else I'd use the handy-dandy delete() function). 

Depending on your needs, maybe either the grep() or splice() functions
or array slices might be what you are looking for.

splice() will allow you to take an array and either add or remove
elements starting at a specified element and continuing for a certain
number of elements.

@splicearray = @greparray = @slicearray = qw(these thems those);
splice @splicearray, 1, 1;
# @splicearray now contains qw(these those)

grep will return a list in which the the specified expression is true.

@array = grep /^the/, @greparray;
# array now contains qw(these thems)

a slice of an array allows you to create a new list containing the
specified elements of the old list.

@temphash{@slicearray} = 0 .. $#slicearray;
@array = @slicearray[$temphash{thems}];
# @array contains qw(thems)
-- 
Andrew Langmead


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

Date: Fri, 15 Aug 1997 20:49:00 GMT
From: systech@polarnet.com (Ken Irving)
Subject: Re: Seeking object enlightenment
Message-Id: <8f7cd$b310.11b@PolarNet>

In article <33f4d3ad.12401882@news1.radix.net>, scott@radix.net says...
>
>Randal Schwartz <merlyn@stonehenge.com> wrote:
>>
>>       bless $something, "Some::Random::Package";
>>
>>"blesses" it into the package Some::Random::Package, so that:
>>
>>       $something->foo("bar");
>>
>>will start by looking for the subroutine called
>>Some::Random::Package::foo, passing it $something and "bar" as
>>parameters.
>
>Perhaps part of the obscurity (What?  Perl obscure?) lies in the
>choice of the word "bless" to do this.  Is this an OOP term?  I never
>heard of it before.  But you all act like this is the most natural
>association in the world!  :-)

I can see some sense in the choice of the term. An object is 
"blessed" (by a higher power :) to contain special information, 
thus enabling its use in a convenient way.  I don't think it 
is a "standard" OOP term, and perhaps reflects the sort of 
whimsical bent of the developers, but IMHO it is somewhat 
appropriate.  It might have been called "register" perhaps, 
but what difference does it make?  It's part of the lingo, it's 
unambiguous, and it works.
-- 
Ken
systech@polarnet.com




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

Date: 15 Aug 1997 15:46:08 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: split perl string
Message-Id: <5t2bm0$c5c@lorien.ajs.com>

Danny LaPrade  <dannyl@computize.com> wrote:
>How do I split at string like
>
>"here1here2here3here4here5here6here7"
>
>every 5th character?

Well, "there's more than one way to do it", but here's some:

	@list = unpack "a5" x int(length($string)/5), $string; # Drops

	@list = grep {length $_} split /(.....)/, $string; # Keeps

	push @list, $1 while $string =~ s/^(.....)//;	   # Drops

	for($i=0;$i<length($string);$i+=5){push(@list,substr($string,$i,5))}
		# Keeps

Keeps vs drop indicates what happens to any leftover at the end of the
string.

You will probably find that the first one is the fastest, but you
may have concerns other than speed.

			-AJS



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

Date: 15 Aug 1997 16:09:52 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Split strings in perl
Message-Id: <5t2d2g$c8t@lorien.ajs.com>

Randal Schwartz  <merlyn@stonehenge.com> wrote:
>>>>>> "dannyl" == dannyl  <dannyl@computize.com> writes:
>
>dannyl> How do I split a string like this:
>dannyl> "here1here2here3here4here5here6here7"
>
>dannyl> every 5th character?
>
>    @result = $your_string =~ /(.{1,5})/gs;

Interesting. I have some kind of race-memory fear thing going with
extracting substrings from regexes, but according to trials, your
example is only slightly slower over 10,000 runs than:

	@result = unpack "a5" x int(length($your_string)/5), $your_string;

And of course, it has the benifit of being much tighter syntax. Perhaps
it is time for me to put away my phobias.

			-AJS


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

Date: Fri, 15 Aug 1997 17:47:48 -0400
From: Anagrams of the Word 'A' <jefpin@bergen.org>
To: dannyl@computize.com
Subject: Re: Split strings in perl
Message-Id: <Pine.SGI.3.95.970815174442.18662B-100000@vangogh.bergen.org>

>How do I split a string like this:
>
>"here1here2here3here4here5here6here7"
>
>every 5th character?
>
>I want to be able to take this string
>and split it every five chars and the string
>can be anywhere from 0 to 100 chars long.
>Also want to be able to compare each to a string.

Sure...

$len = length($string);
int($len/5);
for ($pos = 0; $pos <= $len; $pos++){
	push (@array,substr($string,$pos * 5,5));
	if ($string eq $compared_to || $string =~ /^$compared_to$/i){
		# what to do if they match...
	}
}


----------------
| "Here we are now, entertain us!"
| 	- Nirvana
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem?  Let me know!

webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS



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

Date: Fri, 15 Aug 1997 17:51:28 -0400
From: Anagrams of the Word 'A' <jefpin@bergen.org>
To: Jeff Masiello <jmasiello@presstar.com>
Subject: Re: Walking the tree
Message-Id: <Pine.SGI.3.95.970815175040.18662C-100000@vangogh.bergen.org>

>We have a Unix server which needs massive cleaning.  I just learned perl
>but I would like to write a program which walks the directory structure
>and catalogs files by directory giving their locations.  it would be
>easy if the foreach loops read directories first but they don't.  I'm
>using the -d test but how do I get it so it lists all the files first
>and then moves on to the next subdir?

Check out: http://users.bergen.org/cgi-bin/jefpin/webtree.pl and tell me
if that is what you want (in UNIX format, of course, not internet).

----------------
| "Here we are now, entertain us!"
| 	- Nirvana
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem?  Let me know!

webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS



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

Date: 15 Aug 1997 20:53:26 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Year 2038 (was Re: Help! - Reformatting Date)
Message-Id: <slrn5v9ge3.4en.bet@waltz.rahul.net>

People keep saying "Unix has a 2038 problem" or words to that effect. That's
true of most Unixes out there today; this is solely because at the moment most
Unixes have only 32 bits for time_t, which is signed. But this is by no means
true of all systems:

	; perl -le 'print "".localtime(2**31)'
	Mon Jan 18 22:14:08 2038
	; perl -le 'print "".localtime(2**32)'
	Sun Feb  7 01:28:16 2106
	; perl -le 'print "".localtime(2**33)'
	Wed Mar 16 07:56:32 2242
	; perl -le 'print "".localtime(-2**33)'
	Thu Oct 17 06:03:28 1697
	; uname -srm
	Linux 2.0.27 alpha
	; 

Under Linux on the alpha, time_t is 64 bits. There remain debates about
whether 64-bit systems will take over, completely replacing 32-bit systems.
But whether they do or don't, select system data types will definitely go to
64 bits fairly soon, just because the benefits of doing so are so important.
The highest priority is probably going to be off_t, since that's needed for
files greater than 2GB, but if they do that right --- be getting the OS and
its application base fully prototyped to where it passes e.g. gcc -Wall ---
then it'll be so easy to do time_t that that'll be a natural as well.

If you get impatient, just switch to Linux on an alpha.

-Bennett


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

Date: 15 Aug 1997 22:20:15 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Year 2038 (was Re: Help! - Reformatting Date)
Message-Id: <5t2kmv$ovl$1@scully.new-era.net>

Bennett Todd (bet@network.rahul.net) wrote:

: There remain debates about
: whether 64-bit systems will take over, completely replacing 32-bit systems.

These debates will last until the 2030s, at which time 
they'll probably end very, very quickly :)

Scott



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

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

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