[11467] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5067 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 5 15:07:19 1999

Date: Fri, 5 Mar 99 12:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 5 Mar 1999     Volume: 8 Number: 5067

Today's topics:
    Re: ADO, OLE on WinNT <noel.sant@icl.com>
        Attn: Gurus.  Need help w/format on the fly <dave@californiaic.com>
        Can't kill Perl script with CTRL-C <alfred@ascend.com>
        Changing @INC <george.kuetemeyer@mail.tju.edu>
    Re: COnverting comma separate values <emschwar@mail.uccs.edu>
    Re: COnverting comma separate values <Allan@due.net>
    Re: E-Mail Bounces (Steve Linberg)
        FAQ 1.9: Can I do [task] in Perl?   <perlfaq-suggestions@perl.com>
    Re: Form encoding & TCP/IP connections <andy@ricketts.freeserve.co.uk>
    Re: How to do a Case-insensitive Sort? <Allan@due.net>
    Re: How to run Perl program as NT service? <fillmore@nrn1.nrcan.gc.ca>
        LWP jamessoutter@my-dejanews.com
    Re: mod_perl leak help (yes, using strict, -w :) (M.J.T. Guy)
        Newbie: How to debug Perl CGI script on server <jrnoorda@worldnet.att.net>
        OLE automation inside bat file run by NT at command gdmiller@wave.home.com
        perl script hangs. <whubley@mediaone.net>
        Programming a mirror, how...!? dragnovich@my-dejanews.com
    Re: Quick Regular Expression Quesion <jglascoe@giss.nasa.gov>
    Re: Quick Regular Expression Quesion (Steve Linberg)
    Re: Quick Regular Expression Quesion <Allan@due.net>
    Re: RealAudio Dynamic CGI RAM MetaFiles Question (Steve Linberg)
    Re: Seriously confused about subscripts <emschwar@mail.uccs.edu>
    Re: Seriously confused about subscripts <arnej@fc.hp.com>
    Re: Sorting an associative array <jglascoe@giss.nasa.gov>
    Re: The truth about the Pentium III chip and ID --- **b <mtr@ottawa.com>
    Re: The truth about the Pentium III chip and ID --- **b <mtr@ottawa.com>
    Re: Thoughts on FAQ autoposting (Steve Linberg)
    Re: Use 'get' to get cgi output? <bwb@dowebpages.com>
    Re: web browser in Perl? <graphics@alphacrc.com>
        Yahoo! style dynamic select boxes <mikej@1185design.com>
    Re: Yahoo! style dynamic select boxes (Steve Linberg)
    Re: Yesterday! (Benjamin Franz)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 5 Mar 1999 19:03:07 -0000
From: "Noel Sant" <noel.sant@icl.com>
Subject: Re: ADO, OLE on WinNT
Message-Id: <36e028ae.0@145.227.194.253>

I have a problem with ADO & OLE, too, but on Win95, and one step further on.
My code:

 $connection = Win32::OLE->new("ADODB.Connection");
 $connection->Open("DSN=C:\\Chorus.dsn;UID=Noel;PWD=noel") or die
Win32::OLE::LastError(), "\n";

Gives an error:

OLE exception from "Microsoft OLE DB Provider for ODBC Drivers":

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified

Win32::OLE::0.0810 error 0x80004005: "Unspecified error"
    in methodcall/getproperty "Open"

The DSN is one I use successfully with Access97, linking to MS SQL Server
6.5, which I've copied from the normal directory because when I put the full
path it says "... too long." And when I put it in the same directory as the
program, which I've CD'd too from the DOS prompt to run my script, and
remove the "C:\\", it still can't find it.

I think I may be getting the wrong end of the stick here somewhere. I've
installed DCOM95 & MDAC 2.0 - I hope that's enough to give me ADO. But
presumably I wouldn't get beyond the connection if I hadn't.

Can anyone help, please?

Thanks in anticipation,

        Noel Sant

Rick Hensh wrote in message <7bic8a$f84$1@msunews.cl.msu.edu>...
>Try this line instead in the appropriate place below:
>
>    $conn = Win32::OLE->new("ADODB.Connection")
>
>hth
>ricky
>





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

Date: Fri, 5 Mar 1999 11:47:43 -0800
From: "David Eaves" <dave@californiaic.com>
Subject: Attn: Gurus.  Need help w/format on the fly
Message-Id: <36e03740.0@news.globalpac.com>

I am trying to format an e-mail that has up to 84 rows of info.  I would
like to be able to loop through the variables to creat the format on the
fly, because in the future I would like to omit rows if a condition is not
met.  (The @<<<<<< fields will have descriptions in the future)
Here is what I have so far:

<snip>

