[8094] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1713 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 23 12:07:57 1998

Date: Fri, 23 Jan 98 09:00:25 -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, 23 Jan 1998     Volume: 8 Number: 1713

Today's topics:
    Re: Apache:  Using SSI within perl script-generated web <barnett@houston.Geco-Prakla.slb.com>
    Re: Apache:  Using SSI within perl script-generated web (Gail Hunn)
        Are there windows HELP files for Perl? <craig@skybound.demon.nl>
    Re: Are there windows HELP files for Perl? <keithmur@mindspring.com>
    Re: Are there windows HELP files for Perl? <camerond@mail.uca.edu>
        CGI downloads <dfisher@adc.metrica.co.uk>
    Re: character comparison... (Clay Irving)
    Re: chown -h <doug@tc.net>
    Re: conditionally use a module <barnett@houston.Geco-Prakla.slb.com>
        diff that operates on Perl variables? <steveg_nospam@gcg.com>
        Exporter/package question (dmouse)
    Re: FAQ too big (Was: Re: PERL forking) (Bart Lateur)
    Re: FAQ too big (Was: Re: PERL forking) <dfan@harmonixmusic.com>
    Re: FORTRAN format, help! (I R A Aggie)
    Re: Freidl's book mystery <tchrist@mox.perl.com>
    Re: Freidl's book mystery (Rahul Dhesi)
        Get the yesterday date ? <lhadot@cie-bancaire.fr>
    Re: Get the yesterday date ? (Clay Irving)
    Re: Help Setting up CGI.pm <barnett@houston.Geco-Prakla.slb.com>
    Re: How does perl do "tail -n" ? (Michael Wang)
    Re: HOw to check for file existence in each home direct (Clay Irving)
    Re: HTTP debugger. Does that exist? (Nathan V. Patwardhan)
        perl and windows NT registry. <p-canivenq@gulliver.fr>
    Re: perl auto update: (Clay Irving)
    Re: please, help me, help me, help me..... <johnrs@dc.net>
    Re: RADIUS accounting processing routines ? (Clay Irving)
    Re: Reading persistent logs <xxTony.Curtis@vcpc.univie.ac.at>
        socket problems using Solaris telnet (ERIC K. CHEU)
    Re: source into binary code <Chris_Hill@mentorg.com>
    Re: What does qw mean? <camerond@mail.uca.edu>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Jan 1998 07:32:40 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Apache:  Using SSI within perl script-generated web page
Message-Id: <34C89BF8.F82F95BA@houston.Geco-Prakla.slb.com>

Gail Hunn wrote:
> 
> Hi.
> 
> I have a perl script that generates a web page, and the generated web
> page includes a "virtual include" SSI.
> 
> At the moment, this doesn't work.  The dynamic page is generated, and
> it contains the "virtual include" line as a comment, but it doesn't
> execute it.
> 
I'm no expert on this (far from it), but I seem to remember that you
would need to use a header something like:
print "Content-type: parsed-html/html"
or similar wording.  Check your mime-types config file.  Our Netscape
server has a line like:
type=magnus-internal/parsed-html exts=shtml

HTH.
> I have the mod_include module compiled into Apache, and SSI works fine
> in my static pages.  The Options Includes statement is in the
> access.conf file for my cgi directory.
> 
> Can anybody steer me towards a solution for this?  Thanks in advance.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Fri, 23 Jan 1998 16:24:02 GMT
From: hunngai@fast.net (Gail Hunn)
Subject: Re: Apache:  Using SSI within perl script-generated web page
Message-Id: <34c8c41c.76113835@news.fast.net>

I'd like to thank those of you who sent responses to me on this.  I
guess the best suggestion came from the FAQ mentioned by several
people:

  http://www.apache.org/docs/misc/FAQ#ssi-part-iii

This FAQ suggested just putting the code from the server-side included
script right into the dynamic-html-generating script.  I will attempt
this.

Thanks again to all.  I consider this thread complete for my purposes.

-Gail


On Thu, 22 Jan 1998 20:09:36 GMT, hunngai@fast.net (Gail Hunn) wrote:

