[17554] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4974 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 27 18:06:33 2000

Date: Mon, 27 Nov 2000 15:05:27 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975366325-v9-i4974@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 27 Nov 2000     Volume: 9 Number: 4974

Today's topics:
        ANNOUNCE: Tk::Workspace.pm version 1.53 <rkiesling@mainmatter.com>
    Re: Apache, Win and Perl <johngros@Spam.bigpond.net.au>
        Authen::Radius - doesn't install (bill davidsen)
        Authorising net access? philhibbs@my-deja.com
    Re: Compiling Curses-1.05 Module (Ilya Zakharevich)
    Re: Cookieless operation <fchanny@lbl.gov>
        for loop: brackets make any difference? (David Wall)
        getpw with shadow <ryser@free-support.de>
        Getting Path variable from remote NT server <driskind@freemarkets.com>
    Re: Help Needed: SORT function <nospam@david-steuber.com>
        help with active perl <ng@fnmail.com>
    Re: help with active perl <johngros@Spam.bigpond.net.au>
    Re: how do I merge blocks of text from different lines? (Mark Katz)
    Re: If/else problem. <johngros@Spam.bigpond.net.au>
        makepp-1.05--make reimplementation/enhancement <holt@lnc.usc.edu>
        NEWBEE: How to Encrypt Data ?? (OTR Comm)
    Re: NEWBEE: How to Encrypt Data ?? (John J. Trammell)
    Re: Newbie question concerning columns (David Wall)
    Re: Posting Guidelines? (Tad McClellan)
        Reading a csv file <c.darlington@virgin.net>
    Re: Reading a csv file (Flint Slacker)
        running remote programs / passing information <don@lclcan.com>
    Re: sending a signal to a process which I don't own (Martien Verbruggen)
    Re: SNMP agent written in perl? <wjhardaker@ucdavis.edu>
        system() and backticks working intermittently on Tru64  <sb299@netzero.net>
    Re: Taint mode question (Mark-Jason Dominus)
        Yet Another Regex Question <wells@cedarnet.org>
    Re: Yet Another Regex Question <jeffp@crusoe.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 27 Nov 2000 16:55:43 GMT
From: Robert Kiesling <rkiesling@mainmatter.com>
Subject: ANNOUNCE: Tk::Workspace.pm version 1.53
Message-Id: <t25g6inkmofh2c@corp.supernews.com>


Hi!

The latest version of the Tk::Workspace.pm library is now at 

  http://www.mainmatter.com/workspace/Workspace-1.53.tar.gz

And it will shortly be available on CPAN at:

  ftp://ftp.cpan.org/CPAN/authors/R/RK/RKIES/Workspace-1.53.tar.gz

WHAT'S NEW

  - Remote file select can optionally import files using FTP.
  - Workspace contents can be run through a filter and the output 
    saved to various destinations.
  - Import, export, save, and other operations can be performed
    from the command line.
  - Better coordination of X geometry and input focus with the
    window manager.
  - Support for common X command line options.
  - Support for configuration with X resources.

As usual, comments and bug fixes should be sent to the author:
rkiesling@mainmatter.com <Robert Kiesling>.  Thanks.

-- 
Robert Kiesling
Linux FAQ Maintainer 
rkiesling@mainmatter.com
http://www.mainmatter.com/linux-faq/toc.html  http://www.mainmatter.com/
---
Tired of spam?  Please forward messages to uce@ftc.gov.




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

Date: Mon, 27 Nov 2000 21:37:37 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Apache, Win and Perl
Message-Id: <BuAU5.8234$GW5.48481@news-server.bigpond.net.au>

Well even configuring apache correctly you need the #! line always.




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

Date: 27 Nov 2000 21:05:26 GMT
From: davidsen@tmr.com (bill davidsen)
Subject: Authen::Radius - doesn't install
Message-Id: <8vuiam$3lcq$1@newssvr06-en0.news.prodigy.com>

  I need to run a program which uses Authen::Radius. I pulled the
latest version (1997!!) and built it, but it never installs the .pm
anywhere. The test program and the actual application run in the
directory in which I unpacked it, but nowhere else.

  I need this working very soon, and have neither desire nor time to
become a Perl install guru. This is old code, but I really have to work
with the existing interface, since the application is large, and I have
no investigated the terms under which I got it to see if I'm allowed to
modify it.

  I tried the obvious of copying it into a directory in the @INC, but it
still is not found.

  Any hints, newer unreleased versions, etc?

-- 
  bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
Make the rules? I don't make the rules. I don't even FOLLOW the rules!


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