$finvars{Desc1} = "HELLO";
$finvars{Quantity1} = "50";
$finvars{Adj1} = 2;
$finvars{Sub1} = 4;
$finvars{WP1} = 5;
@format2 = &makelines;
$format = "format MAILONE = \n".join($",@format2).'.';

 eval $format;
 print $format if $debugging;
 write(MAILONE);
 die $@ if $@;
sub makelines {
 for ( $i = 1; $i < 84; $i++){
 @array[$i] = "@<<<<<<<<<<<<<<< @<<<<<<<< @#######.##

@#########.## @#######.##\n".
'$finvars{\'Desc'.$i.'\''.'},'.' '.'$finvars{\'Quantity'.$i.'\''.'},'.'

'.'$finvars{\'Adj'.$i.'\''.'},'.'

'.'$finvars{\'Sub'.$i.'\''.'},'.'$finvars{\'WP'.$i.'\''.'},'."\n";}
 return @array;
}

After the makelines function is called $format contains something like this:

format MAILONE =
 @<<<<<<<<<<<<<<< @<<<<<<<< @#######.## @#########.## @#######.##
$finvars{'Desc1'}, $finvars{'Quantity1'}, $finvars{'Adj1'},
$finvars{'Sub1'},$finvars{'WP1'},
 @<<<<<<<<<<<<<<< @<<<<<<<< @#######.## @#########.## @#######.##
$finvars{'Desc2'}, $finvars{'Quantity2'}, $finvars{'Adj2'},
$finvars{'Sub2'},$finvars{'WP2'},
 @<<<<<<<<<<<<<<< @<<<<<<<< @#######.## @#########.## @#######.##
$finvars{'Desc3'}, $finvars{'Quantity3'}, $finvars{'Adj3'},
$finvars{'Sub3'},$finvars{'WP3'},
etc.
 @<<<<<<<<<<<<<<< @<<<<<<<< @#######.## @#########.## @#######.##
$finvars{'Desc83'}, $finvars{'Quantity83'}, $finvars{'Adj83'},
$finvars{'Sub83'},$finvars{'WP83'},
 .

Now when I eval $format and write(MAILONE) there is no output.  Can anyone
help?

Thank you,






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

Date: Fri, 05 Mar 1999 12:58:54 -0500
From: Alfred von Campe <alfred@ascend.com>
Subject: Can't kill Perl script with CTRL-C
Message-Id: <36E01B5E.16C95147@ascend.com>

I have a Perl script that spends a long time (about a minute)
executing the following subroutine:

    sub update_files()
    {   
        my $dirs = $_[0];
        
        print "Updating \"converted\" files with clearmake\n";
        open(DIRS, $dirs) || die "$0: Can't open $dirs ($!)\n";
        while(<DIRS>)
        {
            # Ignore comments and blank lines
            chomp();
            s/#.*$//;
            next if (/^\s*$/);
            print "  Updating files in $_\n";
            system("cd $_; /usr/atria/bin/clearmake all");
        }
        close(DIRS);
        print "\n";
    }   

Basically, it reads a file that contains a list of directories and
uses system() to cd to each directory and then do a "clearmake all".
Most of the time is spent doing the clearmake (which is the make
that ships with ClearCase, BTW).

The problem is that the script can't be interrupted with CTRL-C.
Here's what I've done in the main script (which contains the
definition of and the call to update_files()):

    # Set up the interrupt handler to catch CTRL-C
    $SIG{"INT"} = sub { die "$0: Caught SIGINT - bye!\n"; }

Hitting CTRL-C has no effect until after I'm out of the above
subroutine.  What do I need to change in the script so that it
can be terminated with a CTRL-C while it is executing all the
system("cd dir; clearmake al") calls?

Alfred (who's never dealt with signals in Perl before)
-- 
Alfred von Campe                      home phone: +1 978.448.6214
Software Engineer                     work phone: +1 508.486.2006
CAE Tools Group                              fax: +1 508.486.2921
Carrier Signaling & Management Group       email: alfred@ascend.com
Ascend Communications, Inc.


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

Date: Fri, 05 Mar 1999 13:00:11 -0500
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Changing @INC
Message-Id: <36E01BAA.C0085559@mail.tju.edu>

I just installed a package that requires the directory:
/perl/site/5.005/lib for correct operation. My ActiveState Perl for NT
(current release) only gives me an @INC of /perl/site/lib and /perl/lib.
I can always add "use lib '\perl\site\5.005';" to my scripts, but that's
kind of annoying. Is there any way to add additional paths globally &
persistantly to @INC?

TIA.



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

Date: 05 Mar 1999 12:18:53 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: COnverting comma separate values
Message-Id: <xkfr9r3g2xu.fsf@valdemar.col.hp.com>

gellyfish@btinternet.com (Jonathan Stowe) writes:
> Of course I am certain that you will feel hard done by at this
> response but a world of knowledge awaits you if you type:
> 
> perl -v
> 
> and follow the advice in the last paragraph that is displayed.

"Perl may be copied only under the terms of either the Artistic License
 or the GNU General Public License, which may be found in the Perl 5.0
 source kit." ??

Well, maybe you can find some measure of comfort in it, but I'm afraid
it's a bit too existentialist for me.

-=Eric


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

Date: Fri, 5 Mar 1999 14:44:49 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: COnverting comma separate values
Message-Id: <7bpbr9$fro$1@samsara0.mindspring.com>

Eric The Read wrote in message ...
:gellyfish@btinternet.com (Jonathan Stowe) writes:
:> Of course I am certain that you will feel hard done by at this
:> response but a world of knowledge awaits you if you type:
:> perl -v
:> and follow the advice in the last paragraph that is displayed.
:
:"Perl may be copied only under the terms of either the Artistic License
: or the GNU General Public License, which may be found in the Perl 5.0
: source kit." ??
:
:Well, maybe you can find some measure of comfort in it, but I'm afraid
:it's a bit too existentialist for me.


Time to upgrade? <g>

This is perl, version 5.005_02

Copyright 1987-1998, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
echo "ICK, NOTHING WORKED!!!  You may have to diddle the includes.";
 - Larry Wall in Configure from the perl distribution




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

Date: Fri, 05 Mar 1999 14:26:08 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: E-Mail Bounces
Message-Id: <linberg-0503991426080001@ltl1.literacy.upenn.edu>

In article <#$#r1wyZ#GA.280@nih2naae.prod2.compuserve.com>, "Mike Watkins"
<mwatkins@promotion4free.com> wrote:

> Hi there,
> 
> I have a mailing list script, which automatically sends out messages at set
> intervals of time.  I was just wondering, what will happen when an address
> bounces?

It will bounce back to the sender, just like a regular email bounce.

> Or how can you tell if it's a valid e-mail address, other than
> just checking for the right format?

This is a FAQ.  Please check the FAQ, available in this newsgroup and on
your system, and get in the habit of doing so before posting questions. 
Thanks.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: 5 Mar 1999 11:40:17 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 1.9: Can I do [task] in Perl?  
Message-Id: <36e02511@csnews>

(This excerpt from perlfaq1 - General Questions About Perl 
    ($Revision: 1.21 $, $Date: 1999/01/26 09:55:05 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq1.html
if your negligent system adminstrator has been remiss in his duties.)

  Can I do [task] in Perl?

    Perl is flexible and extensible enough for you to use on
    virtually any task, from one-line file-processing tasks to large,
    elaborate systems. For many people, Perl serves as a great
    replacement for shell scripting. For others, it serves as a
    convenient, high-level replacement for most of what they'd
    program in low-level languages like C or C++. It's ultimately up
    to you (and possibly your management) which tasks you'll use Perl
    for and which you won't.

    If you have a library that provides an API, you can make any
    component of it available as just another Perl function or
    variable using a Perl extension written in C or C++ and
    dynamically linked into your main perl interpreter. You can also
    go the other direction, and write your main program in C or C++,
    and then link in some Perl code on the fly, to create a powerful
    application. See the perlembed manpage.

    That said, there will always be small, focused, special-purpose
    languages dedicated to a specific problem domain that are simply
    more convenient for certain kinds of problems. Perl tries to be
    all things to all people, but nothing special to anyone. Examples
    of specialized languages that come to mind include prolog and
    matlab.

-- 
     "... an initial underscore already conveys strong feelings of
      magicalness to a C programmer."
	--Larry Wall in <1992Nov9.195250.23584@netlabs.com>


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

Date: Fri, 05 Mar 1999 19:37:01 +0000
From: Andrew Ricketts <andy@ricketts.freeserve.co.uk>
Subject: Re: Form encoding & TCP/IP connections
Message-Id: <36E0325D.4FE7FCA6@ricketts.freeserve.co.uk>

Hi,

> Andrew> guys. Firstly, what's the regular expression
> Andrew> to convert all non-alphanumeric characters
> Andrew> in a string into there hex values? the same
> Andrew> format as forms are sent in? i.e. "(test)" =
> Andrew> "%28test%29".
> 
> Use the LWP module family, it's so much easier.

I preferbly wanted to get away with not using modules, isn't there a
simple regular expression to do the job? I've been trying and got the
following code but it doesn't put the %'s in..

---------
$test = "andy\@ricketts.freeserve.co.uk";
$test =~ s/[^a-zA-Z0-9 ]/unpack("C",$&)/eg;
$test =~ tr/ /+/;
---------

Thanks in advance.


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

Date: Fri, 5 Mar 1999 13:53:28 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: How to do a Case-insensitive Sort?
Message-Id: <7bp8qu$93t$1@samsara0.mindspring.com>

Greg Bacon wrote in message <7bmumt$ch1$4@info.uah.edu>...
:In article <36DEF62E.E7ED0BE6@giss.nasa.gov>,
: Jay Glascoe <jglascoe@giss.nasa.gov> writes:
:: my @sorted = sort { lc $a cmp lc $b } @list;
:Too many lc()s:
:
:    my @sorted = map  { $_->[0] }
:                 sort { $a->[1] cmp $b->[1] }
:                 map  { [ $_, lc($_) ] }
:                 @list;


But too slow? <g>  We might even only want to sort on the first char, it
does speed things up a hair.

#!/usr/local/bin/perl -w
use strict;

sub _lc {
    my @foo = qw(This is just The start this Is Just the Start);
    @foo = sort {lc($a) cmp lc($b)} @foo;
}

sub _lcfirst {
    my @foo = qw(This is just The start this Is Just the Start);
    @foo = sort {lcfirst($a) cmp lcfirst($b)} @foo;
}

sub _map {
    my @sorted = qw(This is just The start this Is Just the Start);
    @sorted = map  { $_->[0] }
                 sort { $a->[1] cmp $b->[1] }
                 map  { [ $_, lc($_) ] }
                 @sorted;
}


use Benchmark;

timethese(500000, {
'lc     '  => \&_lc,
'lcfirst'  => \&_lcfirst,
'map    '  => \&_map
});

__END__
Benchmark: timing 500000 iterations of lc     , lcfirst, map    ...
   lc     : 58 wallclock secs (58.10 usr +  0.00 sys = 58.10 CPU)
   lcfirst: 57 wallclock secs (56.24 usr +  0.00 sys = 56.24 CPU)
   map    : 126 wallclock secs (126.05 usr +  0.00 sys = 126.05 CPU)

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
When you come to a fork in the road take it.
 - Yogi Berra





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

Date: Fri, 05 Mar 1999 14:31:54 -0500
From: Bob Fillmore <fillmore@nrn1.nrcan.gc.ca>
Subject: Re: How to run Perl program as NT service?
Message-Id: <36E03129.C41834D0@nrn1.nrcan.gc.ca>

I just solved my own problem.... there was a typo in my setup of the SRVANY
service.
I'm still using a .bat file... it works OK.   Also, my program listens on a
network socket
and that appears to be working OK as well.
Thanks to all who replied.

  - Bob

Bob Fillmore wrote:

> I would like to run a Perl program as an NT service so that it's started
> on each reboot.
> I created a batch file that calls perl with the script file name as a
> parameter,
> then I installed the .bat file as a service using SRVANY in the NT
> Resource Kit.
> I then tried to start the service using the Services control panel, but
> it times out
> with a message saying it can't start the service.   What's the "proper"
> method
> for doing this?
>
> Any help is much appreciated.
>
> --
> Bob Fillmore, Technical Services Division       email:
> fillmore@NRCan.gc.ca
>   Information Management Branch,
>   Natural Resources Canada,                     Voice: (613) 992-2832
>   580 Booth St., Ottawa, Ont., Canada  K1A 0E4  FAX:   (613) 996-2953

--
Bob Fillmore, Technical Services Division       email: fillmore@NRCan.gc.ca
  Information Management Branch,
  Natural Resources Canada,                     Voice: (613) 992-2832
  580 Booth St., Ottawa, Ont., Canada  K1A 0E4  FAX:   (613) 996-2953




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

Date: Fri, 05 Mar 1999 18:51:00 GMT
From: jamessoutter@my-dejanews.com
Subject: LWP
Message-Id: <7bp92g$4sm$1@nnrp1.dejanews.com>



I am looking for code to show how to use LWP to make a
simple_request for a web page and then have the content of
the web page passed to a subroutine.

The perdoc on LWP::UserAgent says that simple_request takes
a second argument which may be a reference to subroutine but
I can't get this to work.

: James

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 5 Mar 1999 18:20:14 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: mod_perl leak help (yes, using strict, -w :)
Message-Id: <7bp78u$c1s$1@pegasus.csx.cam.ac.uk>

Mark Simonetti  <marks@webleicester.co.uk> wrote:
>Hmm, that doesn't seem right.. When memory is free'd within a process, it
>should be returned to the system.

Although that may happen for a few platforms (and if your Perl is built
with the right malloc() options), not returning memory is by far the
more common case, sadly.

And in any case, this doesn't affect whether or not you have a memory
leak.    If the amount of memory used after 2000 cycles is (roughly)
twice the amount used after 1000 cycles, you've got a leak.   If not,
you haven't.


Mike Guy


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

Date: 5 Mar 1999 19:50:01 GMT
From: "JR Noorda" <jrnoorda@worldnet.att.net>
Subject: Newbie: How to debug Perl CGI script on server
Message-Id: <7bpch9$akd@bgtnsc01.worldnet.att.net>



Perl and Linux are new to me.


I would like to get the Perl CGI script to invoke a debugger on the
server with output to a terminal on the server.

The environment is 2 computers connected by ethernet cards.
Server is Caldera Linux, Netscape FastTrack Server.
Client machine is Windows 95.


So far, no success.

I have created a   .perldb   It's contents are
$DB::TTY='/dev/tty3/'

I have modified the first statement of the Perl script:
#!/usr/local/bin/perl -dT

The page sent to the browser is a form with the following HTML:
    <FORM METHOD ="post" ACTION = "web_store.cgi">



The output from the server gets sent to the client browser and looks like
this:

Loading DB routines from perl5db.pl version 1 Emacs support available. Enter
h or `h h' for help. main::(/home/httpd/html/web_store.cgi:70): 70: $| = 1;
DB<1> Insecure dependency in eval while running with -T switch at
/usr/lib/perl5/perl5db.pl line 1158, chunk 1. DB::eval called at
/usr/lib/perl5/perl5db.pl line 1067 DB::DB called at
/home/httpd/html/web_store.cgi line 70
DB::fake::(/usr/lib/perl5/perl5db.pl:2084): 2084: "Debugged program
terminated. Use `q' to quit or `R' to restart."; DB<2>

This looks like the output of a debugger.   How does one get it redirected
to a terminal
on the server??

Thanks and hope to be contributing to the newsgroup in the future
John Noorda





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

Date: Fri, 05 Mar 1999 18:43:43 GMT
From: gdmiller@wave.home.com
Subject: OLE automation inside bat file run by NT at command
Message-Id: <7bp8ks$4js$1@nnrp1.dejanews.com>

I have written an OLE automation script for Word 97 using Avtivestate PERL .
At the command line everything runs fine but if I run the batch file as an at
job the perl script cannot open Word. The following line is how I start word.

my $ex = Win32::OLE->new('Word.Application', 'Quit') or die "Oops, cannot
start Word\n";

When run in the at job the script returns the error message from the die
statement.

My question is. Can you run OLE automation scripts as an at job. Is there
something special I have to do to get it to work? The script runs fine on the
commadn line so I know it works.

Any help would be greatly appreciated

Dale Miller

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 05 Mar 1999 14:55:38 -0500
From: Walter Hubley <whubley@mediaone.net>
Subject: perl script hangs.
Message-Id: <36E036BA.D6BC60CA@mediaone.net>

Hello,

I have a perl script that uses Win32::ODBC to access an Oracle database
and a Microsoft Database (MDB) running on NT 4.0 SP3.  It is an AT (NT
cron) that runs every 2 minutes.  Most days when I check on my NT server
I see several instances sticking around.

Under Task Manager, under processes, I see several perl.exe and CMD.EXE.

I look in the logs my script creates and it always completes it's task
and writes to the log before it exit(0).

Any idea why, or what I can do to correct this?  Or what I can check to
help debug the problem?

Thanks

Wally



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

Date: Fri, 05 Mar 1999 19:17:42 GMT
From: dragnovich@my-dejanews.com
Subject: Programming a mirror, how...!?
Message-Id: <7bpakd$6c5$1@nnrp1.dejanews.com>

Hello folks, Now Im starting a new proyect... Im a ISP and I have 9 servers
over mexico... well I have all servers running on Windows NT =-6  but I need
that all servers gets the same data (principally on the web pagesand database
), Then I think, lets do a litte perl mirror software.

I think the program will work like this, and here is where I need your help...
(The parts that have the * are the parts that I dont know how to do them.)

1)* Program gets a /inetpub/wwwroot/ files and directories contents. 2)*
Program get each file last modified date. 3) Read a file (that have all the
file list) and compare it with the last update	date. The files that where
modified since the last update will be in a new list  for upload it. And the
new file will be added. 4) start a ftp upload to each server, and upload all
modified files. 5) Save the files list, with the new last modified day.