>Hi.
>
>I have a perl script that generates a web page, and the generated web
>page includes a "virtual include" SSI.
>
>At the moment, this doesn't work.  The dynamic page is generated, and
>it contains the "virtual include" line as a comment, but it doesn't
>execute it.
>
>I have the mod_include module compiled into Apache, and SSI works fine
>in my static pages.  The Options Includes statement is in the
>access.conf file for my cgi directory.
>
>Can anybody steer me towards a solution for this?  Thanks in advance.



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

Date: Fri, 23 Jan 1998 15:03:33 +0100
From: Craig <craig@skybound.demon.nl>
Subject: Are there windows HELP files for Perl?
Message-Id: <34C8A335.D3E@skybound.demon.nl>

Hi,

I'm looking for a help file Windows or a HTML quick reference for Perl5.
Does anybody know of any that can be downloaded somewhere?

Greetings,
Craig Manley


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

Date: Fri, 23 Jan 1998 10:33:18 -0600
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Are there windows HELP files for Perl?
Message-Id: <34C8C64E.910EA124@mindspring.com>

HTML docs come with the ActiveWare distribution.

Craig wrote:
> 
> Hi,
> 
> I'm looking for a help file Windows or a HTML quick reference for Perl5.
> Does anybody know of any that can be downloaded somewhere?
> 
> Greetings,
> Craig Manley


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

Date: Fri, 23 Jan 1998 10:39:33 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Craig <craig@skybound.demon.nl>
Subject: Re: Are there windows HELP files for Perl?
Message-Id: <34C8C7C5.3FF44AE3@mail.uca.edu>

Craig wrote:
> 
> Hi,
> 
> I'm looking for a help file Windows or a HTML quick reference for
> Perl5.
> Does anybody know of any that can be downloaded somewhere?

Check your hard disk. You have installed it, haven't you?

Cameron Dorey
camerond@mail.uca.edu


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

Date: Fri, 23 Jan 1998 16:44:53 -0000
From: "David Fisher" <dfisher@adc.metrica.co.uk>
Subject: CGI downloads
Message-Id: <885573898.754.0.nnrp-04.c246a73e@news.demon.co.uk>

I have a site which allows users to download compressed files successfully
by Internet explorer on the Windows system, but using Netscape on the UNIX,
all that happens is the print-out. I can see the problem arises with the
latter part of my code (below), but don't really know how do correct this.
Any ideas (bearing in mind security issues etc)?

#! /usr/bin/perl -w
# Download user selected file, by David Fisher
# This file expects the input 'x' to contain the download
# filename, and 'y' to contain any sub directory info.
use English;
use CGI qw(:standard);
my $thing=param("x");
my $dir=param("y");
my $log="/users/dfisher/web_downloads" ;
my $date;
chomp ($date= `date`);
open LOG_DATA, ">>".$log;
        printf LOG_DATA $date;
        printf LOG_DATA " - %s - ", $ENV{REMOTE_HOST};
        printf LOG_DATA "%s - ", $ENV{REMOTE_ADDR};
        printf LOG_DATA $thing."\n";
close LOG_DATA ;
print "Content-Disposition: form-data; name=$thing; filename=$thing;\n";
print "Content-Type: text/plain\n\n";
open (IN,"</apps/richmond/Interfaces/parser_web_downloads/".$dir.$thing)
        or print("$thing: Failed to open ($OS_ERRO

# I believe this is where the problem occurs, what are the alternatives?
# Is this the best way to download via this second stage CGI?
while (defined($line = <IN>))
{
  print $line;
}
R)\n");;





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

Date: 23 Jan 1998 11:29:21 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: character comparison...
Message-Id: <6aagh1$52h@panix.com>

In <6a9i4q$aai$1@excalibur.flash.net> "Dane Christensen" <dane@owlnet.rice.edu> writes:

>Is there a way to alphebetically compare single characters?
>I've tried ...elsif ($char1> $char2) {... but, unlike C, they don't
>seem to be simply represented by numbers.  Thx.

Then why don't you use the *string* comparison operator? :)

See perlop -- It came with your Perl distribution and it's also available
online at:

  http://www.perl.com/CPAN/doc/manual/html/pod/perlop.html

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


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