Date: Mon, 27 Nov 2000 21:15:57 GMT
From: philhibbs@my-deja.com
Subject: Authorising net access?
Message-Id: <8vuiu7$afe$1@nnrp1.deja.com>

This is a request that I am forwarding on behalft of my father:

Ihave managed to fetch an html page using the little script below.  But
when I go for the page that needs login I get the 410 error.

I believe that I need LWP:UserAgent and that it will allow authenticated
communication but I cannot find how to use this.  The perldoc pages are
not very readable.

$ cat http.prl
#!/usr/bin/perl -w
# http.prl

use strict;
use LWP::Simple;
print "Enter url to fetch: ";
chomp (my $url = <STDIN>);
getprint ("http://$url");

$ http.prl
Enter url to fetch: foo.bar.net/here/there/index.shtml
401 Authorization Required <URL:http://foo.bar.net\
  /here/there/index.sh tml>

$


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 27 Nov 2000 20:36:59 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Compiling Curses-1.05 Module
Message-Id: <8vuglb$qba$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Thomas Dickey 
<dickey@saltmine.radix.net>],
who wrote in article <8vu6bg$gnn$1@news1.Radix.Net>:
> >    function 'getsyx' NOT found
> >    function 'getsyx' returns void
> >    function 'setsyx' NOT found
> >    function 'setsyx' returns void
> 
> these are macros (not functions)

Was not the idea of ncurses to have all the macros available as
functions too?  Though I thought Curses.pm build-time-sniffer should
find the macros too...

Ilya


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

Date: Mon, 27 Nov 2000 14:33:44 -0800
From: Frank Hanny <fchanny@lbl.gov>
To: Vipul Ved Prakash <vipul@shell2.ba.best.com>
Subject: Re: Cookieless operation
Message-Id: <3A22E148.C32ADE70@lbl.gov>

Vipul,

I spoke too soon. There is a very serious bug (not platform related),
which causes the module to randomly discard cgi parameters which happen
to share a subset of the same name. Fortunately there is a one line fix.

The problem is with the regex in the grep in the following code in the
new() method, which produces spurious matches:

    foreach $key ( keys %$po ) { 
        $cgi->param( -name => $key, -values => $po->{$key} )
        unless ( grep /$key/, @names ) || $key eq "__Fn"
        #unless ( grep /^$key$/, @names ) || $key eq "__Fn"; 
#<----should be
    }


The following program demonstrates the bug (after 'fubar' is pushed, the
values of 'a' and 'b' are gone):

#!/usr/bin/perl     -w

use strict;
use CGI::Persistent; 

my
(
    $q,
    @html,
);

$q = CGI::Persistent->new(); 

push @html, 
    $q->header(),
    $q->startform(),
    $q->state_field(),
    ;

if ( $q->param('first') )
{
    $q->delete('first');   #otherwise, always true
    push @html, 
        $q->b('x '),
        $q->textfield( -name => 'x', -size => 10 ),
        '<br>',
        $q->b('y '),
        $q->textfield( -name => 'y', -size => 10 ),
        '<br>',
        $q->submit('second'),
        ;
}
elsif ( $q->param('second') )
{
    $q->delete('second');   #otherwise, always true
    push @html, 
        $q->submit('fubar'),
        $q->submit('clear'),
        ;
}
elsif ( $q->param('clear') )
{
    $q->delete_all();   #clean up!
    push @html,
        $q->b('a '),
        $q->textfield( -name => 'a', -size => 10 ),
        '<br>',
        $q->b('b '),
        $q->textfield( -name => 'b', -size => 10 ),
        '<br>',
        $q->submit('first'),
        ;
}
else    #initial state or 'fubar' pushed
{
    $q->delete('fubar')	if $q->param('fubar');   #otherwise, always true
    push @html,
        $q->b('a '),
        $q->textfield( -name => 'a', -size => 10 ),
        '<br>',
        $q->b('b '),
        $q->textfield( -name => 'b', -size => 10 ),
        '<br>',
        $q->submit('first'),
        ;
}

push @html, 
    $q->endform(),
    $q->dump(),
    ;

print @html; 


Frank Hanny


Vipul Ved Prakash wrote:
> 
> In article <3A12E377.AE89D6CF@lbl.gov>, Frank Hanny wrote:
> >Sounds promising. Does CGI::Persistent work in a Windows NT server
> >environment, as for example with MS IIS or is it strictly a Unix
> >critter? (Note, this is not a request for advice and comments as to the
> >superiority of Apache/Unix.)
> >
> >Thanks,
> >
> >Frank Hanny
> 
> Dunno.  Why don't you try it?  And if it works, drop me a note.
> 
> best,
> vipul.
> 
> --
> 
> Vipul Ved Prakash, http://www.vipul.net/
> PGP Fingerprint d5f78d9fc694a45a00ae086062498922


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

