[19727] in Perl-Users-Digest
Perl-Users Digest, Issue: 1922 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 13 06:05:32 2001
Date: Sat, 13 Oct 2001 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1002967506-v10-i1922@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 13 Oct 2001 Volume: 10 Number: 1922
Today's topics:
$query->param not working. <news@scottbell.org>
Re: 20-line webserver in perl ? <pne-news-20011013@newton.digitalspace.net>
Re: Access a hash key by hash value ? (Eric Bohlman)
command line argument <yah00204052@yahoo.com>
Re: command line argument <rob_13@excite.com>
Re: command line argument <davidhilseenews@yahoo.com>
Re: Doing cyclic log files (Garry Williams)
Re: FA: $5 -> 7 back issues of "The Perl Journal" <keith@justanotherwebsite.com>
Re: Follow up: Match Operator not working? <bwalton@rochester.rr.com>
Re: HTML substitution <bwalton@rochester.rr.com>
integer division <srosik@t-online.de>
Re: integer division <pne-news-20011013@newton.digitalspace.net>
Re: Need help with a Regular Expression (2obvious)
need help: starting several programs by perl <hvgrimbergen@hetnet.nl>
Re: Parsing complex data structure <dtweed@acm.org>
Re: Parsing complex data structure (Eric Bohlman)
Re: Perl Power Limits? <notspam@spamfree.dud>
Re: Perl Power Limits? <notspam@spamfree.dud>
Re: pipe to nawk within perl? <bwalton@rochester.rr.com>
Re: pipe to nawk within perl? <Jon.Ericson@jpl.nasa.gov>
Re: pipe to nawk within perl? <krahnj@acm.org>
Problems with Perl/cgi on webserver <wienerpatrolinc@hotmail.com>
Re: String To List (Eric Bohlman)
Re: The inner working of the debug module ? <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 13 Oct 2001 10:59:16 +0100
From: "Scott Bell" <news@scottbell.org>
Subject: $query->param not working.
Message-Id: <zdUx7.10836$fo2.1290157@news6-win.server.ntlworld.com>
I have a simple CGI website, but I get this error:
Can't call method "param" on an undefined value at
/home/sbell/public_html/index.cgi line 52.
The code thats causing the error is this:
if ($query->param(content) eq home){
print "home<br>\n";
} else {
print "<a href=\"?\">home</a><br>\n";
}
Can anyone tell me why this isn't working, I got it to work for Perl on my
Windows machine but on my shell account it doesn't.
--
Scott Bell
Email: scott@scottbell.org
The content of this message has been certified 100% correct.
------------------------------
Date: Sat, 13 Oct 2001 09:34:50 +0200
From: Philip Newton <pne-news-20011013@newton.digitalspace.net>
Subject: Re: 20-line webserver in perl ?
Message-Id: <aipfsts993jgs2ajfh3d21phr83eoohr3d@4ax.com>
On 12 Oct 2001 11:26:40 -0700, entropy@farviolet.com (Lawrence Foard)
wrote:
> 1) Education - If you really want to understand something doing it from the
> ground up is the best way. This doesn't mean you necessarily
> use the code in production, but the exercise means that you
> really understand whats going on.
Reminds me of a quote that said something like "Inventing one's own
templating system appears to be a kind of 'rite of passage'" to explain
the proliferation of such systems.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 13 Oct 2001 08:35:32 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Access a hash key by hash value ?
Message-Id: <9q8uck$9ts$2@bob.news.rcn.net>
Carsten Menke <bootsy52@gmx.net> wrote:
> But what I have not found and what is not explained there is, how
> the values keep their reference to the keys they belong while they get
> ordered. Or said in another way how is the hash reorginized?
It isn't. You're simply sorting a list (stored separately from the hash
itself) of keys, and then going through the list and looking up the hash
values in the normal way.
------------------------------
Date: Sat, 13 Oct 2001 00:11:37 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: command line argument
Message-Id: <3BC7BEF9.A37EAF55@yahoo.com>
Does perl have anything similar to main(argc, argv) in C? How can
perl obtain the argv?
------------------------------
Date: Sat, 13 Oct 2001 04:32:57 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: command line argument
Message-Id: <Xns913957E96111rock13com@64.8.1.227>
Zimmen Gnauh <news:3BC7BEF9.A37EAF55@yahoo.com>:
> Does perl have anything similar to main(argc, argv) in C?
> How can
> perl obtain the argv?
I'm not very familiar with C but:
prompt> perl script param1
$ARGV[1] is now 'param1'
--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: Sat, 13 Oct 2001 05:24:58 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: command line argument
Message-Id: <KeQx7.151523$Xz1.23228480@news1.rdc1.md.home.com>
"Rob - Rock13.com" <rob_13@excite.com> wrote in message
news:Xns913957E96111rock13com@64.8.1.227...
> Zimmen Gnauh <news:3BC7BEF9.A37EAF55@yahoo.com>:
>
> > Does perl have anything similar to main(argc, argv) in C?
> > How can
> > perl obtain the argv?
>
> I'm not very familiar with C but:
>
> prompt> perl script param1
>
> $ARGV[1] is now 'param1'
>
>
> --
> Rob - http://rock13.com/
> Web Stuff: http://rock13.com/webhelp/
Strange, you indicate behavior that a C programmer would expect. In C,
argv[0] is the name of the file and argv[1] is the first parameter. In
perl, the arguments start at $ARGV[0], and the name of the script is in $0.
perl -le 'print for @ARGV' foo bar baz
--
David Hilsee
------------------------------
Date: Sat, 13 Oct 2001 02:49:37 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Doing cyclic log files
Message-Id: <slrn9sfatv.h2n.garry@zfw.zvolve.net>
On Fri, 12 Oct 2001 22:08:36 +0100, Peter Hickman
<peterhi@shake.demon.co.uk> wrote:
> Is there a module for doing log files that change daily / weekly / monthly /
> whatever. Or is there a need for one?
Don't really know what you mean by "doing log files", but this may be
what you're looking for (runs out of the root crontab on Solaris):
$ cat /usr/lib/newsyslog
#! /bin/sh
#
# Copyright(c) 1997, by Sun Microsystems, Inc.
# All rights reserved.
#
#ident @Z%newsyslog 1.3 97/03/31 SMI
#
LOG=messages
cd /var/adm
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cp /dev/null $LOG
chmod 644 $LOG
#
LOGDIR=/var/log
LOG=syslog
if test -d $LOGDIR
then
cd $LOGDIR
if test -s $LOG
then
test -f $LOG.6 && mv $LOG.6 $LOG.7
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cp /dev/null $LOG
chmod 644 $LOG
sleep 40
fi
fi
#
kill -HUP `cat /etc/syslog.pid`
$
--
Garry Williams
------------------------------
Date: Sat, 13 Oct 2001 01:55:03 GMT
From: Keith <keith@justanotherwebsite.com>
Subject: Re: FA: $5 -> 7 back issues of "The Perl Journal"
Message-Id: <3BC79FC4.65D22187@justanotherwebsite.com>
no need to buy them from you, all the articles from all the back issues
are online at http://www.samag.com/tpj/
lbecker wrote:
>
> 7 mint issues of The Perl Journal, if interested go to:
>
> http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1474131023
--
Keith
*****************************************************
http://www.powersolution.com
"I looked up one day and saw, it was up to me.
You can only be a victim if you admit defeat!"
- From "Coolidge" by The Descendents
------------------------------
Date: Sat, 13 Oct 2001 02:57:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Follow up: Match Operator not working?
Message-Id: <3BC7AD59.B44F7D39@rochester.rr.com>
Roy wrote:
>
> Ok, here's the code I'm having problems with. When &verinfo is executed,
> $current_line has nothing but a return char in it. But &rptinfo works fine.
> It would *seem* that $current_line lost it's value the first time around...
...
> roy
>
> --------code here --------
> #!/usr/bin/perl -w
>
> $current_heading = "next";
>
> open(ADU, "adu-fit.txt") || die "Could not open text file: $!";
>
> %heading = ("Array Diagnostic","verinfo()","USER ENTERED","rptinfo()");
>
> readadu();
> print "ADU Reader results:\n";
> print @rpt;
>
> sub readadu
> { my $rpt_heading;
> while (defined($current_line = <ADU>))
>
> foreach $rpt_heading (keys %heading)
> { if ($current_line =~ /$rpt_heading/)
> { $current_heading = $rpt_heading; } }
> eval $heading{$current_heading};
> }
> }
>
> sub verinfo
> {
> $current_line =~ /array\sdiagnostic\D+(\d\.\d+)/i;
> $rpt[4] = $1;
> }
>
> sub rptinfo
> {
> SWITCH:
> { if ($current_line =~ /date:/i) { $rpt[0] = $current_line; last SWITCH; }
> if ($current_line =~ /time:/i) { $rpt[1] = $current_line; last SWITCH; }
> if ($current_line =~ /computer/i) { $rpt[2] = $current_line; last SWITCH; }
> if ($current_line =~ /system\srom/i) { $rpt[3] = $current_line; last SWITCH; }
> }
> }
>
...
Your code above won't compile. But when (*sigh*) I add the missing
bracket (*please* copy/paste working code, don't retype it), I note that
the first time &verinfo is called, $current_line does not have just a
return character (properly called a newline) in it -- it has the entire
first line including its newline in it. But the second time &verinfo is
called (on the second line read), $current_line does have just a newline
in it. That is because the eval is happening whether anything matched or
not -- and if nothing did match, $current_heading still remains from the
first time through, causing &verinfo to be called again. You need to
clean up the logic a bit -- I'm guessing you want to call &verinfo only
upon encountering a "Array Diagnostic" line, but that you want to call
&rptinfo on every line after a "USER ENTERED" line is encountered.
Try the Perl debugger. This sort of stuff is what it's for. You should
also note many other potential glitches in your code -- like in
&verinfo, you assign from $1 without testing to see if the pattern match
succeeded. If it didn't (like on the second line of the file), you will
be assigning whatever was left in $1 from the last successful match,
wherever that might have been, for example. That's sloppy and
dangerous.
--
Bob Walton
------------------------------
Date: Sat, 13 Oct 2001 01:26:21 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: HTML substitution
Message-Id: <3BC79819.2ED5988D@rochester.rr.com>
Brady Doll wrote:
>
> Try it out with this...my problem is that it isn't going through the whole
> line with the input of:
> "<TITLE>News Update</TITLE>"
> but it does with the input of:
> "<IMG SRC="image.jpg"><IMG SRC="image2.jpg">",
>
> sub replace
> {
> ($line) = @_; # line from HTML file
> local($temp, $replace);
>
> $_ = $line;
>
> while (/([^<]*)^<([^>]*)>/)
> {
> $replace = "";
>
> if ($replace ne "")
> {
> $temp = "$temp$1$2$replace";
> }
> else
> {
> $temp = "$temp$1<$2>";
> }
>
> $_ =~ s/(?:[^<]*)^<(?:[^>]*)>//;
> }
>
> return $temp;
> }
>
...
> > Please provide a complete example we can copy/paste/execute that
> > exhibits the problem you are having. Thanks.
> > --
> > Bob Walton
Thanks for the code that will compile. I note that the regex:
/([^<]*)^<([^>]*)>/
will only match strings that start with an HTML tag. That is because
the first ([^<]*) is forced to match the null string by virtue of being
followed by the ^ metacharacter, which succeeds only at the start of a
line. Thus, the string:
News Update</TITLE>
as left by the first pass through the while loop will fail to continue
the while loop.
It is not at all clear what you are attempting to match. Do your "HTML
tags" contain some special syntax like:
<tag^replacement_string>
? If so, try escaping the ^ metacharacter. Or maybe you are trying to
do something with matching multiline strings, and the ^ is supposed to
match the start of a second line? In that case, you will need the /m
modifier on your match. Otherwise, you will need to explain further.
--
Bob Walton
------------------------------
Date: Sat, 13 Oct 2001 09:18:17 +0200
From: Stefan Rosik <srosik@t-online.de>
Subject: integer division
Message-Id: <3BC7EAB9.ED7BF91D@t-online.de>
Dear all,
how do I perform an integer division ('div') with perl?
Stefan
------------------------------
Date: Sat, 13 Oct 2001 10:25:54 +0200
From: Philip Newton <pne-news-20011013@newton.digitalspace.net>
Subject: Re: integer division
Message-Id: <mgsfstgshmn48mcgtda680tj3kqjshu3os@4ax.com>
On Sat, 13 Oct 2001 09:18:17 +0200, Stefan Rosik <srosik@t-online.de>
wrote:
> how do I perform an integer division ('div') with perl?
Look in the thread entitled 'integer division' (just like your post)
that started here five days ago.
groups.google.com is your friend, or ask your favourite newsserver to
give you the past week's posts and see whether your question has already
been asked and possibly even answered.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 12 Oct 2001 18:10:37 -0700
From: vadivasbro@hotmail.com (2obvious)
Subject: Re: Need help with a Regular Expression
Message-Id: <6e537be.0110121710.425a21aa@posting.google.com>
Martien is correct in stating that my problem was a bit
underspecified. I actually did that on purpose, because I didn't want
to overcomplicate my the statement of my problem and risk getting no
help at all.
I thought that by surrounding my regular expression in anchors, I made
it obvious that I wanted a match to contain *nothing but* two or more
alpha blocks. (Not *at least* two or more alpha blocks. Even though
this is what I wrote. My bad.) At any rate, everyone I confused was
kind enough to consider both my actual problem and the
misinterpretation that I left room for.
Martien's solution was probably the way I would have solved things if
my thinking cap was on straight. However, Wyzelli's solution was more
elegant cool. And John's addendum to Wyzelli's approach was even
cleaner. So I decided to use John's expression:
/^[A-Z]+(\s[A-Z]+)+$/i
Thanks a bunch.
--E.
------------------------------
Date: Sat, 13 Oct 2001 09:48:00 +0200
From: "H.v.Grimbergen" <hvgrimbergen@hetnet.nl>
Subject: need help: starting several programs by perl
Message-Id: <esmPIp7UBHA.233@net037s.hetnet.nl>
Hi there,
I have a question about perl.
I want to startup Apache, Mysql and a browserscreen by just one perl script
on a
win32 box. If possible as a console or something so that stoping the console
also stops
the Apache server, mysql and browser.
Is there someone who has an example or script what can do this trick.
With regards,
H.v.Grimbergen
------------------------------
Date: Sat, 13 Oct 2001 04:21:23 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: Parsing complex data structure
Message-Id: <3BC7BFE9.869C080@acm.org>
Thomas Bätzler wrote:
> split(','); will split $_.
> split /,/; will split $_.
> split(',',); will split <undef>. Hint: one comma too many.
You didn't try it, did you?
For me,
split ','; splits $_.
split ',',; splits $_.
split (',',); splits $_.
After all, an argument list is just a list, and an extra comma
never adds an extra element to any list.
-- Dave Tweed
------------------------------
Date: 13 Oct 2001 08:53:28 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Parsing complex data structure
Message-Id: <9q8ve8$9ts$3@bob.news.rcn.net>
Drew Myers <bh_ent@hotmail.com> wrote:
> The print statement at the end is not iterating through the record the
> way I think it should. I do get the proper quantity of lines printed,
> but the information is always the first element (I assume) of the
> record.
Others have pointed out a problem with one of your splits, but there's
another problem:
> for my $report (keys %server) {
> print "$record->{LOCAL_PASSWD}\n" if (exists
> $servertype{$report});
> }
$record is going to be the last record you inserted into %server. I think
you want $server{$report}->{LOCAL_PASSWD} instead.
This sort of thing, BTW, is why a lot of regulars here are so insistent
that you scope variables as narrowly as possible. If you had declared
$record inside the loop where it's used, you would have gotten an error
when you tried to access it outside the loop. Loop temporary variables
shouldn't be visible outside their loops, since accessing them outside the
loop is almost always a logic error.
------------------------------
Date: Fri, 12 Oct 2001 22:50:24 -0400
From: Sean O'Dwyer <notspam@spamfree.dud>
Subject: Re: Perl Power Limits?
Message-Id: <notspam-FB6D6D.22502412102001@news.compuserve.com>
In article <87bsjdynyd.fsf@abra.ru>, Ilya Martynov <ilya@martynov.org>
wrote:
>If you writting CGIs C++ could be faster than Perl because CGI load
>time should be faster. But you probably should use techologies like
>mod_perl, fast_cgi or speedy_cgi - techologies that doesn't start new
>process on each request but instead reuse existing processes for
>serving requests. In this case load time is no longer relevant. Since
>you application is database driven I would expect backend database to
>be bottleneck in such configuration but not implementation
>language. And since Perl is much more easier to write web application
>I would use Perl. Probably the only gain you could get by using C++ is
>lowering memory requirements. But you should know that RAM is cheap
>but developer's time is not.
Thanks Ilya, for this information. My client's site is on is a very high
spec server so I'm not worried about a hardware or network bottleneck.
However, your response has prompted me to dig further with the people
who run the server to get their guidance. The database itself is tiny,
only 100 records at present, and probably never as high as 1000, and a
max of 1k per record. From your response above I think Perl should be
just fine for this. But I'll dig further.
Kind regards,
Sean
--
Tanta agenda, tantula voluntas.
------------------------------
Date: Fri, 12 Oct 2001 22:53:40 -0400
From: Sean O'Dwyer <notspam@spamfree.dud>
Subject: Re: Perl Power Limits?
Message-Id: <notspam-AF9314.22534012102001@news.compuserve.com>
In article <Xns9137E72D1969rock13com@64.8.1.226>, "Rob - Rock13.com"
<rob_13@excite.com> wrote:
>Not really helpful, how many accesses to documents that need to
>call Perl?
The database itself is tiny, only 100 records at present, and probably
never as high as 1000, with a max of 1k per record. So, I'd plan to have
as few SSI calls per page as possible, or maybe just generate each page
on the fly direct from the database.
Thanks for the other info you supplied, very helpful. I'll be talking to
the server techies next week. I was just looking for some information
and potential questions, so your response was most helpful.
Kind regards,
Sean
--
Tanta agenda, tantula voluntas.
------------------------------
Date: Sat, 13 Oct 2001 01:55:11 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: pipe to nawk within perl?
Message-Id: <3BC79ED4.5827CAD4@rochester.rr.com>
Mike Cambray wrote:
>
> Could anyone out there tell me why I can't get the pipe to nawk
> part of the let2 var below to work (from within a perl script)?
> I want let2 to equal '/u1/letters/033308250.o2540'
> ($ssn = '033308250' and $date2grep = 'Sep 11')
>
> $let1 = `ls -l $ld/$ssn.o* | grep '$date2grep'`;
> $let2 = `ls -l $ld/$ssn.o* | grep '$date2grep' | nawk '{print $9}'`;
>
> print "let1 =\n";
> print "$let1\n";
>
> print "let2 =\n";
> print "$let2\n";
>
> Output:
> let1 =
> -rw-r--r-- 1 bcsadmin bcs 1126 Sep 11 08:57 /u1/letters/033308250.o2540
>
> let2 =
> -rw-r--r-- 1 bcsadmin bcs 1126 Sep 11 08:57 /u1/letters/033308250.o2540
Just guessing: you need to escape the $ in $9 . It is appearing in a
qx() string, which gets interpolated. I assume you want the rest of the
$... variables in the expression to be interpolated, rather than passed
through to behave a shell variables. You could, of course, parse that
up in Perl rather than grep and nawk and avoid the tricky points of Perl
and shell quoting. Or even use opendir and readdir and avoid the
nonportable shell stuff altogether.
--
Bob Walton
------------------------------
Date: 12 Oct 2001 17:08:15 +0000
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: pipe to nawk within perl?
Message-Id: <86zo6wkcqo.fsf@jon_ericson.jpl.nasa.gov>
michael.cambray@wellpoint.com (Mike Cambray) writes:
> Could anyone out there tell me why I can't get the pipe to nawk
> part of the let2 var below to work (from within a perl script)?
> I want let2 to equal '/u1/letters/033308250.o2540'
> ($ssn = '033308250' and $date2grep = 'Sep 11')
>
> $let1 = `ls -l $ld/$ssn.o* | grep '$date2grep'`;
> $let2 = `ls -l $ld/$ssn.o* | grep '$date2grep' | nawk '{print $9}'`;
Ok, let's make that a little more generic and use strictures and
warnings:
#!/usr/bin/perl -w
use strict;
print `ls -l | awk '{print $9}'`
When I run this I get this warning:
Use of uninitialized value in concatenation (.) or string at ./test
line 4.
As you already know (since you make use of it above), backticks
interpolate. If you wanted to avoid interpolation:
print qx'ls -l | awk \'{print $9}\''
or:
print `ls -l | awk '{print \$9}'`
(See the perlop manpage.)
The moral of the story: use warnings.
Jon
--
"Consider carefully what you hear," he continued. "With the measure
you use, it will be measured to you--and even more. Whoever has
will be given more; whoever does not have, even what he has will be
taken from him." -- Mark 4:24-25 (NIV)
------------------------------
Date: Sat, 13 Oct 2001 06:37:18 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: pipe to nawk within perl?
Message-Id: <3BC7E199.17D65D48@acm.org>
Mike Cambray wrote:
>
> Could anyone out there tell me why I can't get the pipe to nawk
> part of the let2 var below to work (from within a perl script)?
> I want let2 to equal '/u1/letters/033308250.o2540'
> ($ssn = '033308250' and $date2grep = 'Sep 11')
>
> $let1 = `ls -l $ld/$ssn.o* | grep '$date2grep'`;
> $let2 = `ls -l $ld/$ssn.o* | grep '$date2grep' | nawk '{print $9}'`;
>
> print "let1 =\n";
> print "$let1\n";
>
> print "let2 =\n";
> print "$let2\n";
>
> Output:
> let1 =
> -rw-r--r-- 1 bcsadmin bcs 1126 Sep 11 08:57 /u1/letters/033308250.o2540
>
> let2 =
> -rw-r--r-- 1 bcsadmin bcs 1126 Sep 11 08:57 /u1/letters/033308250.o2540
Why use nawk at all? Here is a more perlish way to do it:
$ cat ~/bin/try.pl
#!/usr/bin/perl -w
use strict;
my $ld = '/u1/letters';
my $ssn = '033308250';
my $month = 8; # Sept. = 8; month array starts at 0 for January
my $day = 11;
my @files = grep {
my @mtime = localtime( (stat)[9] );
$mtime[3] == $day and $mtime[4] == $month;
} glob "$ld/$ssn.o*";
print "$_\n" for @files;
__END__
$ ls -l /u1/letters/033308250.o*
-rw-r--r-- 1 john users 0 Sep 11 08:57
/u1/letters/033308250.o2540
-rw-r--r-- 1 john users 0 Sep 11 08:57
/u1/letters/033308250.o2550
-rw-r--r-- 1 john users 0 Sep 12 08:57
/u1/letters/033308250.o2560
-rw-r--r-- 1 john users 0 Aug 12 08:57
/u1/letters/033308250.o2660
$ try.pl
/u1/letters/033308250.o2540
/u1/letters/033308250.o2550
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 12 Oct 2001 22:41:00 -0700
From: "Arm123" <wienerpatrolinc@hotmail.com>
Subject: Problems with Perl/cgi on webserver
Message-Id: <eRNx7.41306$dO3.3618257@news20.bellglobal.com>
Hi there, I know this probably does not belong in this group but i have
tried others
and somebody told me to look around the perl newsgroups. I have setup an
Apache webserver for the first time. It is going to have a few Virtual
hosts
set up on it. I am not having any problems with that. However, I am having
trouble getting things to run the way I want to.
First off I am going to be the webmaster of these sites, so im not too
concerned about cgi security because they are my own scripts. Basically I
want to be able to make the Documentroot and its sub directories ( Including
the Virtual host dirs ) able to run scripts AND at the same time be able to
view HTML / GIF / OTHER documents, without revealing the listing of the
directories.
Is this possible ?.. I have tried to set things up, playing with the
different derivatives. Its seems I can only get one or the other to work
( either I can get html files to work but not the scripts, or the scripts
work and the html files don't due to a "Forbidden" error ) .
Here is an example of my 'httpd.conf'
DocumentRoot "/var/www"
<Directory /var/www>
Options All ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost myhost.com>
ServerAdmin user@myhost.com
DocumentRoot /var/www/myhost.com
ServerName myhost.com
ErrorLog logs/myhost.com-error_log
CustomLog logs/myhost.com-access_log common
</VirtualHost>
Notes: I have also tried declaring a <Directory> derivative for the virtual
host Document root and specified all different kinds of options for it.
Also, I have tried declaring every option for the Options instead of the '
All ' option.
Also, is it necessary to declare a ScriptAlias ? I'm not ruling out
permission problems, order of declaration, or any ' Newbie ' solution, as I
am a Newbie . Thank you all for reading this and for your time.
------------------------------
Date: 13 Oct 2001 08:32:26 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: String To List
Message-Id: <9q8u6q$9ts$1@bob.news.rcn.net>
Jay <jay@utils.net.nospam> wrote:
> Here is what I am trying to do:
> In the sample 4 field text file attached below, I would like to select
> particular lines based on user input, which is a string. What will be
> the
> better choice for the format of this user string, so that user can
> provide
> fieldName(s) and fieldValue or fieldName(s) and pattern
> For now what I have is:
> $matchStr = "-f1 m* , -f2 d*g" OR "-f4 0, -f3 8" OR "-f m1 m2"
> This is what I am doing:
> @conds = split(/\,/, matchStr );
Your big problem is that you're not using strict, so the compiler isn't
complaining about your bareword matchStr which is really supposed to be
$matchStr. You don't need to backslash the comma, but you ought to put
\s* before and after it so it will correctly handle cases (like your
example) that have whitespace before and/or after the comma.
> print "$conds[1]"; # gives me blank. I am expecting "-f2 ..."
> Ideally I would like to ask from the perl tk GUI a value which gives
> me which field and what pattern. Whatever way options are
> provided it shouldn't use escaping of characters.
> Any comments on what will happen if a format like the following is
> used.
> What will be the easiest way to extract fieldName and fieldValues which
> could be exact value or a pattern.
> "(f1 pattern) (f2 pattern)... "
> Text File:
> field1 field2 field3 field4
> -----------------------------------------------
> pplus drawing 14 0
> cont drawing 6 0
> m1 drawing 8 0
> m1 vss 8 2
> m1 vdd 8 1
> via1 drawing 19 0
> m2 drawing 10 0
> m2 vss 10 2
> m2 vdd 10 1
> via2 drawing 29 0
> m3 drawing 30 0
> m3 vss 30 2
> m3 vdd 30 1
> --------------------------------------------
Easiest to program or easiest to use? Easiest thing to program would be
to use DBI and DBD::AnyData and then enter your queries in SQL. That
might also be the easiest thing to use.
------------------------------
Date: Sat, 13 Oct 2001 01:59:32 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: The inner working of the debug module ?
Message-Id: <3BC79FD8.1B8713CE@rochester.rr.com>
Ernst Ube wrote:
>
> Hi,
> do you know a description of the
> functioning of the DB module somewhere...?
>
> (The two GUI debuggers that I loaded down
> didn't work. It can't be so difficult to
> write a simple one myself :-)
>
> Thanks
> Ernst
Did you try ptkdb? It even works on Windoze.
--
Bob Walton
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1922
***************************************