I think this will get a list like this:
$files[1] = ("/filepath/filename1"); $lastmod[1] = ("lastmoddate");
 ......
$files[N] = ("/filepath/filenameN"); $lastmod[N] = ("lastmoddate");

Well the questions are...
How can I obtain a list of files and all of his subdirectories on Win NT ?
When I get the file list, how can I obtain each file last mod date??

Any help or url will be very helpfull

regards
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 05 Mar 1999 12:57:53 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Mike Watkins <mwatkins@promotion4free.com>
Subject: Re: Quick Regular Expression Quesion
Message-Id: <36E01B21.4E8B02B9@giss.nasa.gov>

[posted and mailed]

Mike Watkins wrote:
> 
> Hi there,

hi Mike,

> I have a script which gathers the contents of an HTML file into the var
> $html.  Now, I want to extract all of the names and values of form fields.
> Right now, I have this:
> 
> (@texts) = $html =~ /<input.*type=.text.*name\=.(.+)/gi;
> 
> That works perfectly except it doesn't stop until either the end of the
> file, or the end of the line.  Was just wondering, how do you get it to stop
> at the next > it encounters?

this captures all "name" fields of the forms in your HTML file.

my @texts = ();
while ($html =~ /<input\s+.*?name\s*=\s*(\S+)[^>]*>/gi)
{
	push @texts, $1;
}

	Jay Glascoe