Date: 27 Nov 2000 16:02:40 -0500
From: darkon@one.net (David Wall)
Subject: for loop: brackets make any difference?
Message-Id: <8FF9A769Ddarkononenet@206.112.192.118>


Out of curiousity, is there any difference between the way the two 
following constructs are compiled?

for (list) { statement }

statement for (list);

The question about getting data into columns brought this to mind. ("Newbie 
question concerning columns")  I'd think they would compile exactly the 
same, but somehow I seem to recall reading that they are a little 
different.

-- 
David Wall
darkon@one.net


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

Date: Mon, 27 Nov 2000 22:13:24 +0100
From: Jonas Ryser <ryser@free-support.de>
Subject: getpw with shadow
Message-Id: <3A22CE74.25568C53@free-support.de>

Hi,

i tried to get a suse 7.0 password with perl. instead of the password i
everytime get the x from the password file. 
i tried the following:

$pw = getpwuid(500);

--> $pw is now x

use user::pwent;
$pw = getpw(500);

--> $pw->passwd is now x

anybody knows what's wrong here?
perl supports shadow pwd-files, doesn't it?

regards,
jonas


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

Date: Mon, 27 Nov 2000 16:30:33 -0600
From: "David Riskind" <driskind@freemarkets.com>
Subject: Getting Path variable from remote NT server
Message-Id: <3a22e08c$0$154$3936f1fe@news-core.twtelecom.net>

I need to locate the directory(ies) where specific files are located.  The
directories are always in the %PATH% variable.
Is there a way that Perl can get the value of the %PATH% variable from a
remote NT machine(assume we have trusted login to root of NT server)?
Maybe a call in the WIN32 module?

Thanks in advance.

David Riskind
Freemarkets, Inc.
Austin, TX
you can mail to driskind at freemarkets dot com




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

Date: Mon, 27 Nov 2000 22:57:24 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Help Needed: SORT function
Message-Id: <m31yvxqazw.fsf@solo.david-steuber.com>

tadmc@metronet.com (Tad McClellan) writes:

' Hoarding answers is selfish.

Ok, so now we know that you aren't the one with all the answers! ;-P

Now if we can just find the bastard who does...

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Mon, 27 Nov 2000 15:30:39 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: help with active perl
Message-Id: <8vujs0$s2i$1@newsx.cc.uic.edu>

I am using Active Perl with IIS on Win2k.
When I access my webserver and use any of my scripts there is a weird
delay.  I will click on submit and it will take forever to change to the
next page.  If I click on submit, then click away, it changes immediately.
ie. go to netscape, go to page, click submit, click on the desktop to
unfocus netscape.  then the page will change immediately.  this happens
with all my perl scripts.  If I put my perl scripts on some other server
like a unix server it works fine.
Has anyone else had this problem?
--
Enrico Ng <ng@fnmail.com>





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

Date: Mon, 27 Nov 2000 22:54:41 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: help with active perl
Message-Id: <RCBU5.8304$GW5.48832@news-server.bigpond.net.au>

I run Apache on Win ME and yes the same prob here I think serving and
displaying the script output is just too much for our machines OS's.
When in doubt blame Bill! ;-)
Actually for me it is patchy sometimes I get great speed other times not.
With six apps running good speed, only two bad, go figure.




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

Date: Mon, 27 Nov 00 22:42:34 GMT
From: mark@ispc001.demon.co.uk (Mark Katz)
Subject: Re: how do I merge blocks of text from different lines?
Message-Id: <975364954snz@ispc001.demon.co.uk>

In article <3a1e3e13.5032119@newshost.canb.auug.org.au>
           denr0g@canb.auug.org.au "Roger Denholm" writes:

>On Wed, 22 Nov 2000 17:01:42 -0800, "Mauro" <-@-.com> wrote:
>
>>________input is____
>>[1]|some text
>>[2]|I've an apple
>>[3]|I eat the apple
>>
>>separatortag
>>
>>1. HALLO
>>2. HI
>>3. FOOBAR
>>
>>_______output must be_____
>>HALLO|some text
>>HI|I've an apple
>>FOOBAR|I eat the apple
>man cut
>man paste
>and for the smart, man sed
>awk is useful for field swapping exercises.
>
And, as I often remark