Date: 23 Jan 1998 11:12:01 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: chown -h
Message-Id: <m2oh135fvy.fsf@ono.tc.net>

Mark Moe <mark.moe@medtronic.com> writes:

> Hi, I'm using perl's chown on a symlink, but it follows the link.
> Is there a way to make it change the owner and/or group of the
> link itself?  (like the -h option to the unix chown)

I'm not sure why you'd want to--ownership and permissions are ignored
on symlinks (it's the attributes of the underlying file that count).
The change would be merely cosmetic.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Fri, 23 Jan 1998 09:41:46 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: conditionally use a module
Message-Id: <34C8BA3A.190D046C@houston.Geco-Prakla.slb.com>

Hendrik Klompmaker wrote:
> 
> Hi,
> 
> Is it possible to conditionally USE a module or not ?
> eg. based on the availability of a module.
> 
> Something like this
> 
> $UseMD5 = 1;
> if ($UseMD5) {
>   use MD5;
> }
> 
> Obviously this doesn't work if MD5 isn't installed but how should it be
> solved ?
> 
Look up eval.

eval 'use MD5';
if ($@) {
	print "Error!\n";
} else {
	print "Fount!\n";
}

HTH.

> TIA
> 
> Hendrik.
> --

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Fri, 23 Jan 1998 10:39:10 -0600
From: Steve Goldstein <steveg_nospam@gcg.com>
Subject: diff that operates on Perl variables?
Message-Id: <34C8C7AE.41C6@gcg.com>

Is there a Perl implementation of the unix diff utility that works on
variables rather than files?   

I'd like to code the following unix idiom (c shell script) into
efficient Perl code: 

        sed  -f $filter_file $file1 > temp1
        sed  -f $filter_file $file2 > temp2
        diff temp1 temp2
        rm temp1 temp2

This is a common idiom in software testing:  $file1 is output of
the program being tested, $file2 is the expected output, and
$filter_file has sed commands that filter out acceptable differences.
Some acceptable differences might include timestamps, file paths
names, and hostnames.

A literal translation of this into Perl would be to read each file into 
a string,  use the s/// operator on the strings, write the strings into
temporary files, and use system( "diff", "temp1", "temp2" ).   I
wonder if there is a more efficient way to do this, perhaps by
directly comparing the filtered strings.

                Thanks,
                Steve


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

Date: 23 Jan 1998 15:56:44 GMT
From: gt1535b@acmez.gatech.edu (dmouse)
Subject: Exporter/package question
Message-Id: <6aaejs$k15@catapult.gatech.edu>

Hello,

I'm running the win32 Perl on Win95 and I have a question regarding
packages and exporting variables.  Say you have an application called
Top that uses two other modules and imports variables from them:

	package Top.pm;
	use One qw(:top $hey $you);
	use Two qw(:top $who $dat);
Then, say inside of package Two you have the following:

	package Two.pm
	require Exporter;
	BEGIN {
	  @ISA = qw(Exporter);
	  @EXPORT = qw($who $dat);
	  %EXPORT_TAGS = (
	    top => [qw($woo $hah)]
	  );
	  Exporter::export_ok_tags('top');
	}
	BEGIN { use One qw(:two $mental $releases) }

What I wanted to know is if, when I import variables from One in Two,
are those the same variables that weren't imported from One in Top,
or does Perl create a whole other instance of the the package One?
And if I import the same variable in One into Top and two, are they
two separate instances, or will a change in one affect the other?

I know this may be a little confusing, but I would appreciate any 
advice that you guys could give me.

Thanks,
Daryl

--
<>< Daryl Bowen	<><
Georgia Institute of Technology
E-mail: gt1535b@prism.gatech.edu
Siemens Telecom Networks Co-op


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

Date: Fri, 23 Jan 1998 14:32:18 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <34ca9eff.19490410@news.tornado.be>

"Julian Thomas" <jt@epix.net> wrote:

>>Not everybody uses Unix, where you can use grep to look it up for you...
>>On a PC, you have to (manually) open and search through 9 documents.
>
>Look harder for grep for dos.

I have 2 versions of grep for DOS. And, as Tom Phoenix (for one)
suggested: it's easy to write such a beast in Perl.

But the problem in DOS is not the grep tool, but the integration with
other tools, like an editor/browser that can open the POD file at the
right line.

There is TextPad. That's a very decent (shareware) text editor with a
built-in "grep" (though the authors give it an other name, like "file
search" or something), AND it let's you open the file by doubleclicking
on a report line.

	Bart Lateur
	bart.mediamind@tornado.be


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

Date: 23 Jan 1998 11:08:42 -0500
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <wkafcn2mwl.fsf@turangalila.harmonixmusic.com>

mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:

| Andrew Johnson  <ajohnson@gpu.srv.ualberta.ca> wrote:
| >
| >Also, perl is very good for writing 'grep' type scripts...why not
| >write yourself a script that greps through the .pod files?
| 
| It's already been done.    Use Jeffrey Friedl's "search" program,
| which can be found in the perl distribution at
| 
|        perl5.004_04/win32/bin/search.pl
| 
| (Despite the filename, it isn't win32 specific.)

This turns out to be an old version of search.pl.  The newest version
is spiffier, but it doesn't work on Win95 as is.  (I assume that the
old version does, or it wouldn't be in the distribution. :)

I ported the newest version (960908.11) to Windows 95 (I have no clue
whether either vanilla 960908.11 or my port works on NT) and you can
find it at <http://www2.thecia.net/users/dfan/real/search.html>.
You'll have to use the '-win' option, which is easy enough to stick in
your .search file.

Jeffrey talked about incorporating my changes at some point, but it
hasn't happened to the official version yet.

-- 
                 Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the                http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
          Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/


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

Date: Fri, 23 Jan 1998 10:00:56 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: FORTRAN format, help!
Message-Id: <fl_aggie-2301981000570001@aggie.coaps.fsu.edu>

In article <34C655A3.167E@fccc.edu>, Ying Hu <Y_Hu@fccc.edu> wrote:

+ > How to get FORTRAN format by perl for example:

+ > data:
+ > string1  12345.67    89    ing2
+ > stri     12345.6      9 string2
+ >   ring1   45.67      89 string2

+ > FORTRAN format:
+ > (A7,2X,F8.2,4X,I2,A7)
 
+ My question is how to get "(A7,2X,F8.2,4X,I2,A7)" from the
+ data by perl. Sorry!

Ummm...I'm a bit confused, but I _think_ I know what you want.

printf OUTPUT "%7s  %8.2f    %2d%7s", $string1,$float1,$integer1,$string2;
                  ^^2x!  ^^^^4x!
presuming, of course, that the variables mentioned match the data types
implied by the formating string. These should be identical to the C types,
"s"=string, "f"=floating point, "d"=integer, etc.

Outputing to fixed-field format suitable for easy fortran reading is quite
simple, as is importing a fortran formatted file. I tend to use 'unpack' 
for the second...and one could use 'pack' or sprintf instead of printf 
for the first.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 23 Jan 1998 16:02:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Freidl's book mystery
Message-Id: <6aaets$b3g$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    joseph@5sigma.com writes:
:If I wanted this to be faster, I'd write an XSUB, not a long regex.
:Using regexes for comment preprocessing (and tokenizing in general)
:is, well, basically a losing approach if you like speed.

That's not true.  All you have to do is set up your regular expressions 
cleanly.  You don't have *one* regexp.  Make a lexer, maybe with state.

    TOKEN: while (length) { 
	next TOKEN if s/^\s+//;

	if (s/(\d+)//) {
	    do_num($1);
	    next TOKEN;
	} 

	if (s/(\w+)//) {
	    do_ident($1);
	    next TOKEN;
	} 

	if (s/([<([{])//) {
	    open_bracket($1);
	    next TOKEN;
	} 

	# et cetera
    }

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

    Besides, REAL computers have a rename() system call.    :-)
                    --Larry Wall in <7937@jpl-devvax.JPL.NASA.GOV>


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

Date: 23 Jan 1998 16:19:07 GMT
From: c.c.eiftj@04.usenet.us.com (Rahul Dhesi)
Subject: Re: Freidl's book mystery
Message-Id: <6aaftr$4bj$1@samba.rahul.net>

In <34C89A00.60B1D6B2@5sigma.com> "Joseph N. Hall" <joseph@5sigma.com>
writes:

>If I wanted this to be faster, I'd write an XSUB, not a long regex.
>Using regexes for comment preprocessing (and tokenizing in general)
>is, well, basically a losing approach if you like speed.

Please use a state machine, whether in perl or in C.
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: Fri, 23 Jan 1998 16:19:07 +0100
From: "Laurent HADOT" <lhadot@cie-bancaire.fr>
Subject: Get the yesterday date ?
Message-Id: <6aafte$1d23@news.cie-bancaire.fr>

I search a little source in Perl to get the date of the las day including
the bissextil years, the comparaison of the first date of a month and the
last date of the precedent month, ...

Is there someone who know if a little source for that

Thank you.




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

Date: 23 Jan 1998 11:46:23 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Get the yesterday date ?
Message-Id: <6aahgv$7nm@panix.com>

In <6aafte$1d23@news.cie-bancaire.fr> "Laurent HADOT" <lhadot@cie-bancaire.fr> writes:

>I search a little source in Perl to get the date of the las day including
>the bissextil years, the comparaison of the first date of a month and the
>last date of the precedent month, ...

>Is there someone who know if a little source for that

Perl Modules are your friend.

Take a look at Date::Manip.

  use Date::Manip;

  # get yesterday's date
  $date=&ParseDate("yesterday");             

  # get the last day in December
  $last_day = &ParseDate("last day in December"); 

  # get the number of days in a given month and year
  $days=&Date_DaysInMonth($m,$y);

Date::Manip available at a CPAN near you. Man page available at:

  http://reference.perl.com/wrap.cgi?date-manip

HTH,

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


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

Date: Fri, 23 Jan 1998 09:08:44 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: corey andersen hammer <c-hammer@students.uiuc.edu>, chammer@shrike.depaul.edu
Subject: Re: Help Setting up CGI.pm
Message-Id: <34C8B27C.B1424EA4@houston.Geco-Prakla.slb.com>

corey andersen hammer wrote:
> 
> I'm trying to set up CGI.pm for a project I'm working on
> for my research interests in psychology.  Unfortunately, I know next to nothing about PERL.  The CGI.pm webpages at www-genome.wi.mit.edu tell me I need patch 7or universal.pm to make cgi.pm work.  Everything, I find at CPAN is tar or gz
> encoded, and I'm using Win95.
Look into Winzip 6.?.  It handles tarred (.tar), compressed(.Z), and
gzipped (.gz) (and combination) files just fine.

> I also can't even find patch 7 to PERL 5.
>
For Unix, or Win95?  Either way, check out:
http://www.perl.com

Great place to start when looking for anything Perl related.
 
> When I tried to set up cgi.pm by the instructions at genome, it told me to use
> "perl makefile.pl" as the command line instructions.  My version of PERL doesn'
> t have Makefile.PL.
Your right.  Makefile.PL is extracted from the cgi.pm tar/gzip archive. 
When you extract from the archive, you should get lots of files, one of
which should be Makefile.PL.

perl Makefile.PL will create a Makefile, and you can proceed from there.

> 
> I am at a complete loss as to what to do next.  If someone can point me in the
> right direction I would appreciate it.
>
See above.
 
> BTW, my new school's USENET server is not letting me access anything other
Sorry.  can't help you there.

> than the university groups, so I'm including my current e-mail address because
> I don;t know how to set a reply-to under nn.
>
I don't either.  :-)  Never used it.  I use Netscape. 
> Current e-mail:
> 
> chammer@shrike.depaul.edu
> 
> --
> Corey Hammer
> c-hammer@uiuc.edu
> Visit Corey's Castle at http://www.students.uiuc.edu/~c-hammer

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 23 Jan 1998 14:28:11 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: How does perl do "tail -n" ?
Message-Id: <6aa9dr$sp0$1@news.ml.com>

Do you have to read the entire file into memory? What happens if it is a
10MB file? Thanks. 

Craig Berry <cberry@cinenet.net> wrote:
>
>Here's a quick version:
>
>#!/usr/bin/perl -w
>
>use strict;
>
>my $numLines = 10;
>
>if (@ARGV > 0 && $ARGV[0] =~ /^-(\d+)/) {
>  shift @ARGV;
>  $numLines = $1;
>}
>
>my @lines = <>;
>
>print @lines[-$numLines .. -1];


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

Date: 23 Jan 1998 10:22:49 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: HOw to check for file existence in each home directory of Unix users
Message-Id: <6aack9$rdq@panix.com>

In <34C7CA56.198FA24F@bms.com> Dan Roberts <roberts_d@bms.com> writes:

>What I need to do is check for the existence of a .forward file in each
>of my users homme directories.
>Then, if there is no .forward file in the users hoem dir I would get
>that users loginid
>printed to a file.

Something like:
  
  #!/usr/local/bin/perl -w
  
  # open the password file
  open PWD, "/etc/passwd" or die "Can't open password file: $!\n";
  while (<PWD>) {
    chomp;
  
  # split on ":"
    @contents = split /\:/;

  # get the userid and home directory -- 1st and 6th elements of the array
    ($userid,$home_dir) = @contents[0,5];

  # if the home directory exists
    if (-d $home_dir) {

  # open the home directory and read it into an array
      opendir HOME, "$home_dir" or die "Can't open $home_dir: $!\n";
      @files = readdir HOME;

  # grep the array for ".forward"
      @found = grep(/^\.forward$/, @files);

  # if ".foward" is found print "userid has a .forward file"
  # if you want to print this to a file, open a file for writing before
  # the while statement and print to it.
  # Example: print FH "** $userid has a $found[0] file **\n";
      if ($#found >= 0) {
        print "** $userid has a $found[0] file **\n";
      }

  # If the user's home directory wasn't found, print a warning
    } else {
      print "$userid has no home directory.\n";
    }
  }

  # close the password file
  close PWD;

HTH,

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


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

Date: 23 Jan 1998 14:47:13 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: HTTP debugger. Does that exist?
Message-Id: <6aaahh$bvk@fridge.shore.net>

brian d foy (comdog@computerdog.com) wrote:

: >Get LWP.  http://www.perl.com/CPAN/modules/by-module/LWP/

: i would adivse against using LWP in this case.  LWP munges some of the
: HTTP headers and adds others, so it's very difficult to see exactly
[snip]

I disagree.  There's an LWP::Debug'ger, isn't there?  And other stuff
that's probably documented somewhere in the distribution.

--
Nathan V. Patwardhan
please don't send spam to president@whitehouse.gov


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

Date: Fri, 23 Jan 1998 13:55:15 +0100
From: "FELIPE" <p-canivenq@gulliver.fr>
Subject: perl and windows NT registry.
Message-Id: <6aa3vm$97h$1@pumba.class.udg.mx>

Someone could tell me how to create a key and a value in the windows NT
registry.
       Thanks.





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

Date: 23 Jan 1998 11:32:55 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: perl auto update:
Message-Id: <6aagnn$5kn@panix.com>

In <34C86547.1D2DE812@xarch.tu-graz.ac.at> Jahnel Klaus <jahnel@xarch.tu-graz.ac.at> writes:

>is it possible to reload a perl script every 10 seconds to put out new
>datas?

Sure!

  #!/usr/local/bin/perl5.00403 -w
  
  $string = "Hello!";
  
  while (1) {
    print "$string\n";
    sleep 10;
  }

But something tells me this isn't what you really want to do...

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


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

Date: Fri, 23 Jan 1998 10:49:18 -0500
From: john -r s <johnrs@dc.net>
Subject: Re: please, help me, help me, help me.....
Message-Id: <34C8BBFD.4F3F0555@dc.net>



Bart Lateur wrote:

> "Seong Y. Kim" <seong@cse.bridgeport.edu> wrote:
>
> >Hmm... Try using opendir/readdir/closedir instead.
>
>         opendir(DIR,".");
>         @locfile = readdir(DIR);
>         closedir(DIR);
>

 Yes then process the @locfile with:
foreach $file (@locfile){
    do my things here to $file ....
}

--
john -r s (unix spelling)
johnr~s (Windows 3.1 spelling)
JOHNRS (DOS spelling)
John R S (Win95 spelling)




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

Date: 23 Jan 1998 11:23:35 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: RADIUS accounting processing routines ?
Message-Id: <6aag67$4i5@panix.com>

In <34C7FEF6.F6753CCC@campus.qro.itesm.mx> "Juan M. Courcoul" <courcoul@campus.qro.itesm.mx> writes:

>Are there any packages/libraries/routines available for processing the
>accounting records generated by a RADIUS server ?

Like:
  
  http://www.perl.com/CPAN/modules/by-module/RADIUS/

>From the README file:

  You can also do accounting.. basically just open the radacct port
  instead of radius, and send back an Accounting-Response (no
  attributes) when you've saved the Accounting-Request.

HTH,

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


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

Date: 23 Jan 1998 16:03:44 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: gking@c-com.ne
Subject: Re: Reading persistent logs
Message-Id: <7xsoqfi65q.fsf@beavis.vcpc.univie.ac.at>


Re: Reading persistent logs, Greg <gking@c-com.net> said:

Greg> How do you setup a Perl program to look for incoming
Greg> logs messages going to a log file without terminating?

Try

  http://reference.perl.com/query.cgi?sysadmin

(I suppose this is a very oblique way of reflexive trumpet
blowing :-)

Greg> log file and then displays the incoming messages as
Greg> they are written. How would this be done in Perl?

Well, you _could_ do

    tail -f logfile | perl-script

tony


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

Date: 23 Jan 1998 13:59:07 GMT
From: ekcheu@fiona.uncg.edu (ERIC K. CHEU)
Subject: socket problems using Solaris telnet
Message-Id: <6aa7nb$asb$1@newton.uncg.edu>

I'm having problems using sockets for certain ports in Solaris.  I'm using the
examples that I've found in the camel book as well as the examples that I've
found on the web.  But for some reason, the socket example works on some
ports (such as the SMTP port), but doesn't work on other ports (such as the
IMSP port).  Yet they both use tcp protocol, and they are both able to connect
to the daemons.  I just can't get any response from the IMSP port for some reason.
Anyone having this problem before or know what's going on?

thanks..

ekcheu@uncg.edu



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

Date: Fri, 23 Jan 1998 13:59:55 +0000
From: Chris Hill <Chris_Hill@mentorg.com>
Subject: Re: source into binary code
Message-Id: <34C8A25B.E033A2DA@mentorg.com>

Randal Schwartz climbed off his soap box and wrote:
> 
> <Sigh>, OK, getting back off my soapbox.  Back to the task at hand of
> completing my next O'Reilly book.
> 

What book would that be?


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

Date: Fri, 23 Jan 1998 10:08:23 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Doug Jacobs <djacobs@tsoft.com>
Subject: Re: What does qw mean?
Message-Id: <34C8C077.542D1A76@mail.uca.edu>

Doug Jacobs wrote:
> 
> Cameron Dorey <camerond@mail.uca.edu> wrote:
> > Mark666769 wrote:
> > >
> > > use CGI qw(:standard);
> > >
> > > It's just the syntax - what exactly does "qw" mean in the syntax
> > > of Perl? "Learning Perl" doesn't cover it, and I couldn't find
> > > it in the faq.
> 
> > I'd be _real_ surprised if the Llama doesn't cover it, because
> LPoW32S
> > (the Gecko) has it in Chapter 3, "Arrays and List Data."
> 
> Well, it says what it does, but what does "qw" mean?
> 
> Analogy:  cat is short of "conCATenate" but qw...?  ("quote word"?)

That's exactly what the book says. (Well, not exactly, it's
"quote-word", but I think we can ignore the hyphen), in other words, the
list (in the example at the top, the list is just one word) is used as
argument separating at whitespaces.

Cameron
camerond@mail.uca.edu


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

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

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