--
"Soup on all fours?"
"Of course.  Whaddaya think, Soup is a biped?" - mst3k


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

Date: Fri, 05 Mar 1999 14:27:17 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Quick Regular Expression Quesion
Message-Id: <linberg-0503991427170001@ltl1.literacy.upenn.edu>

In article <uDvSosyZ#GA.330@nih2naae.prod2.compuserve.com>, "Mike Watkins"
<mwatkins@promotion4free.com> wrote:

> Hi there,
> 
> I have a script which gathers the contents of an HTML file into the var
> $html.  Now, I want to extract all of the names and values of form fields.
> Right now, I have this:
> 
> (@texts) = $html =~ /<input.*type=.text.*name\=.(.+)/gi;
> 
> That works perfectly except it doesn't stop until either the end of the
> file, or the end of the line.  Was just wondering, how do you get it to stop
> at the next > it encounters?

Parsing HTML correctly is very difficult, which is why we have
HTML::Parse.  Go to www.perl.com and find out about the CPAN archives.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Fri, 5 Mar 1999 14:40:23 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Quick Regular Expression Quesion
Message-Id: <7bpbiv$c4t$1@samsara0.mindspring.com>

Steve Linberg wrote in message ...
:In article <uDvSosyZ#GA.330@nih2naae.prod2.compuserve.com>, "Mike Watkins"
:<mwatkins@promotion4free.com> wrote:
:
:> Hi there,
:>
:> I have a script which gathers the contents of an HTML file into the var
:> $html.  Now, I want to extract all of the names and values of form
fields.
:> Right now, I have this:
:>
:> (@texts) = $html =~ /<input.*type=.text.*name\=.(.+)/gi;
:>
:> That works perfectly except it doesn't stop until either the end of the
:> file, or the end of the line.  Was just wondering, how do you get it to
stop
:> at the next > it encounters?
:
:Parsing HTML correctly is very difficult, which is why we have
:HTML::Parse.  Go to www.perl.com and find out about the CPAN archives.