man pr  (*big* clue pr -m file1 file2)
awk solutions are possible, but I think they are more complex - certainly
for someone trying to do their homework!
Mark
---
Mark Katz
Mark-it, London. Delivering MR-IT/Internet solutions
Tel: (44) 20-8731 7516, Fax: (44) 20-8458 9554
For latest information about ISPC/ITE - see http://www.e-tabs.com 



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

Date: Mon, 27 Nov 2000 22:20:37 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: If/else problem.
Message-Id: <V6BU5.8271$GW5.48716@news-server.bigpond.net.au>

open BOGUS,"+>>$file" or
die "Cannot open file: $!";

 if ($pass eq <BOGUS>){
  goto success;
  }else{

That was my original code after Joe's pointer I changed it to:
if (open BOGUS,"$file")
{
     $bogus =<BOGUS>;
     chomp ($bogus);
     if ($pass eq $bogus)
It still is not comparing $pass and $bogus correctly.
"John Boy Walton" <johngros@Spam.bigpond.net.au> wrote in message
news:KPhU5.6071$GW5.39072@news-server.bigpond.net.au...
> Thanks Joe.
> It is the answer I needed.
> "Joe Smith" <inwap@best.com> wrote in message
> news:8vqjqe$5jd$1@nntp1.ba.best.com...
> > In article <s33T5.460$GW5.3300@news-server.bigpond.net.au>,
> > John Boy Walton <johngros@Spam.bigpond.net.au> wrote:
> > >open BOGUS,"+>>$file" or die "Cannot open file: $!";
> >
> > Opens $file for appending and reading, positions to end of file.
> >
> > > if ($pass eq <BOGUS>){
> >
> > Attempt to read beyond end of file, returns undef.
> >
> > If you are intending to read from a file, "+>>$file" is not the way to
do
> it.
> > -Joe
> > --
> > See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
>
>




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

Date: 27 Nov 2000 12:02:01 -0800
From: Gary Holt <holt@lnc.usc.edu>
Subject: makepp-1.05--make reimplementation/enhancement
Message-Id: <t25g5gbjt14510@corp.supernews.com>

Make++ (or makepp) is a drop-in replacement for GNU make which has a
number of features that guarantee more reliable builds and allow simpler
build files, especially for builds spanning multiple directories.  It
supports almost all of the syntax that GNU make supports, and can be
used with makefiles produced by utilities such as automake.  And you can
embed perl code in your makefile, you can write make functions in perl,
and you can write include file scanners and other extensions to makepp
in perl.

makepp at present works only on Unix systems, since it currently depends
on fork() and Unix filename and directory conventions.  Suggestions for
porting and code contributions are welcome.

makepp is written entirely in perl.  It requires version 5.005 of perl
or better.  It's distributed under the terms of the perl Artistic
License.

For the latest distribution, manual pages, and information about mailing
lists, please see the makepp home page, http://LNC.usc.edu/~holt/makepp.
Makepp is also available from CPAN in the directory
$CPAN/authors/id/H/HO/HOLT/.

Features:
    
o Makepp supports almost all makefile syntax that GNU make supports.
  Makepp is compatible enough with GNU make and stable enough to compile
  large packages, such as KDE 2.0.  (For details, see the manual section
  on old makefiles).

o Makepp automatically scans C/C++ sources for include files.  The
  implementation is flexible enough that support for other languages can
  be easily added by writing a perl function.

o Makepp remembers the build command, and rebuilds if the command has
  changed, even if none of the files have changed.  This is useful if
  you change command line options (e.g., adding -DDEBUG or -g)--you
  don't have to do "make clean".

o By default, makepp rebuilds if any dependency files have changed
  (even if they are still older than the target).  For example, if you
  replace a file with an older version, makepp knows to recompile.  This
  also means that makepp is not bothered by clock synchronization
  problems.  (If necessary, you can tell it to recompile only if the
  target is older than a dependency.)

o Makepp has a better system for handling makefiles spread across several
  directories.  makepp loads several makefiles simultaneously (keeping
  the variables and default directories separate), and it will realize
  automatically that a file needed by one makefile is built by a
  different makefile.  Recursive invocations of make are no longer
  necessary (but are still supported for backward compatibility).

o Makepp won't mix output from separate processes when running compilation
  commands in parallel.

o Makepp writes a log file explaining all of its build decisions,
  showing what each file depended on and what changed to cause each rule
  to be executed.  This makes debugging your makefiles much easier.

o Wildcards refer not only to files which already exist but also to
  files which don't exist yet but which can be made.  Thus you can
  specify 
  
    libmine.so: *.o

  and the compilation will work properly even if none of the
  .o files exist yet.

o You can tell makepp not to recompile if only comments or whitespace in
  C/C++ sources have changed.  This is especially important for header
  files which are automatically generated by other programs and are
  included in many modules.  Even if the date has changed because the
  file was remade, makepp won't recompile if the file (excluding
  comments) hasn't changed.

o Makepp can automatically separate your source and object directories,
  even if your makefile is not written that way.  (This is like VPATH
  but is completely transparent, even for include files.)  Makepp can
  also build separate copies of your program with different compilation
  options or on different architectures, automatically keeping the
  output files separate--you don't have to modify your makefiles at all.
	
o You can ask makepp to infer what object files are necessary for
  your program if your source files follow the simple convention that
  the implementation of all the classes and functions in a .h file is
  contained in a .cxx, .cc, .C, or .cpp file of the same name.  This can
  often avoid the use of .a files.

o Makepp won't be confused by multiple names for the same file.  It realizes
  that xyz.o, ./xyz.o, and ../objects/xyz.o are the same file, and if
  you load a makefile in a subdirectory, it will recognize that
  references in that subdirectory to ../xyz.o refer to the same file as
  xyz.o in the main build directory.  It also won't be confused by soft
  links in directory names.

o Makepp supports filenames with special characters like space or ":".  Just
  put any filenames with special characters in single or double quotes.

o Makepp supports more easily understood synonymns for the cryptic
  symbols $@, $<, $^, etc.

o You can define your own text processing functions in perl if
  the default ones are not sophisticated or convenient enough.
  You can also embed perl code to manipulate the make variables directly
  in your makefile.

What's the difference between makepp and the Make module (and the
associated pmake program)?

  The key difference, and the reason I could not simply extend the
  existing Make module, is that makepp uses completely different
  algorithms and data structures internally.  The main reason for
  writing makepp was to simplify builds that use several different
  makefiles, and combining rules from different makefiles into a single
  make process required a very different internal architecture.  For a
  discussion of this and the other internal differences, see the section
  in the manual on this at
  http://LNC.usc.edu/~holt/makepp/build_algorithm.html.

  In addition to this difference, makepp has a lot more features than
  pmake and the make module, many of which are feasible only because of
  the differences in data structures and algorithms.  Makepp also
  emulates GNU make much more precisely because it has been developed 
  further.

Why not cons?  cook?  bake?  icmake?  jam?

  These are good make utilities too, with some of the same features,
  especially those relating to reliable builds.  I wrote makepp because
  (at the time) cons wasn't flexible enough.

  makepp is likely to work with existing makefiles, because it tries
  hard to emulate all the features of the standard make implementations
  while nonetheless being safer.  It has been tested successfully on
  several large systems of makefiles, including large projects
  controlled by autoconf and automake.  And you don't have to learn any
  new syntax or write any new files to use makepp; you can probably use
  your old makefiles (with possibly only minor modifications).  On the
  other hand, you can take advantage of makepp's additional features to
  simply your makefiles.

-- 
Gary Holt			(213)-740-3397
holt@alumni.caltech.edu		http://lnc.usc.edu/~holt/




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

Date: Mon, 27 Nov 2000 20:34:33 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: NEWBEE: How to Encrypt Data ??
Message-Id: <3a22c32e.3196855595@news.wildapache.net>

Hello,

I have a requirement to encrpyt some data and store it in a database.  The crypt() function that comes
with perl does not appear strong enough.

I have downloded PGP5, Blowfish, DES, and CBC from CPAN, but do not know how to implement either in
code.

What is the best module to use for some strong encryption? 

Could some share some code examples for how to encrypt the data before I store it in the database and
then how to decrypt it when I retrieve it from the database.

I do not need examples of getting the data into/out of the database, just how to encrypt/decrypt it.

Thanks,
Murrah Boswell


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

Date: 27 Nov 2000 21:04:00 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: NEWBEE: How to Encrypt Data ??
Message-Id: <slrn924oob.dak.trammell@nitz.hep.umn.edu>

On Mon, 27 Nov 2000 20:34:33 GMT, OTR Comm
<otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote:
[snip]
>What is the best module to use for some strong encryption? 

This really depends on the kind of encryption you need to do.
What exactly are you trying to store?

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: 27 Nov 2000 15:53:13 -0500
From: darkon@one.net (David Wall)
Subject: Re: Newbie question concerning columns
Message-Id: <8FF9A0666darkononenet@206.112.192.118>

nobull@mail.com wrote in <u9vgt9paq0.fsf@wcl-l.bham.ac.uk>:
>
>> Is there any way to get the data in to columns separated by a tab?
>
>TMTOWTDI:
>
>my @rows = [] x 18;
>
>until ( eof FILE ) {
>  push @$_ => scalar(<FILE>) for @rows;
>}

Cool, much slicker than my solution.  I suppose I might like a bit more 
whitespace:

until ( eof FILE ) {
    for (@rows) {
        push @$_, scalar(<FILE>);
    }
}

I think that makes it clearer, but that's just me. It's certainly better 
than my playing with $. and modulus.

-- 
David Wall 
darkon@one.net


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

Date: Mon, 27 Nov 2000 14:35:22 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Posting Guidelines?
Message-Id: <slrn925drq.ff1.tadmc@magna.metronet.com>

Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>In article <8vfq93$1v4$1@nnrp1.deja.com>,  <jbuff1856@my-deja.com> wrote:

[ snip "we should have posting guidelines for clpmisc" ]


The problem with a free-for-all newsgroup like clp.misc is
who would create or maintain it.

There are no moderators or "list Moms" who could be expected
to have the support of the masses.

We would need a volunteer that people would trust. That could
be pretty hard to come by.


>New posters just don't have
>anywhere to go to find out what's acceptable.  I think that your
>intentions are great.  Personally I'd like to see these things restored.


I started on one of those some months ago. I think I was planning
to call it "How to Get Free Perl Consulting!" or something like that.

I'll go dig it up tonight and see how complete it is.

I will eventually post it here for comments and revisions. It may
be a few days...


>BTW I can't reach the URL that you listed above.

Works fine for me.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 27 Nov 2000 20:19:48 -0000
From: "Chris Darlington" <c.darlington@virgin.net>
Subject: Reading a csv file
Message-Id: <pkzU5.15946$vA4.294689@news6-win.server.ntlworld.com>

I have a .csv file which takes the following format:

Date,Match,Name1,Name2,Name3

I want to load each line into an array and then seperate each line using the
split function and the commas to split the line.

How do I read each date into an array along with the other fields?

Or is there an easier way to do this?

The object of the code is to take the date from the csv file and create a
table in .html to display the results.

Can anyone please help?

Chris




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

Date: Mon, 27 Nov 2000 20:29:44 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: Reading a csv file
Message-Id: <3a29c2b7.239347084@news.tcn.net>


print "Content-type: text/html\n\n";
print <<EOF;
<html>
<body>
<table border="1" width="100%">
<tr>
<td width="20%">Date</td>
<td width="20%">Match</td>
<td width="20%">Name1</td>
<td width="20%">Name2</td>
<td width="20%">Name3</td>
</tr>
EOF
open(IN, "< somecsv.txt");
while(<IN>) {
	chomp;
	@tmp = split(/\,/, $_);
	print <<EOF;
<tr>
<td width="20%">$tmp[0]</td>
<td width="20%">$tmp[1]</td>
<td width="20%">$tmp[2]</td>
<td width="20%">$tmp[3]</td>
<td width="20%">$tmp[4]</td>
</tr>
EOF
}
close(IN);

print <<EOF;
</table>
</body>
</html>
EOF

Flint

On Mon, 27 Nov 2000 20:19:48 -0000, "Chris Darlington"
<c.darlington@virgin.net> wrote:

>I have a .csv file which takes the following format:
>
>Date,Match,Name1,Name2,Name3
>
>I want to load each line into an array and then seperate each line using the
>split function and the commas to split the line.
>
>How do I read each date into an array along with the other fields?
>
>Or is there an easier way to do this?
>
>The object of the code is to take the date from the csv file and create a
>table in .html to display the results.
>
>Can anyone please help?
>
>Chris
>



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

Date: Mon, 27 Nov 2000 16:05:02 -0500
From: Don <don@lclcan.com>
Subject: running remote programs / passing information
Message-Id: <3A22CC7E.F186F7E@lclcan.com>

This question is probably asked asked every other week.  Is there a perl
discussion group FAQ?

I have a perl script on my web server (external network).  I wish to
have my perl script call a remote program, passing parameters,  on
another server on my internal network.  This program may or may not be
perl.  I also want my program on the internal servers to pass
information back top my perl script.

I know Perl can do this but do not know how.  Are there specific modules
I need to install.  What protocol is best used for this?



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

Date: Mon, 27 Nov 2000 22:30:14 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: sending a signal to a process which I don't own
Message-Id: <slrn925o05.850.mgjv@verbruggen.comdyn.com.au>

On Wed, 22 Nov 2000 09:48:39 +0100,
	Willem Joosten <nospam@jsoft.xs4all.nl> wrote:
> 
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn91ltfd.r2.mgjv@verbruggen.comdyn.com.au...
> 
>> Another solution would be to have the CGI fork a child that does the
>> processing, and dissociate that child fromt he parent. Of course, the
>> CGI user would need write permissions anywhere that it needs them.
> 
> Two reasons I don't like this approach. The persmissions and I want to be
> able to run the 'deamon' on a console to see what it's doing. Can this be
> done from a forked process?

Not directly, and portably. You could write output to a file, and tail
-f that file in a window. Or you could have the process directly write
to a pseudo-tty. Of course, there are many other methods, possibly
involving named pipes and yet another process, but I'd probably
abandon this idea if you want to see output.

>> create a named pipe
>> make sure permissions are sufficient for CGI user to write to it
>> while (! end)
>> {
>> read (blocking) a line from the pipe
>> open the text file for read
>> LOCK_SH the text file
>> PROCESS
>> close text file
>> }
> 
> This is pretty much what my first version looked like. The problem is that I
> must be able to interrupt the processing update the text file and continue
> or restart the processing depending on what has changed.

kill -STOP
kill -CONT

:)

