[8204] in Perl-Users-Digest
Perl-Users Digest, Issue: 1822 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 6 11:07:47 1998
Date: Fri, 6 Feb 98 08:00:26 -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, 6 Feb 1998 Volume: 8 Number: 1822
Today's topics:
Re: Can't log on to Active Messaging Library in NT time <ekgermann@cctec.com>
Re: Change user ID (Martien Verbruggen)
Re: Don't use signal handlers (was Re: Child processes) (Malcolm Beattie)
Re: Don't use signal handlers (was Re: Child processes) (Chip Salzenberg)
Re: Filtering Problem (Bart Lateur)
Re: Filtering Problem <Joergen.Lang@schwaben.de>
Re: Filtering Problem (Martien Verbruggen)
flocking questions! <gedavis3@vt.edu>
Re: flocking questions! <merlyn@stonehenge.com>
gethostbyaddr example please <sa346@city.ac.uk>
Re: Help - need telnet client in perl <sbekman@iil.intel.com>
Re: help stream lining script... <jdporter@min.net>
Re: input file to hash (Martien Verbruggen)
Re: Is Perl 5 year 2000 compliant? <dformosa@st.nepean.uws.edu.au>
Is PerlIT good? <scotth@nyd2.com>
Re: memory eating progs on win32 perl! (Martien Verbruggen)
netscape.hst regex <cbevis@nsinet-nospam-.com>
Newbie needs rec. for PERL/CGI primer <jconnell@lords.com>
Re: Newbie needs rec. for PERL/CGI primer (Mike Stok)
Re: non-regex for potentially RFC-compliant email addre <dformosa@st.nepean.uws.edu.au>
Re: perl pointer puzzle (Andrew M. Langmead)
Re: Perl, Tcl and Expect? (Michael Fuhr)
Re: Random Image Generator <gedavis3@vt.edu>
Re: searching by file creation/modification date? (Martien Verbruggen)
Re: security problem <jjv@caesun.msd.ray.com>
Suggestions for porting sybperl to activeware PerlScrip <tim@hcirisc.cs.binghamton.edu>
Re: The perl institute still alive ? <oboyle@csociety.ecn.purdue.edu>
Re: unable to capture info. resulting from a system() c <jdporter@min.net>
Re: White Hats and Black (Bart Lateur)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 6 Feb 1998 09:31:53 -0500
From: "Eric Germann" <ekgermann@cctec.com>
Subject: Re: Can't log on to Active Messaging Library in NT timed job
Message-Id: <34db1eda.0@news.cctec.com>
Also, LocalSystem has no access to the network, so if the XCH server is
across the wire, you're out of luck
Eric
Lutz Albers wrote in message <34D96346.19066389@muc.de>...
>Markus Laker wrote:
>
>> The script works if I'm logged on as myself, SOUTH\MSL. It works if I
>> use 'su' to to run it as an administrator. It works if I run while
>> logged on as an administrator. But if I try to send mail from a timed
>> job, the script fails to log on to MAPI. (My schedule service logs on
>> as an administrator, using the same logon ID as I tried in the
>> previous steps.)
>
>This is a guess, but I think that timed jobs are not running under your
>account, but as LocalService or something else. The point is that these
>accounts might not have a profile.
>BTW, you don't need a profile if you have the name of a exchange server
>and a valid username/password pair
>
>--
>Lutz Albers, lutz@muc.de
>Do not take life too seriously, you will never get out of it alive.
>
>
>
>
------------------------------
Date: 5 Feb 1998 03:43:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Change user ID
Message-Id: <6bbcg5$btm$3@comdyn.comdyn.com.au>
In article <6bakb3$j7t$1@alexander.ins.cwru.edu>,
sxv10@po.CWRU.Edu (Saidapet Vishnuraman) writes:
> I have a perl script which various users would be running. In the
> script I want to change the user id to another user before running
> certain section of the code. How do I do that in perl?
perldoc perlsec
look for suidperl and wrapsuid
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: 6 Feb 1998 10:54:00 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6beq48$mfb$1@news.ox.ac.uk>
In article <34D231E9.82115741@fmr.com>,
Steven Tolkin <steve.tolkin@fmr.com> wrote:
>For 3% ?!
>
>Chip Salzenberg wrote:
>
>> ...I repeat, with feeling: IT DOES NOT WORK CONSISTENTLY. I know this
>> for a fact. I've creatd a patch for reliable signals, but because it
>> incurs a 3% performance penalty (though modifying the main Perl
>> operation loop) it hasn't been incorporated into official Perl....
>
>I am very curious about this. A 3% performance hit, even if it affects
>every Perl programm even those not using signals, is really quite small in
>exchange for correct behavior!
The 3% figure being bandied about was a datapoint from one benchmark,
as I recall, and isn't too reliable a figure. The patch was vetoed
because it changed the core inner loop of perl so that it polled to
see if a signal had arrived (via a global variable) for every single
perl instruction. That made it impossible (in the 5.004 source base)
to ever optimise perl's inner loop by unrolling or jumping from one
OP to the next (both ideas which go back a long way and are on the
communal todo list for consideration). It also means that even when
the compiler generates inline C code, it would have to check every
few lines explicitly to see if a signal had arrived. Now, who would
recommend that a C program poll for signal arrivel every few lines?
The good news is that amongst the 5.005 changes I made, I introduced
a dynamic function pointer for perl's inner loop so that it can be
changed on-the-fly, subject to some constraints (the current op-run
during the changeover continues to use the old runner). That means
that it's easy to write a little XSUB and do
use BusySignalPolling;
to get Chip's behaviour.
A slightly modified version of the polling delays polling until the
end of each perl "statement" (pp_nextstate) but there was worries
raised that long running perl operators wouldn't be interrupted.
With threaded perl, you can fire off a separate signal-handling
thread with
use Thread::Signal;
so that signal handlers run immediately on delivery in that thread.
The slowdown of 30% for threading was based on the *development*
snapshot of a release or two ago. The threading is still in a state
of development, it hasn't been optimised and so, even leaving aside
the added features it gives (only for those who need it), comparing
its performance with a perl which has been carefully
performance-tuned for many years is a little disingenuous.
5.005 can have the best of both worlds: polling signals for those
that want them, no overhead for those that don't and reliable
immediate handling for those that are willing to pay the current
costs of threading.
--Malcolm
--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger
------------------------------
Date: Fri, 06 Feb 1998 14:39:53 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6bf7ea$341$1@cyprus.atlantic.net>
According to mbeattie@sable.ox.ac.uk (Malcolm Beattie):
>The 3% figure being bandied about was a datapoint from one benchmark,
>as I recall, and isn't too reliable a figure.
Well, we didn't check more than one architecture, but I'm confident
that 3% is the cost on Solaris with -DDEBUGGING.
>The patch [...] made it impossible (in the 5.004 source base)
>to ever optimise perl's inner loop by unrolling or jumping from one
>OP to the next [...] It also means that even when
>the compiler generates inline C code, it would have to check every
>few lines explicitly to see if a signal had arrived.
All those are worthy goals and/or reasonable concerns. BUT.
Immediate signal delivery corrupts Perl's internal data strutures.
I in all sincerity cannot fathom a value system that places potential
conflict with potential optimizations over easily achieved reliability
that people need today.
>The good news is that amongst the 5.005 changes I made, I introduced
>a dynamic function pointer for perl's inner loop so that it can be
>changed on-the-fly ... easy to write a little XSUB and do
> use BusySignalPolling;
>to get Chip's behaviour.
That's great ... for 5.005. I still have hopes of making 5.004
reliable, someday.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Nice shooting, Zanthar!" "Thanks, Denise." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Fri, 06 Feb 1998 10:28:35 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Filtering Problem
Message-Id: <34e2e2bc.8782946@news.tornado.be>
Joergen Lang <Joergen.Lang@schwaben.de> wrote:
>After scavenging the CPAN/FAQ's, etc. I couldn't find anything that
>matches my problem, so maybe one of you Gurus can help me.
>I have a database of tourdates to deal with. It's in simple ASCII and
>has the following form:
>
>"date";"town";"venue";"time";"artist"\n
>"date";"town";"venue";"time";"artist"\n
>"date";"town";"venue";"time";"artist"\n
It looks like your file is of the CSV type (comma separated values).
Except you're using semicolons.
It IS in the FAQ. FAQ file 4, starting at about line 350:
How can I split a [character] delimited string except when inside
[character]? (Comma-separated files)
HTH,
Bart.
------------------------------
Date: Fri, 06 Feb 1998 13:33:23 +0000
From: Joergen Lang <Joergen.Lang@schwaben.de>
Subject: Re: Filtering Problem
Message-Id: <34DB1123.6918@schwaben.de>
Bart Lateur wrote:
>
> It looks like your file is of the CSV type (comma separated values).
> Except you're using semicolons.
>
> It IS in the FAQ. FAQ file 4, starting at about line 350:
>
> How can I split a [character] delimited string except when inside
> [character]? (Comma-separated files)
>
> HTH,
> Bart.
Yep, you're right so far. Just looked it up.
But the problem was a bit more complex.
It had to do a lot with arrays in hashes and the likes (which I didn't
know were possible before I asked).
Anyway, it's *solved*.
Thanks again to all for the quick and comprehensive help.
Joergen
--
____________________________________________________________
'&` Joergen Lang:
#
# <mailto:Joergen.Lang@schwaben.de>
_#_ <mailto:Joergen_Lang@magicvillage.de>
( # )
/ O \ HOELDERLIN EXPRESS Management:
( === ) <mailto:music.contact@p-net.de>
`---'
HOELDERLIN EXPRESS Website:
<http://www.musiccontact.com/hx>
--- Electric Body Folk ---
_____________________________________________________________
------------------------------
Date: 5 Feb 1998 03:38:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Filtering Problem
Message-Id: <6bbc7h$btm$1@comdyn.comdyn.com.au>
In article <34D8877A.586E@schwaben.de>,
Joergen Lang <Joergen.Lang@schwaben.de> writes:
data:
> "date";"town";"venue";"time";"artist"\n
> "date";"town";"venue";"time";"artist"\n
> "date";"town";"venue";"time";"artist"\n
> (...etc...)
output:
> ARTIST
>
> date town venue time
> date town venue time
>
> NEXT ARTIST
I'd store it in some complex structure:
ARTISTNAME => [ ARRAY of [ ARRAY of fields ] ]
$h{'artist'} = [
[ date, town, venue, time ],
[ date, town, venue, time ],
...
]
#!/usr/local/bin/perl -w
use strict;
my %Artists = ();
# First, read in the data, and store the first four fields in an arrayref
# in a hash, keyed on the artist's name
while (<DATA>)
{
chomp;
my @fields = split(';');
# You might use Text::ParseWords or so. I'll just clean up
# the quotes myself
foreach (@fields) { s/^"//; s/"$// }
my $artist = pop @fields;
push @{$Artists{$artist}}, \@fields;
}
foreach (sort keys %Artists)
{
print uc($_), "\n";
# For all lines, for this artist
# You could specify a sorting routine for the following
foreach( @{$Artists{$_}} )
{
# $_ is a reference to an array (one line above) here
print join(' - ', @{$_}), "\n";
}
print "\n";
}
__DATA__
"12 Jan 1998";"Paint Town";"Red Blob Hall";"8:00 PM";"Djengis Khan"
"13 Jan 1998";"Sculpt City";"Concrete Slab Mall";"7:00 PM";"Djengis Khan"
"14 Jan 1998";"Music Town";"D Flat Plaza";"9:15 PM Sharp";"Djengis Khan"
"12 Jan 1998";"Brie County";"Cheese Street";"4:00 PM";"Gorgonzola the Great"
"16 Jan 1998";"Camembert City";"Mustard Place";"6:00 AM";"Gorgonzola the Great"
"17 Jan 1998";"Gargle Town";"Throaty Mall";"8:00 PM";"Borble the Magnificent"
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Fri, 6 Feb 1998 07:17:37 -0500
From: "Jerry Davis" <gedavis3@vt.edu>
Subject: flocking questions!
Message-Id: <6bev2m$h2b$1@solaris.cc.vt.edu>
Thanks to all that helped me with my first flock question, but some test
scripts have yielded some more questions.
First of all this is running Under perl 5 NT port.
NT does have support for flock because this script works
longflock.pl
==============
open(FILE, "file.txt");
flock(FILE,2);
sleep(30);
close(FILE);
shortflock.pl
===============
open(FILE, "file.txt);
flock(FILE,2);
print("Now I can open file");
close(FILE);
now if I run longflock first, then while it is running launch shortflock,
the scripts work like you would think. The second script waits till the
first script closes the file then it opens. I can tell because of the sleep
which causes the print statement in the second script to be delayed.
Playing around I removed the flock line from shortflock.pl. So the
longflock script flocks the file, but the shortflock does not. Now this
script does not work. Although the longflock is flocking, shortflock does
not "see" it and just get's to the print line right away.
This leads me to my question.
Aparently the check for a flock occurs when the script tries to flock a
file. BUT AT THAT POINT THE FILE IS ALREADY OPEN!
So if script1 opens, flocks, then changes a file (BUT DOES NOT WRITE YET).
Then script2 opens the file. tries to flock but is blocked.
*The problem is script2 has the unmodified file loaded in memory, and when
the flock breaks it will modify the file destroying any changes script1 has
made.
Maybe this is just an NT thing!
But I don't understand how flock protects file contents if it checks for a
lock AFTER the file has opened.
Any insights would be helpful.
Jerry Davis
www.bannerplus.com
------------------------------
Date: 06 Feb 1998 08:15:38 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Jerry Davis" <gedavis3@vt.edu>
Subject: Re: flocking questions!
Message-Id: <8cafc4ojc5.fsf@gadget.cscaper.com>
>>>>> "Jerry" == Jerry Davis <gedavis3@vt.edu> writes:
Jerry> So if script1 opens, flocks, then changes a file (BUT DOES NOT
Jerry> WRITE YET). Then script2 opens the file. tries to flock but is
Jerry> blocked.
Jerry> *The problem is script2 has the unmodified file loaded in
Jerry> memory, and when the flock breaks it will modify the file
Jerry> destroying any changes script1 has made.
Jerry> Maybe this is just an NT thing! But I don't understand how
Jerry> flock protects file contents if it checks for a lock AFTER the
Jerry> file has opened. Any insights would be helpful.
Dunno much NT (except as a complaint :-), but under Unix, it's a Very
Wise Idea to always seek() after getting a flock, even if it's just
seek(HANDLE,0,1) (move nowhere relative to pointer). The seek is
enough to tap STDIO on the shoulder and say "hey dude, get the data
from the *real* file, not from the in-memory buffer".
Maybe that'll help. Dunno.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 207 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 6 Feb 1998 15:43:32 +0000
From: AFL <sa346@city.ac.uk>
Subject: gethostbyaddr example please
Message-Id: <Pine.GSO.3.95q.980206154051.22549A-100000@highgate>
I'm trying to use gethostbyaddr() and am having real problems, I just
can't fathom-out what perl expects. Anyone got an example?
Please e-mail sa346@city.ac.uk
Thanks.
AFL
------------------------------
Date: Fri, 06 Feb 1998 14:26:35 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
To: richard.karon@ps.net
Subject: Re: Help - need telnet client in perl
Message-Id: <34DB017B.52BF@iil.intel.com>
Richard Karon wrote:
>
> Does anyone have a telnet client in perl that allows both interactive
> and batch modes?
perl -MCPAN -e shell
install Net::Telnet
see also the article about it in the last TPJ...(The Perl Journal)
______________________________________________________________________
Stas Bekman mailto:sbekman@iil.intel.com [just another webmaster]
Home Page: http://www.eprotect.com/stas
A must visit: http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home: http://www.linux.org.il/
------------------------------
Date: Fri, 06 Feb 1998 10:02:23 -0500
From: John Porter <jdporter@min.net>
Subject: Re: help stream lining script...
Message-Id: <34DB25FF.D8@min.net>
Fil Krohnengold wrote:
>
> An example "host entry" would look like this:
>
> somehost in a some.ip.addr.254
> in hinfo CPU os
> in txt "Location: 3-4-59-9"
> in txt "Dept: somedept"
> in txt "Workstation: someone"
>
> So what I'd want this script to do would be to identify a "host
> entry" tied to a particular dept (specified on command line) and then
> copy all of those entries into a new file.
I suggest ditching the tmpfile. You've got tons of ram, right? Use it.
I'll parse the input on "first character in line is alphanumeric".
undef $/;
my( $rec, $line );
for $rec ( split( /\n(?=\w)/, <> ) ) {
my %record; # needs to be a new thing in this scope
# because we save a ref to it below.
$record{text} = $rec;
my @lines = split( /\n\s*/, $rec );
$lines[0] =~ s/^(\w+)\s*//; # extract the hostname
$record{Hostname} = $1;
for $line ( @lines ) {
my( $in, $type, $arg ) = split( " ", $line, 3 );
next if $in ne 'in'; # wouldn't know what to do.
if ( $type eq 'a' ) {
$record{Addr} = $arg;
}
elsif ( $type eq 'hinfo' ) {
@record{'CPU','OS'} = split( " ", $arg, 2 );
}
elsif ( $type eq 'txt' ) {
$arg =~ s/^"(.*)"$/$1/; # remove dquotes
if ( $arg =~ /: / ) {
$record{$`} = $';
}
}
}
push( @records, \%record );
}
Now you've got an array of records; each record is a hash
with the following fields:
Addr
CPU
OS
Location
Dept
Workstation
text
Now you can do all kinds of things. To print only those
records which have a certain value of Dept:
for $r ( @records ) {
if ( $r->{Dept} eq $department ) {
print "$r->{text}\n";
}
}
You could also print any or all records sorted by, say,
Workstation:
for $r ( sort {
$a->{Workstation} cmp $b->{Workstation}
} @records ) {
print "$r->{text}\n";
}
Hth,
John Porter
------------------------------
Date: 5 Feb 1998 03:41:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: input file to hash
Message-Id: <6bbccn$btm$2@comdyn.comdyn.com.au>
In article <34D8CE1D.794B@mci.com>,
scott ranzal <scott.ranzal@mci.com> writes:
> I am trying to read a text file into a hash. I would like to use a
> substring from the file as the index. I am new to perl and am not sure
> how to pull out the substring as the index and then place the rest of
> the string into the hash as a value.
I am not sure what exactly you're trying to do. Have a look at the
substr function. as soon as you have some code, and still don't know
what to do, please ask again. Try to be a bit more specific though.
perldoc -f substr
perldoc perldoc
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: 6 Feb 1998 10:30:56 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <886761018.954023@cabal>
In <34d98baa.7120918@sd.znet.com> Abraxas@hell.com (Tiberius) writes:
>>"the answer to that question is in the documentation - which you should
>>have read before posting here"
>Well, exactly what *isn't* in the documentation?
The undocumented features?
I haven't found an efficency guide in the on-line docs.
I didn't find a warning that %hash = %tiedhash is a realy bad idear (found
that one out all by myself).
Eli's regxps.
Perl gods plonking you over spelling errors.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 06 Feb 1998 10:15:54 -0500
From: Scott Holmes <scotth@nyd2.com>
Subject: Is PerlIT good?
Message-Id: <34DB292A.741B@nyd2.com>
I'm having a lot of problems with Perl.exe processes hanging around in
memory on a server that's running NT 4.0 with Netscape Enterprise 2.0.
This definitely is not as a result of anything that the script(s) are
doing so I'm looking for another solution. Does anyone have any
experience with the Perlit NSAPI DLL
(http://www.sbusiness.com/sbus/perlit/Index.htm). If so, is it a good
fix for these kinds of problems?
Thanks.
------------------------------
Date: 5 Feb 1998 03:44:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: memory eating progs on win32 perl!
Message-Id: <6bbcjd$btm$4@comdyn.comdyn.com.au>
In article <34D8FE2E.3C419836@inrete.it>,
Guglielmo Alfieri <darklord@inrete.it> writes:
> I have a little, nice daemon that grows (mem space) from 700k to 17
> Mb.....:<<<
> on a NT system....Ideas ?
> Second I have another little, nice daemon that doesn't release the
> handles it gets...
Which version of perl? Are you sure your code is correct? It's sort of
hard for us to comment on your code if we don't know what it is. One
little thing: perl 5.0003 used to have some memory leaks. 5.004_04
solves those.
> I HATE NT.
Then why use it?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: Fri, 06 Feb 1998 09:12:01 -0600
From: Cam Bevis <cbevis@nsinet-nospam-.com>
Subject: netscape.hst regex
Message-Id: <34DB2841.16A6D012@nsinet-nospam-.com>
I'm trying to parse a netscape.hst file (about:global doesn't work since
the file is corrupted).
Its a 4 byte hex string (the date, captured to $1), followed by
"http://",
followed by the URL(captured to $2). I think I have a byte
ordering/hex->decimal->date conversion problem too,
but I'm not tackling that right now(any pointers would be welcomed,
though).
Here's (what seems to be) a record looks like:
>;d4http://www.databaseamerica.com/image/dba_anim.gif
...and here's the code I'm trying to use?
open HISTORY, "netscape.hst";
my $Data = <HISTORY>; # whole file as a single string
while( $Data =~m|(.{4})http://(.*)|igs)
{ $mytime= $1; $url= $2; $mytime=pack("H*", unpack("V*",
$mytime));$mytime=gmtime $mytime;print "$mytime $url \n"; }
Has anybody done this before, or can I get a shove in the right
direction?
TIA
--
Cam Bevis
Non-spammers remove -nospam- to respond
cbevis@nsinet-nospam-.com
------------------------------
Date: Fri, 06 Feb 1998 09:01:55 -0600
From: Andrew Connell <jconnell@lords.com>
Subject: Newbie needs rec. for PERL/CGI primer
Message-Id: <886776322.2100822024@dejanews.com>
I know nothing about PERL, but I am experienced with other laguages
(PASCAL,C++). I have tried to learn to use CGI with C++, but to no
success. I have decided that it must just be easier to learn PERL, what
looks like to be the Official CGI scipting language. I am looking for a
very good book that covers PERL (ie. Learn PERL in 3 Weeks) and gives
examples of howto handle CGI input (or even better, a URL that does the
same).
Additionally, I would like to find a URL that has a document comparing
PERL to another language (namely PASCAL or C++). When I was learning
C++, I found a rather large document on the web which every page of the
"book" was split in two. One side has PASCAL code and the other side had
the C++ equivalent. It really helped because since most languages use
the same basic structure with loops and defining variables; it was good
to see the difference in syntax.
Any responses would be greatly appreciated.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 6 Feb 1998 10:28:37 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Newbie needs rec. for PERL/CGI primer
Message-Id: <6bfa75$6as$1@stok.co.uk>
In article <886776322.2100822024@dejanews.com>,
Andrew Connell <jconnell@lords.com> wrote:
>I know nothing about PERL, but I am experienced with other laguages
>(PASCAL,C++). I have tried to learn to use CGI with C++, but to no
>success. I have decided that it must just be easier to learn PERL, what
>looks like to be the Official CGI scipting language. I am looking for a
>very good book that covers PERL (ie. Learn PERL in 3 Weeks) and gives
>examples of howto handle CGI input (or even better, a URL that does the
>same).
It's probably easiest to make sure you have a recent perl to work with
(e.g. 5.004_04) and get a book on learning perl (e.g. the second edition
of Learning Perl which is published by O'Reilly) and get comfortable with
perl's style of doing things.
If you have a recent perl then it cones with a module called CGI as
standard, and this takes a lot of the grief out of CGI programming in
perl. It's documented at
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
>Additionally, I would like to find a URL that has a document comparing
>PERL to another language (namely PASCAL or C++). When I was learning
>C++, I found a rather large document on the web which every page of the
>"book" was split in two. One side has PASCAL code and the other side had
>the C++ equivalent. It really helped because since most languages use
>the same basic structure with loops and defining variables; it was good
>to see the difference in syntax.
Learning Perl is a useful tutorial introduction to perl, if you're already
familiar with other languages then you might get through it faster. You
might want to look at http://www.oreilly.com/catalog/lperl2/
There are a number of CGI in perl faqs and documents about, browsing
http://www.perl.com is one way to start finding them, and brian d foy has
put together a cgi meta-faq at http://computerdog.com/CGI_MetaFAQ.html
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 6 Feb 1998 11:15:31 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: non-regex for potentially RFC-compliant email address (was Re: Quickie: regexp for valid e-mail addresses)
Message-Id: <886763694.197047@cabal>
In <19980205.221520.6B9.rnr.w164w_-_@locutus.ofB.ORG> Russell Schulz <Russell_Schulz@locutus.ofB.ORG> writes:
>abigail@fnx.com (Abigail) writes:
[...]
>> email address. Read RFC822 for details.
>this is not true, for the domain-part. and there should be at LEAST
>two characters after the `@', and almost always at least one `.'.
Nope
dformosa@st(look)nepean(no)uws(dots)edu(here)au
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 6 Feb 1998 15:42:40 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: perl pointer puzzle
Message-Id: <Enyrn4.D1D@world.std.com>
Damian Berger <dberger@uwyo.edu> writes:
>I am trying to do some pointer de-referencing, but can't get perl to
>de-reference correctly... here is the script that illustrates my
>problem.
> $temp{'var'} = "variable";
> $variable = "output_1";
> $reference = \$$temp{'var'}; #supposed to place the string "$variable"
>in $reference
> print $$reference . "\n"; #should print string "output_1"
> $temp = "variable_2";
> $variable_2 = "output_2";
> $reference_2 = \$$temp;
> print $$reference_2 . "\n"; #prints the string "output_2"
The first question, is there a reason to use the symbolic reference
"$temp{var} = 'variable'"? Look it over again. Symbolic references are
rarely necessary. (And getting your code to run under the "use strict"
pragma is a great help in making maintainable programs.)
You problem lies in the line where you dereference the symbolic
reference $temp{var} and then make a hard reference in which store in
"$reference".
"$$temp{var}" is the same as "${$temp}{var}", not "${$temp{var}}". The
scalar $temp is dereferenced and the (probably empty) hash it points
to is looked up for a key "var" which returns an the value undef and
then a reference is made of it.
Again, if you were using the "use strict" pragma, (and this was a hard
reference, since "use strict" prohibits symbolic references) this
would have been caught by perl. This is precisely the reason why "use
strict" prohibits symbolic references.
--
Andrew Langmead
------------------------------
Date: 6 Feb 1998 07:47:57 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Perl, Tcl and Expect?
Message-Id: <6bf7qt$p7i@flatland.dimensional.com>
Cerebus <stop@spamming.me> writes:
> Can anyone point me in the direction of any information on Expect
> for Perl? I'd like to use Perl, but I need to use Expect and from what
> I can gather that would necessitate my using Tcl (something I'd like
> to avoid if possible).
Net::Telnet might meet your needs. It's available on CPAN:
http://www.perl.com/CPAN/modules/by-module/Net/
The Winter 1997 issue (issue #8) of _The Perl Journal_ has an
article about Net::Telnet.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Fri, 6 Feb 1998 08:54:30 -0500
From: "Jerry Davis" <gedavis3@vt.edu>
Subject: Re: Random Image Generator
Message-Id: <6bf4oa$816$1@solaris.cc.vt.edu>
It is more work than you think, but here goes:
Your random image is called by: http://www.myname.com/cgi-bin/ranimage.pl
i.e. <img src = "http://www.myname.com/cgi-bin/ranimage.pl">
now you need to associate a link with the image. BUT the link will be
dynamic so that mean. . .
you got it another cgi script. example:
<a HREF=" http://www.myname.com/cgi-bin/link.pl" >
<img src = "http://www.myname.com/cgi-bin/ranimage.pl">
</a>
now the million dollar questions.
How when you call the link.pl script does it know which page to redirect to?
Well you can use cookies, but not everyone can or will accept cookies, so
the most backwards compatible way to do this would be.
INSIDE ranimage.pl
===============
randomly choose an image from your flat database.
open your ip-tracking file
append the user's ip, and the url that corresponds to the image selected to
ip-tracking.file
return the image
INSIDE link.pl
========================
open ip-tracking file
search till you match the users ip
read in url
redirect.
the only problem you will have is that the ip-tracking file will grow after
each image view and soon will become unwieldy. To solve that problem I
would also record the time when recording the ip and url
and when searching delete all ip records that are over 1 hour old.
Jerry Davis
www.bannerplus.com
cowboy@cnnw.net wrote in message <34da437f.139850795@news.cnnw.net>...
>Hello All,
>
>I'm wondering if someone out there can help me with a question...I'm
>new to perl/cgi and I have been playing with some small scripts....I
>have one that displays different images when someone opens my page or
>reloads.....what I want to know is how do I write the script for when
>a certain image is displayed on my page that it has a hyperlink within
>it....in my html it's written to point to the perl script < img src =
>"http://www.myname.com/cgi-bin/ranimage.pl" >this code opens the
>random image onto the page, what I'm trying to do is when this script
>is called that the image will have the link embedded into it also...
>...I hope I'm making sense and explaining this well enough to
>understand...if anyone out there can help me it would be greatly
>appreciated.
>
>James L. Taylor
------------------------------
Date: 5 Feb 1998 03:01:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: searching by file creation/modification date?
Message-Id: <6bba2t$bkc$1@comdyn.comdyn.com.au>
In article <6badrn$fdl$1@news.ml.com>,
mwang@alhena.ibk.ml.com (Michael Wang) writes:
>>You can find the modification date, but not the creation date.
>>Clay Irving <clay@panix.com> I think, therefore I am. I think?
>
> I do not think so.
> ls --help:
> ...
> --time=WORD show time as WORD instead of modification time:
> atime, access, use, ctime or status
Yes? What is your point? There still is no creation date in there.
Maybe you are referring to the ctime? That is not the creation time.
It's the time of the last change to the i-node, which in some cases is
equal to the creation time, but certainly not in most.
atime is time of last access, still not a creation time.
> What I do not know is under at what circumstances can access time be
> earlier than modification time?
When a file only gets opened for a write, not for a read.
# echo aaa > tempie
# perl -e '@stat = stat "tempie"; print "$stat[8] $stat[9]\n"'
886647386 886647386
# cat tempie
aaa
# perl -e '@stat = stat "tempie"; print "$stat[8] $stat[9]\n"'
886647400 886647386
# echo bbb > tempie
# perl -e '@stat = stat "tempie"; print "$stat[8] $stat[9]\n"'
886647400 886647406
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Fri, 06 Feb 1998 09:13:05 -0500
From: Jason Varsoke <jjv@caesun.msd.ray.com>
To: "Ramesh C. Pandey" <ramesht@netfxt.net>
Subject: Re: security problem
Message-Id: <34DB1A71.211A@caesun.msd.ray.com>
Ramesh C. Pandey wrote:
>
> Greeting,
> I am trying to create a restricted site. Can you suggest me some
> perl script which manipulate .htaccess and .htpassword file for user
> verification.
>
> Can I use msql tables for user verifiaction without any security problem
> I want to store users all information in these tables including
> password, accessable file and other details etc. Or do anyone have some
> interaface for .htaccess and .htpassword for msql.
>
> Suggest me something with security related.
>
> Thanks
> Ramesh
There is a program called RTaccess which manipulates teh .htaccess and
.htpassword files. contact DEM Solutions through jvarsoke@bigfoot.com
for more info.
------------------------------
Date: 06 Feb 1998 08:47:48 -0500
From: Tim Gray <tim@hcirisc.cs.binghamton.edu>
Subject: Suggestions for porting sybperl to activeware PerlScript?
Message-Id: <t0g1lw7sl7.fsf@hcirisc.cs.binghamton.edu>
I have a few CGI apps done in sybperl and I need to port them to
WinNT/IIS. Does anyone know of any sites that have tutorials or other
useful information about porting from UNIX to NT/IIS. Thanks.
Tim Gray
------------------------------
Date: 6 Feb 1998 06:08:45 GMT
From: Todd O'Boyle <oboyle@csociety.ecn.purdue.edu>
Subject: Re: The perl institute still alive ?
Message-Id: <6be9dd$o3n@mozo.cc.purdue.edu>
[ courtesy copy cc'ed to periat@ens.ascom.ch and posted ]
Periat Henri <periat@ens.ascom.ch> contributed:
> Does any body know if the perl institute is still alive ?
> since a long time i haven't heard anything from it. Months a go i
> send mails and got no response. And when ever i try to have a look
> at their home page, the browser keeps telling me: "server not reachable".
www.perl.org seems to be OK to me. You may want to try it again.
cheers,
-Todd
------------------------------
Date: Fri, 06 Feb 1998 09:08:22 -0500
From: John Porter <jdporter@min.net>
Subject: Re: unable to capture info. resulting from a system() call
Message-Id: <34DB1956.5585@min.net>
Bhanu P. Suravarapu wrote:
>
> $result
> =~(system("/local/marsh/Isite-1.08/Isearch/Isearch-cgi/isrch_srch
> /home/swamp1/raghavan/bps8527/MOM/MOMspider-1.00/index"));
There's an easy answer to your question; but first: why are you
using '=~' ??? Do you know what this does? I think you want
plain old '=', for assignment.
When you run an external process with system() or exec(), that
process inherits your stdin and stdout. I.e., wherever the
stdout of the calling program goes, that's where the stdout of
the child process goes. If you want to change the "connection"
of stdout only or stdin only, you can use a pipe, via the open()
function:
open(P,"| otherprog") || die...
# now, when you write to P, the other program can read
# that data in its stdin.
open(P,"otherprog |") || die...
# now, whatever the other program writes to its stdout,
# you can read via <P>.
# in your case, this is what you want.
There is a shorthand for the second form, using backticks.
It wraps up the open, the read, and the close; and evaluates
to the output of the other program:
$result = `otherprog`; # note the backticks
All this info is in the documentation, by the way.
hth,
John Porter
------------------------------
Date: Fri, 06 Feb 1998 12:46:09 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: White Hats and Black
Message-Id: <34dc05f7.3488726@news.tornado.be>
Tom Christiansen <tchrist@mox.perl.com> wrote:
[ a nice article about Netscape donating it's browser code to the world.
It's a nice read. If your newsread doesn't carray it any more, find it
at http://www.perl.com/perl/versus/hats.html ]
Let me speculate on what it means. Why would Netscape free the source?
I think it's a statement. A statement that you can't compete with
Microsoft. No matter how good your product is, no matter if you
initially have the monopoly for the world, once Microsoft smells the
possibility, it will hunt you down.They will copy the functionality of
your product, improve on it in some parts, and market it for a similar
(or preferably cheaper) price. Until YOU give up. Or go bust.
Looks what's happened to Novell, Borland, Lotus, WordPerfect, maybe even
Unix. Once, they had it all. They ruled the world. Now, Microsoft owns
the world, in what once was their speciality.
M$ even employ dirty tricks, like encorporating Internet Explorer into
Win95, and claim that it can't be removed from the OS. While it can.
So, this is Netscape's statement: when up against Microsoft, you just
can't win.
Unless when it's free. Perl stands pretty strong against M$'s offerings,
so does Apache (web server). Let the world know:
The best things in life are free.
Even software.
"Free the web".
Bart.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1822
**************************************