I believe that HTML::Parser is recommended over HTML::Parse at this time.

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
echo $package has manual pages available in source form.
echo "However, you don't have nroff, so they're probably useless to
you."
 - Larry Wall in Configure from the perl distribution






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

Date: Fri, 05 Mar 1999 14:28:32 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: RealAudio Dynamic CGI RAM MetaFiles Question
Message-Id: <linberg-0503991428320001@ltl1.literacy.upenn.edu>

In article <7borqi$ocn$1@nnrp1.dejanews.com>, skotos@my-dejanews.com wrote:

> I know that this has been done before; I found a Frontier script from a
> programmer in Hawaii that would do it.  I'd rather use PERL, if someone has a
> couple of wise words to head me in the right direction.

Read the documentation for CGI.pm, for starters.  Especially $q->redirect.

> +---------------------------------------------+
>   J. Trent Adams          trent@binarypro.com
>   New England Patriots           617.305.7829

Go Pats!

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: 05 Mar 1999 11:02:20 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: Seriously confused about subscripts
Message-Id: <xkfww0vg6hf.fsf@valdemar.col.hp.com>

John "Chris" Wren <jcwren@atlanta.com> writes:
> However, what I really want is to set the index to just the ?? portion of the
> file name.  For all my reading, I can't seem to find the BASIC equivalent of
> left$, right$, or mid$ (please, don't flame me about BASIC.  It's just an
> example of the functionality I want).