> Version two forks and the child will loop a read on the FIFO (don't ask why
> it's called FIFO :). Only took me two hours to find out the filehandle for

Don't have to ask :)

> the named pipe is no longer valid when the write has closed it :)

I believe this is actually system dependent, but I may be wrong.
Reopening would fix that :)

> Raw version of version 2 (no locking etc)
> 
> $SIG{'HUP'} = 'setfileupdate';

Be careful that setfileupdate doesn't do too much work. re-entrancy is
still a problem in signal handlers on many platforms. You don't show
it, but am I correct in assuming it only sets $updatefile to a true
value?

> my $childpid = fork();
> die "Can't fork, reason $!" unless defined $childpid;
> if($childpid){
>  # we're the player
>  while (! $stopped){
>   if($updatefile){
>    reloadfile();

and reloadfile sets $updatefile back to false?

>    # processing in blocks
>   }
>   sleep 1;
>  }
> 
> } else {
>  # we're the child so wait for some input and signal parent
>  while(! $stopped){
>   open FIFO, "< playerd.fifo" or die "Can't open playerd.fifo for reading,
> reason $!";
>   my $line = <FIFO>; # blocking
>   print "Line: $line -\n";
>   kill ('HUP', $parentpid);
>   close FIFO;
>   sleep 1;
>  }
> }
> 
> waitpid($childpid, 0);
> $SIG{'HUP'} = 'DEFAULT';