If all your filenames are the same length, then substr will do what you
want.  "perldoc -f substr" for more info.

> And I'm under the impression that using s/// requires that the data you want
> to substitute to be in $/.

Nope.  Try "perldoc perlop", and pay special attention to the =~
operator.

> Am I being too 'C'-centric and missing the obvious?  I know how to do this in
> everything from 6502 assembly to PL/1, but I can't seem to make it happen in
> perl...

There are many fine manuals available to you.  'perldoc perlfaq' will
give you an index of the sub-faq documents, and you will then be able to
answer many of these questions yourself, without needing to resort to
USENET.

I'd also recommend Learning Perl and The Perl Cookbook as useful books,
but everything you *need* is in the documentation supplied with perl.

-=Eric


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

Date: Fri, 05 Mar 1999 11:14:04 -0700
From: Arne Jamtgaard <arnej@fc.hp.com>
Subject: Re: Seriously confused about subscripts
Message-Id: <36E01EEC.5173@fc.hp.com>

John Chris Wren wrote:

> I have an array.  The array is a result of HTML parsing, and contains 
> the following data.  It is the result of using the
> HTML::LinkExtor->links function, so the space between each words
> indicates an array element

> a href doc_aa.htm
> a href doc_ab.htm
> ...
> a href doc_zz.htm

> If I perform the loop "for (@docs) { print "$_->[2]\n"; }" I get 
> what I expect, each line displaying just the "doc_XX.htm" entry.  
> I now want to create a hashed table, with the index being the ??
> portion of the file name (?? being the two lettes after the
> underscore).

Okay, that's pretty straightforward...

> I know that { my $doc_indexs; $doc_indexes{$_->[2]} = $_->[2]; } 
> will create an entry in the hash table with the complete file name,
> and set the "data" portion of the array (I forget the correct name
> just now) to "doc_??.htm".

> However, what I really want is to set the index to just the ?? 
> portion of the file name.  For all my reading, I can't seem to 
> find the BASIC equivalent of left$, right$, or mid$ (please, don't
> flame me about BASIC.  It's just an example of the functionality I
> want).

see 'substr' for something simulating mid$, but...

> And I'm under the impression that using s/// requires that the 
> data you want to substitute to be in $/.

You don't want to substitute, you just want to match, right?

foreach (@docs) {
   $doc = $_->[2];		# extract the file name
   $doc =~ /doc_(..)/;		# extract the two digits after the doc_
   $doc_indexes{$1} = $doc;	# assign to the hash
   }

The parens in the match statement will store the two digits it 
matches after the 'doc_' in a special variable ($1).  Then you 
use $1 as your hash key.

Read up on the pattern matching in perl - it's what you're really
looking for...

HTH,
Arne


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

Date: Fri, 05 Mar 1999 13:12:10 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Henning Koch <henning@hjk1.isdn.lif.de>
Subject: Re: Sorting an associative array
Message-Id: <36E01E7A.FEC0E002@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Henning Koch wrote:
> 
> Hi,
> I have a problem sorting an associative array.
> The values of this array are numbers.
> If I want to sort this numbers with:
>      foreach $number (sort values(%array))
> how can I access the numbers and the related index ?

let's say "%hash" is your associative array.
Now, behold the wit and wisdom of the "Schwartzian
Transform":

my @sorted_keys = map { $_->[0] }
		      sort { $a->[1] <=> $b->[1] }
			   map { [$_, $hash{$_}] }
			       keys %hash;

foreach my $key (@sorted_keys) {
    my $val = $hash{$key};
    # now do something with "$key", "$val"
}

> Any help would be great.
> Thanks in advance,
> Henning.

	Jay Glascoe
--  
"Narf!"
  --Pinky


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

Date: Fri, 05 Mar 1999 18:55:20 GMT
From: "Michael T. Richter" <mtr@ottawa.com>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <sMVD2.4$Rx6.128@198.235.216.4>

Could you paranoid gits either post messages relevant to Python or move this
crap from comp.lang.python?

Todd Bandrowsky wrote in message <36dde1d1@news.deniz.com>...
>
>Oh please, spare the misrepresentation.  Sun Microsystems, you know, the
>holy good guys, have had the concept of a software accessible unique
>identifier in all of their hardware.  Corporate America wants to track
>people, and Sun has been giving them that technology for years.  If you are
>going to boycott Intel, then you should boycott Sun too.
>
>JoHn DoH <johndoh@home.com> wrote in message
>news:36D9D5CE.D39B0338@home.com...
>>I beg to differ but MAC addressess are not made for spying on us they
>>are for network location and such.  No on knows that I own a certain
>>MAC  address (unlike Intel that wants you to register after getting the
>>PIII).  I think it is a bad move on intel's part but those that accept
>>it are doomed to get shafted.  Your ass not mine (I will keep my PI any
>>day running).  Sorry for the crossposting just got a little annoyed and
>>wanted it to be righted in all places of being.
>>
>> -DoH
>>
>>Kano wrote:
>>>
>>> Oh come on. Many other standard devices (ethernet cards, for example)
>have their
>>> own unique serial numbers that software can use at will. Get over it.
>>>
>>> -kl
>>>
>>> Boycott Swintel <swintel@badchips.com> wrote in message
>>> news:36ddc0ca.4718754@news.earthlink.net...
>>> >Take the Pentium III Boycott Survey
>>
>>--
>>JoHn 'DoH' KeLm
>>http://www.johndoh.cjb.net
>>"People are too stupid to realize they are" - DoH
>
>



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

Date: Fri, 05 Mar 1999 18:56:05 GMT
From: "Michael T. Richter" <mtr@ottawa.com>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <9NVD2.5$Rx6.83@198.235.216.4>

Do these paranoid rants have anything at all to do with Python?

Barry Keeney wrote in message <7bn4e0$ihp$1@sloth.swcp.com>...
>Todd Bandrowsky (tbandrowsky@del.net) wrote:
>
>: Oh please, spare the misrepresentation.  Sun Microsystems, you know, the
>: holy good guys, have had the concept of a software accessible unique
>: identifier in all of their hardware.  Corporate America wants to track
>: people, and Sun has been giving them that technology for years.  If you
are
>: going to boycott Intel, then you should boycott Sun too.
>
>  I don't have a problem with using a unique id for each machine but I
>don't what it in the processor. if you have a problem like your powersupply
>fan dies and that causes your CPU to burn out all the software tied to
>that CPU has to get a new license. that would be a complete bitch.
>
>  sun puts there ID in a NVRAM chip. should that chip fail you can
>re-program it's replacement with your old ID. bingo your software is
working
>again.
>
>  companys that sell PC software have been ripped off right and left
>by people using illegal copies of software. in the unix world you could
>tie your software into a unique host id to prevent it being illegal copied
>but PC's have lacked this feature. up till now you had to use an external
>device ( mostlikely on the printer port ) to make sure you were only using
>the software on one machine, at a time anyway. these hardware keys cost
>money and can cause problem with printing.
>
>   lastly sun doesn't have software in that sends back info on the
>machine and what's installed on it. microsoft has, in the past, sent
>out versions of the OS (beta 95) that sent info about your system
>back to microsoft, without telling the people with the beta that
>it was doing this. microsoft told the media, after someone discovered
>this, that it was only to help them solve problems with the beta.
>lots of people didn't beleave this.
>
>
>: JoHn DoH <johndoh@home.com> wrote in message
>: news:36D9D5CE.D39B0338@home.com...
>: >I beg to differ but MAC addressess are not made for spying on us they
>: >are for network location and such.  No on knows that I own a certain
>: >MAC  address (unlike Intel that wants you to register after getting the
>: >PIII).  I think it is a bad move on intel's part but those that accept
>: >it are doomed to get shafted.  Your ass not mine (I will keep my PI any
>: >day running).  Sorry for the crossposting just got a little annoyed and
>: >wanted it to be righted in all places of being.
>: >
>: > -DoH
>: >
>: >Kano wrote:
>: >>
>: >> Oh come on. Many other standard devices (ethernet cards, for example)
>: have their
>: >> own unique serial numbers that software can use at will. Get over it.
>: >>
>: >> -kl
>: >>
>: >> Boycott Swintel <swintel@badchips.com> wrote in message
>: >> news:36ddc0ca.4718754@news.earthlink.net...
>: >> >Take the Pentium III Boycott Survey
>: >
>: >--
>: >JoHn 'DoH' KeLm
>: >http://www.johndoh.cjb.net
>: >"People are too stupid to realize they are" - DoH
>
>
>
>--
>Barry Keeney
>Chaos Consulting
>email barryk@chaoscon.com



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

Date: Fri, 05 Mar 1999 10:27:56 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Thoughts on FAQ autoposting
Message-Id: <linberg-0503991027560001@ltl1.literacy.upenn.edu>

In article <x7hfs0cuts.fsf@home.sysarch.com>, Uri Guttman
<uri@home.sysarch.com> wrote:

> i cannot honestly state i have (recently) read the full
> faq character by character. i doubt many of you could clain it either!

I can't.  On a side note, there is also the "Perl FAQ-a-day" mailing list
for folks who would like a random FAQ in their mailbox every morning. 
It's simple to get on to and off of.

<http://yoak.com/daily_perl/>

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Fri, 05 Mar 1999 13:48:03 -0600
From: Bill Binkley <bwb@dowebpages.com>
Subject: Re: Use 'get' to get cgi output?
Message-Id: <36E034F2.4A6B5F18@dowebpages.com>