Looks fine to me, on first glance :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | True seekers can always find
Commercial Dynamics Pty. Ltd.   | something to believe in.
NSW, Australia                  | 


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

Date: 27 Nov 2000 09:09:08 -0800
From: Wes Hardaker <wjhardaker@ucdavis.edu>
Subject: Re: SNMP agent written in perl?
Message-Id: <sd3dgdmjez.fsf@wanderer.hardakers.net>

>>>>> On Tue, 21 Nov 2000 21:17:17 -0600, Mike Eggleston <mikeegg@prodigy.net> said:

Mike> I am looking into a new monitoring agent on my unix boxes. I
Mike> prefer that the agent be written in perl so that separate
Mike> modules can be written for each monitored area (cpu, disk,
Mike> filesystem, swap, oracle, notes, etc..... like bmc's patrol). I
Mike> know that I can write the management portion in perl to talk
Mike> with an agent, but is there any similiar system that allows the
Mike> agent to be written in perl?

Not that I'm aware of.  The perl SNMP related modules are all designed
from the management side of things.  I've always meant to write a
wrapper around the net-snmp agent interface for perl, but haven't
gotten to it quite yet (it should actually be fairly easy).  Since the
net-snmp agent is already modular like you want it to be, it should
easily suit your needs if this was done.

(It can also call external perl scripts already from its C-core).

-- 
Wes Hardaker
NAI Labs
Network Associates


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

Date: Mon, 27 Nov 2000 19:46:47 GMT
From: "Steve Bourgeois" <sb299@netzero.net>
Subject: system() and backticks working intermittently on Tru64 UNIX
Message-Id: <HSyU5.38432$751.1170768@typhoon.ne.mediaone.net>


I have an application written in perl that makes various calls out to the
OS with system() and backticks.

The problem is that hosting out to the OS occasionally does nothing when
it is executed.

For example, something like $results = `ps -ef |grep zz` will return a NULL
string
and STDERR is not set.  If I add this code to a loop with retry logic, it
will eventually
execute successfully after a few retries.

I have been seeing this problem with Digital/Tru64 UNIX versions 3.2 - > 5.1
and
perl versions 5.004 -> 5.6.  It also occurs more frequently as the hardware
that
we're running on has increased in horsepower...  Strangely enough, this code
also
runs on Windows NT and we have never seen this issue on that platform.

I'm wondering if there is some sort of a timing issue or something here??
Has anyone
else been bitten by this?

Thanks,


Steve




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

Date: Mon, 27 Nov 2000 20:38:54 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Taint mode question
Message-Id: <3a22c65e.4d6c$1d4@news.op.net>

[mailed and posted]

In article <3A22AD65.F5ED8EE8@uclink.berkeley.edu>,
Gordon Vrdoljak  <vrdoljak@uclink.berkeley.edu> wrote:
>I have been told to run it in taint mode (-T option), but perl complains with
>the following error:
>
>Insecure dependency in glob while running with -T switch at
>/home/httpd/cgi-bin/sched1.cgi line 71. 

In Perl prior to 5.6.0, the glob operation was very complicated.  It
would execute /bin/csh and ask csh to execute 'echo'.  Because of this
complication, the glob operation is deemed to be unsafe in taint mode
no matter how it is used.

You have two choices: Get rid of the glob, or upgrade to Perl 5.6.0.
In perl 5.6.0, 'glob' is considered safe in taint mode, because Perl
5.6.0 carries its own built-in globber that does not use csh.

To get rid of the glob, use this instead:

        sub get_file_list {
          my $prefix = shift;
          my @files;
          local *DIR;
          opendir DIR, '.' or return;
          while (defined(my $f = readdir DIR)) {
            push @files, $f if index($f, $prefix) == 0;
          }
          return @files;
        }

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Mon, 27 Nov 2000 14:16:18 -0600
From: Stephen Wells <wells@cedarnet.org>
Subject: Yet Another Regex Question
Message-Id: <3A22C112.9B00DC02@cedarnet.org>

I was in need of a regex that would parse HTML-type attributes.

Examples: 
my $attr = 
   qq(FOO=bar foo = "foo bar" BAR="foo 'bar'" FB='foo "bar"');

I have it working in the code below but the perldocs say that
the condition operator is experimental and may not carry over
to new versions of perl.  

* That being said is there a better way to write this?
* How would I do it without the conditional operator?
* Can you point me to online documentation that shows something
  similar in scope?

============

my %attr;
while ($attr =~ 
       /([^=\s]+)  # Match everything up to the = or space
        \s*=\s*       # find the = char or space before and after
        (['"])? # we may have a ' or " surrounding the text
        (.*?)   # let's not be greedy as we eat through the values
        (?:     # I'd rather not retain this match
         (?(2)\2|\s)   # Where the magic happens.
                       # if (entry 2 ('|") exists we won't stop
                       # until we find that again.  Otherwise a
                       # space will have to do.
        )       # close off the unretained match
        \s*     # Any extra spaces between stuff will be dropped
       /gxs) {
       $attr{$1} = $3;
}

=============

TIA,
STEVE


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

Date: Mon, 27 Nov 2000 15:19:00 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Yet Another Regex Question
Message-Id: <Pine.GSO.4.21.0011271516300.2522-100000@crusoe.crusoe.net>

[posted & mailed]

On Nov 27, Stephen Wells said:

>my %attr;
>while ($attr =~ 
>       /([^=\s]+)  # Match everything up to the = or space
>        \s*=\s*       # find the = char or space before and after
>        (['"])? # we may have a ' or " surrounding the text
>        (.*?)   # let's not be greedy as we eat through the values
>        (?:     # I'd rather not retain this match
>         (?(2)\2|\s)   # Where the magic happens.
>                       # if (entry 2 ('|") exists we won't stop
>                       # until we find that again.  Otherwise a
>                       # space will have to do.
>        )       # close off the unretained match
>        \s*     # Any extra spaces between stuff will be dropped
>       /gxs) {
>       $attr{$1} = $3;
>}

I'd do:

  my %attr;
  while ($attr =~ m{
    ([^=\s]+)
    \s* = \s*
    (?: ' ([^']*) ' | " ([^"]*) " | (\S*) )
  }gx) {
    $attr{$1} = $+;
  }

Look up the $+ variable in the 'perlvar' documentation.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/





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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4974
**************************************


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