This may help?

"/home/username/public_html/asic/cus$CONFIG{'wco'}/customer.dbm";

just stick the input from form, in my case $CONFIG{'wco'} where ever,
on end in the middle, etc

in my case I am changing the directory!

it could be a url

Phil wrote:

> Hi I'm a real perl newbie but so far I got my script to work:
>
>         $url="http://the.adress.in.the.submit.tag?=myinput"
>         getstore($url, "mydatafile");
>
>  but the url is wrong. How do I get it to add the input from the form
> the web form would generate?
> It does something to stick the input on the end but this is wrong. Is
> this url encoding? Any pointers appreciated.
>
> Phil Yeo

--
Bill Binkley
Software Composers, Inc.
http://www.dowebpages.com

Go to this URL for JavaScript examples
and sample code. For JavaScript at it's
best see the "European Tour". If you
have a question about the examples, put
it in the comments of the visitors form.




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

Date: Fri, 05 Mar 1999 18:43:41 +0000
From: Jason Holland <graphics@alphacrc.com>
To: Peter Bismuti <bismuti@cs.fsu.edu>
Subject: Re: web browser in Perl?
Message-Id: <36E025DC.7C46DB3D@alphacrc.com>



Peter Bismuti wrote:
> 
> HI, I had the idea of writing a web browser in Perl.  I have the
> O'Reilly book 'Web Client Programming in Perl' and the 'Perl Cookbook'
> which has a chapter on web programming.  I'm finding that things don't
> work as well as they are supposed to.  Modern day web pages have
> java code and tables and other things that the html parser modules
> cannot handle.
> 
> Is writing a browser in Perl realistic as a part-time project for one
> person?  What other cool things could be done in Perl as a project
> involving the web?  If anyone has any ideas it would be appreciated.
> Also, if you have any code that you could send me to get me started
> I would be very grateful.
> 
> Thanks




Hello Peter,

That's pretty ambitious, but like you said there's too much extra stuff
in web pages these days...

Over the last year or so I've been developing a set of classes for doing
stuff with HTTP. Mostly traversing web sites, doing word counts and such.

I put all this stuff together, partly because I was learning Perl, and
partly because I wanted to call it my own work; you know, for experience.

A Perl web browser is not a bad idea though, just think you could
include Perl code in HTML, what a security risk that would be! The
graphics interface could be created using PerlTK or one of the other
interface libraries.


Good luck!


jason.holland@dial.pipex.com


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

Date: Fri, 05 Mar 1999 10:00:52 -0800
From: mikej <mikej@1185design.com>
Subject: Yahoo! style dynamic select boxes
Message-Id: <36E01BD4.5201E6E9@1185design.com>

Hi,

I was looking around my yahoo and found something that was pretty
interesting. In the configure weather settings, after you select the
area you are interested in, it takes you to a page with 2 multiple
selection fields that lets you add or remove fields from one another. I
looked at the source but couldnt tell how on earth they did it. Anyone
know how to best accomplish this effect? I know a little bit about perl
but not sure that it would be the best way to do this kind of thing. If
someone can point me in the right direction I would be very grateful.
Thanks.

-mike



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

Date: Fri, 05 Mar 1999 14:54:49 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Yahoo! style dynamic select boxes
Message-Id: <linberg-0503991454490001@ltl1.literacy.upenn.edu>

In article <36E01BD4.5201E6E9@1185design.com>, mikej
<mikej@1185design.com> wrote:

> Hi,
> 
> I was looking around my yahoo and found something that was pretty
> interesting. In the configure weather settings, after you select the
> area you are interested in, it takes you to a page with 2 multiple
> selection fields that lets you add or remove fields from one another. I
> looked at the source but couldnt tell how on earth they did it. Anyone
> know how to best accomplish this effect? I know a little bit about perl
> but not sure that it would be the best way to do this kind of thing. If
> someone can point me in the right direction I would be very grateful.

That's an HTML authoring question, not Perl.  Try the HTML/javascript
newsgroups.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Fri, 05 Mar 1999 18:51:15 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Yesterday!
Message-Id: <DIVD2.178$y_2.1751@typhoon01.swbell.net>

In article <7bp3i1$8l9$1@pegasus.csx.cam.ac.uk>,
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
>>>my ($d, $m, $y) - (localtime(time - 24*60*60))[3 .. 5];
>>>
>>>my $yesterday = sprintf("%02d%02d%4d", $d, $m+1, $y+1900);
>>
>>There really should be a FAQ entry on why that is a _bad idea_.
>>Days are NOT always exactly 24*60*60 seconds long and depending
>>on it is unwise: POSIX to the contrary, many boxes do account 
>>for leap seconds.
>
>Why do people keep repeating this FUD?    I know of no platform where
>time() includes leap seconds.    It would be quite difficult to
>implement.

It is easy when is built into the base package for handling timezones
that many systems use <URL:ftp://elsie.nci.nih.gov/pub/>. The tzone package 
distributed from there includes historical leap second corrections 
and is commonly used for its _comprehensive_ timezone treatment for both 
current, historical and future dates. 

This package is already part of many POSIX-compliant hosts,
including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun.
All it takes is the right (or wrong, depending on your viewpoint) 
options in the Makefile and you have leapseconds.

-- 
Benjamin Franz


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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