[7598] in Perl-Users-Digest
Perl-Users Digest, Issue: 1224 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 24 12:17:25 1997
Date: Fri, 24 Oct 97 09:00:34 -0700
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, 24 Oct 1997 Volume: 8 Number: 1224
Today's topics:
Re: Can perl be maken to Compiler instead of interprete (Chris Russo)
Re: context (M.J.T. Guy)
Displaying X-based applications? <sakalauk@coam.usm.edu>
Re: Displaying X-based applications? (Christopher Gray)
finding a unique element in an array <mystery@itis.com>
Re: finding a unique element in an array (Mike Stok)
Re: Hashed ref. to filehandle generates a warning (?) (Andrew M. Langmead)
Re: Is there/will there be a decent way to do constants <zenin@best.com>
Re: Is there/will there be a decent way to do constants <seay@absyss.fr>
Re: Learning Perl... best way? (dave)
Re: Move specified number of variables into one array?? <schweize@ttc.thyssen.de>
NetAdmin::UserGetAttributes() <wjs12@cornell.edu>
Re: Perl subroutine parameter strangeness... <cmargoli@world.northgrum.com>
Re: replacing quotes with help of a regexp? <eike.grote@theo.phy.uni-bayreuth.de>
Re: Safe.pm and making eval safe (Andrew M. Langmead)
SendHeaders() <nicky@webgenie.co.uk>
Re: sending a short file? (Burt Lewis)
Re: Time-Date string / epoch seconds conversion (Clay Irving)
Re: WWW::Search and AltaVista (John Heidemann)
Re: Year 2000 for GNU-Perl5 (John Moreno)
Re: Year2000 problem with localtime(); (Jeffrey R. Drumm)
Re: Year2000 problem with localtime(); (John Moreno)
Re: Year2000 problem with localtime(); <nicky@webgenie.co.uk>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 24 Oct 1997 07:40:39 -0700
From: news@russo.org (Chris Russo)
Subject: Re: Can perl be maken to Compiler instead of interpreter?
Message-Id: <news-2410970740390001@buzz.alink.net>
>> Also, I note that ask for something with a .pl suffix. .pl is, for the
>> most part, ancient history. .pl was for perl library files which have
>> been replaced by perl module (.pm) files. Are you using perl4 perhaps?
>> Use "perl -v" to find out what version you use.
Perl scripts normally in end ".pl". Modules (libraries) normally end in ".pm".
Regards,
Chris Russo
--
Chris Russo A-Link Network Services, Inc.
news@russo.org Bolo me
http://www.alink.net/~crusso
------------------------------
Date: 24 Oct 1997 15:38:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: context
Message-Id: <62qfct$jlq$1@lyra.csx.cam.ac.uk>
Honza Pazdziora <adelton@fi.muni.cz> wrote:
>dsiebert@gate.net (David Siebert) writes:
>
>> I have looked in all my books and have not been able to find an xample of how
>> to force a var into a string context. Help please
>
>$result = $var . '';
Or more elegantly
$result = "$var";
But the circumstances where you need this sort of forcing are extremely
rare. Perl usually does it for you.
Mike Guy
------------------------------
Date: Fri, 24 Oct 1997 10:04:50 -0500
From: Peter Sakalaukus <sakalauk@coam.usm.edu>
Subject: Displaying X-based applications?
Message-Id: <3450B911.2781E494@coam.usm.edu>
I have created a user interface using Apache/Perl/Netscape. One of the
user selections subsequently pops up an xterm, (which is running on the
same machine as the server). This works fine if I am using the browser
interface on the same machine that the Apache server is running on. The
problem arises when I access the web pages from another machine. I am
unable to pop up the xterm or any other x/motif program.
Does anyone know wether it is a server/browser/perl problem? Is there
a fix?
Thanks in advance ...Pete
sakalauk@coam.usm.edu
------------------------------
Date: 24 Oct 1997 15:17:38 GMT
From: grayc@btm0qt.btm0qt.se.bel.alcatel.be (Christopher Gray)
Subject: Re: Displaying X-based applications?
Message-Id: <GRAYC.97Oct24171738@btm0qt.btm0qt.se.bel.alcatel.be>
Your X server will only allow remote hosts to open a window on your workstation
if you tell it to, e.g. using
% xauth +www.coam.usm.edu
(or if you're in a devil-may-care mood, just use xauth +).
This is just as well, otherwise we'd have savetrees.com opening windows on
out workstaion all the time ... 8-0
--
Chris Gray
------------------------------
Date: Fri, 24 Oct 1997 08:17:07 -0400
From: Prince Mystery <mystery@itis.com>
Subject: finding a unique element in an array
Message-Id: <345091C3.76D95E1@itis.com>
Hi all.
Tom Christiansen wrote a nice piece on this problem in the Perl FAQ.
His suggestion for string elements was to key them to a hash where their
values would equal 1. This would naturally make any duplicates
overwrite each other, and give a nice way of accessing each element.
I had an idea, and wondered if this was a faster method, or even just a
nicer one. If it's slower, and prone to error, I'll change back to
Tom's method. (Please understand that in my situation, the values of
the string are much more constant than those shown here, and won't ever
include an regexp special characters).
@array = ("tom", "dick", "harry");
$string = join(' ',@array);
if($string =~ /tom/) { print "tom is in this array\n"; }
Thanks for the help.
Myst
--
Version: 2.6.2
owEBiAB3/4kAdQMFADPY9d1hGXgCUdEssQEBvREDAJodjyXMMZnOxrzl6Z5Anldh
p/mCNLshfYr/aLB+vmR2CrdySGCqBZFg+GanInyn/Vg6oRNoLgM/sU5+sbYntGt1
nI2B8/PZIDxOTA3S6BktLawONN/RGcqjPhDPm8l636wOYgh0ZXh0ZmlsZQAAAAA=
=beaq
-----END PGP MESSAGE-----
------------------------------
Date: 24 Oct 1997 14:11:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: finding a unique element in an array
Message-Id: <62qaa3$ake@news-central.tiac.net>
In article <345091C3.76D95E1@itis.com>,
Prince Mystery <mystery@itis.com> wrote:
>Tom Christiansen wrote a nice piece on this problem in the Perl FAQ.
>His suggestion for string elements was to key them to a hash where their
>values would equal 1. This would naturally make any duplicates
>overwrite each other, and give a nice way of accessing each element.
>
>I had an idea, and wondered if this was a faster method, or even just a
>nicer one. If it's slower, and prone to error, I'll change back to
>Tom's method. (Please understand that in my situation, the values of
>the string are much more constant than those shown here, and won't ever
>include an regexp special characters).
>
>@array = ("tom", "dick", "harry");
>$string = join(' ',@array);
>if($string =~ /tom/) { print "tom is in this array\n"; }
You could use index rather than a regex if you liked just in case a
metacharacter slipped in (although a regex can reputedly use rare
characters to speed itself up,) and if @array contained 'randall' you
would "find" 'randal' in there too, so you could join the words with ' '
and have a space at each end and look for ' randal ' if you really want to
use a string search - a simple linear search takes longer as the string
gets longer whereas the hash uses a hash value to just search a list of
keys with the same hash value. The hash method seems easier to use to me,
you can use naming to make your intentions clear e.g.
@nameList = qw/Larry Tom Randal/;
%inNameList = map {$_ => 1} @nameList;
...
if ($inNameList{$name}) {
...
}
In general I would use the Benchmark module to determine whether my
guesses about which goes faster are right or not, and see how critical the
code speed really is...
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@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Fri, 24 Oct 1997 14:35:34 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Hashed ref. to filehandle generates a warning (?)
Message-Id: <EIK8JA.EGA@world.std.com>
nospam@domain.com writes:
>print ${ $HandleList{$first} } "Howdy\n";
Try:
print { $HandleList{$first} } "Howdy\n";
>From the perlfunc documentation:
=item print FILEHANDLE LIST
=item print LIST
=item print
Prints a string or a comma-separated list of strings. Returns TRUE if
successful. FILEHANDLE may be a scalar variable name, in which case
the variable contains the name of or a reference to the filehandle,
thus introducing one level of indirection.
[stuff deleted]
Note that if you're storing FILEHANDLES in an array or other expression,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
you will have to use a block returning its value instead:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print { $files[$i] } "stuff\n";
print { $OK ? STDOUT : STDERR } "stuff\n";
--
Andrew Langmead
------------------------------
Date: 24 Oct 1997 12:02:58 GMT
From: Zenin <zenin@best.com>
Subject: Re: Is there/will there be a decent way to do constants in perl?
Message-Id: <62q2pi$prp$1@nntp2.ba.best.com>
Doug Seay <seay@absyss.fr> wrote:
>snip<
> I will agree that not being able to put a constant in a double quoted
> string and have it expand could be a problem, but I don't consider that
> to be a big deal. You can't make function calls from inside a double
> quoted string either.
use constant FOO => 'foo';
print "This is @{[ FOO ]}\n";
print "And the current time is @{[ scalar localtime(time) ]}. Cool hey?\n";
print "If it was hard to write, dammit it should be hard to read!\n";
--
-Zenin (zenin@best.com)
The Bawdy Caste (San Jose, CA) http://www.netmagic.net/~dmcgrath/bawdy/
Barely Legal (Berzerkly, CA) http://www.barelylegal.org/
Zenin's Rocky Archive (Moving soon!) http://www.best.com/~zenin/
------------------------------
Date: Fri, 24 Oct 1997 17:58:55 +0200
From: Doug Seay <seay@absyss.fr>
To: Zenin <zenin@best.com>
Subject: Re: Is there/will there be a decent way to do constants in perl?
Message-Id: <3450C5BF.513F304E@absyss.fr>
Zenin wrote:
>
> use constant FOO => 'foo';
> print "This is @{[ FOO ]}\n";
> print "And the current time is @{[ scalar localtime(time) ]}. Cool hey?\n";
>
> print "If it was hard to write, dammit it should be hard to read!\n";
Zenin,
You are evil. But I like it.
- doug
------------------------------
Date: Fri, 24 Oct 1997 11:39:28 GMT
From: over@the.net (dave)
Subject: Re: Learning Perl... best way?
Message-Id: <34508861.1256629@news.one.net>
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>In article <877506644.27322.0.nnrp-01.9e98f2d6@news.demon.co.uk>,
> "Lee Davies" <lee.davies@NOSPAMmicrotest.co.uk> writes:
>> So... any recommendations on the best way to learn Perl? My background is
>> in Unix programming using C, C++ and shell scripting so I'm fairly ok with
>> the Perl scripts I have looked at so far, I just need some guidance...
>
>Is there a reason that you need to learn perl?
I still remember the first sentence on the first page of Programming Perl.
I've found it to be true when compared to C or shell scripting.
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: Fri, 24 Oct 1997 15:09:32 +0100
From: Torsten Schweizer <schweize@ttc.thyssen.de>
To: Michael.Bach@kst.siemens.de
Subject: Re: Move specified number of variables into one array???
Message-Id: <3450AC1C.4BE7B9ED@ttc.thyssen.de>
Michael Bach wrote:
> Hi there...
>
> I have the following problem:
>
> 1) I get a certain number of arguments from a HTML-form via CGI.pm
> 2) I know the number of arguments
> 3) I do a loop to work on each of the arguments using the number of
> arguments
>
> ... this is where my problem comes in... I guess it's probably sheer
> stupidity:
>
> I would like to do something like this:
>
> while ( $bla != $numberOfArguments) {
> do something with @argument[$bla] ;
> $bla++;
> }
>
> The problem is that I get variables $argument1 - $argumentn and can't
> seem to figure out how to get all those single variable into one
> array... constructs like $argument$bla don't seem to work.
>
> Help would be appreciated!
>
> Regards from Germany
> Mike
just say
while ( $bla != $numberOfArguments) {
do something with @argument[$bla] ;
@SOMEARRAY[$bla]=@argument[$bla];
$bla++;
}
Regards from Germany
Torsten
------------------------------
Date: Thu, 23 Oct 1997 15:45:05 -0400
From: Bill Stysiack <wjs12@cornell.edu>
Subject: NetAdmin::UserGetAttributes()
Message-Id: <344FA941.CE62820C@cornell.edu>
I'm trying to use Win32::NetAdmin::UserGetAttributes() to get a user's
password. (This by the ways is taken out of the online documentation for
Win32 modules).
$userName = ....
.....
Win32::NetAdmin::UserGetAttributes('',$userName,
$Getpassword,
$GetpasswordAge,
$Getprivilege,
$GethomeDir,
$Getcomment,
$Getflags,
$Getscriptpath) || warn();
But the $Getpassword variable always comes back blank. Why? I'm logged
in as the Administrator, so I don't think it's a security issue....
Thanks,
Carey
------------------------------
Date: Fri, 24 Oct 1997 15:06:16 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: Perl subroutine parameter strangeness...
Message-Id: <3450B968.5188@world.northgrum.com>
Pierre Fortin wrote:
>
> OK, I admit being a relative newbie to Perl... (I'm trying to move over
> from Rexx); but, I'm puzzled by the following:
>
> some_function(,,2);
>
> is not allowed (syntax error). Yet:
>
> some_function(0,,2)
>
> is allowed; but some_function() gets:
>
> ($first,$second,$third) = @_; # same as $_[0], $_[1], $_[2]
> # giving: $first = 0; $second = 2; $third = <undef>;
>
> Is there not a way to pass empty parameters to a function without either
> a syntax error or having them shifted? Or, is this an insurmountable
> syntax/language restriction? And no, I really would not like to have to
> do:
>
> some_function(undef,undef,2);
"It's not a bug, it's a feature." The Blue Camel book says:
You may place an optional comma at the end of any list value.
This makes it easy to come back later and add more elements.
@numbers = (
1,
2,
3,
);
So what you propose could break existing code. I suppose it would
be consistent for Perl to treat your first example
some_function(,,2);
as legal and pass 2 as the first parameter.
It looks like you are stuck using undef as a placeholder.
--
Charles G. Margolin DSSD Internal Information Services
cmargoli@world.northgrum.com Northrop Grumman Corp. 0624/23
margolin@acm.org Hawthorne, California 90250-3277
------------------------------
Date: Fri, 24 Oct 1997 13:39:06 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: replacing quotes with help of a regexp?
Message-Id: <345088DA.1CFB@theo.phy.uni-bayreuth.de>
Hi,
Calle ]sman wrote:
>
> I want to search and replace some blocks of text. The blocks of text contains
> a bunch of <>".?
> I thought it would do by using '' around the text like:
>
> $lines[$cnt++] =~ s/'src="pics/sm_feed2.gif" vspace=2><br>'/a/g;
^ ^ ^
(1) (2) (1)
Two problems here:
(1) Single quotes ('') don't protect special characters from being
interpreted as regexp specials. They will even cause trouble
because they are part of the search pattern (which won't ever
match in your case, I suppose). What you want instead is this:
... =~ s/\Q...\E/.../g;
^^ ^^
(2) Even if you use \Q...\E one problem remains: the slash is
being considered a delimiter. To avoid this you might either
escape it
...pics\/sm_feed...
^^
or use different delimiters
... =~ s|...|...|g;
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Fri, 24 Oct 1997 14:28:44 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Safe.pm and making eval safe
Message-Id: <EIK87x.9tz@world.std.com>
Philippe de Rochambeau <pr1@club-internet.fr> writes:
>The text file looks like this :
>Halogen\tLouis-XVI\t30\n
>...
>The Perl code that I have written stores the contents of the form in
>scalars, reads in each record in the file, puts the values into scalars
>($mytype, $mystyle, $myheight) and does the following eval:
>$evalString = (($mytype eq $type) && ($mystyle eq $style) && ($myheight
>$opHeight $height));
That isn't a string, that's (almost, except for one syntax error) an
expression. A string would be like this:
$evalString = "((\$mytype eq \$type) && (\$mystyle eq \$style) && (\$myheight
$opHeight \$height))";
or
$evalString = qq/(('$mytype' eq '$type') && ('$mystyle' eq '$style') &&
($myheight $opHeight $height))/;
Depending on whether you want the variables evaluated inside or outside
the eval. (run both in the debugger and see the difference.
># For example, the user is looking for Louis XIV halogen lamps whose
>height is > 10 inches. We must therefore find
># records where (("halogen" eq "halogen") && ("Louis-XVI" et
>"Louis-XVI") && (11 or 12 or ... > 10))
># is $evalString true?
>if ($evalString) {
and here, you actually have to call eval:
if( eval $evalString ) {
# matches, put the record into the array.
}
>The problem with this eval is that it is unsafe (according to authors of
>books on CGI scripting with Perl and the -T switch).
>How can I make it safe? By using the Safe module? How would you, in this
>case, use the Safe module (the Safe documentation is not very clear).
eval is unsafe it it is given user input without being checked. Which
isn't the same as it being unsafe. The string that you pass to eval is
passed to the perl compiler and executed, just like it was a little
perl program. The danger with eval is if someone gives you a value of
type that contains something like (for the second version of
$evalString I gave you)
$type = q['));unlink chomp(`find / -print`);(('1];
Because that would turn the little perl program that eval executes
something like:
$evalString = q!(('Louis X1V' eq ''));
unlink chomp(`find / -print`);
(('1') && ('Halogen' eq 'Halogen')
&& (10 > 12))!;
So one thing tat you could do is just ensure that the user input
contains only the characters you expect. For example is $type should
only have alphanumerics or whitespace characters, then say:
$type =~ /^([\w\s])$/;
unless defined($1) {
print '<H1>Please, type a valid lamp type</H1>';
exit;
}
else {
$type = $1;
}
I'm not saying that using Safe.pm is a bad idea. Anything that can be
done to improve security is an important consideration. You just need
to have a very clear idea of what you are protecting yourself
against. I hate to say it, but if you are unsure about why you might
want to use the safe module vs. untainting the data, you probably
shouldn't be doing either.
So OK, here is an example using the Safe module anyway.
use Safe;
my $compartment = new Safe;
# do all the stuff to collect $type, $type, $height, etc.
# and then stuff it into $evalString
if($compartment->reval($evalString)) {
# put the record into the array.
}
else {
# tell the user that they did something wrong.
}
I have one other thing to point out, though. From what I can see, you
don't even need any sort of eval (Safe or core) at all. The only thing
that is really determined at runtime is the comparison on $height and
$myheight. You could make a hash of subroutines that perform the
various comparisons, and just call the appropriate one.
%height_comparisons = ( '>' => sub { $_[0] > $_[1] },
'<' => sub { $_[0] < $_[1] },
'==' => sub { $_[0] == $_[1] },
'near' => sub { abs($_[0] - $_[1]) < 5 }
);
# collect $height, $style, etc.
# collect the data for the current records, $myheight, $mystyle, etc.
die "height comparision is not one of the predefined types\n"
unless exists $height_comparisons{$opHeight};
if( $mytype eq $type and $mystyle eq $style and
&{$height_comparisons{$opHeight}}($myheight,$height) ) {
# matches, add this record to array
}
--
Andrew Langmead
------------------------------
Date: Fri, 24 Oct 1997 16:13:44 +0100
From: Nick Jones <nicky@webgenie.co.uk>
Subject: SendHeaders()
Message-Id: <3450BB28.421@webgenie.co.uk>
Hi,
I'm trying to port a Perl program to my new server. It's falling over
because it can't find an external routine called "SendHeaders()". Has
anyone heard of it? I've grepped through my current wwwlib (version
5.10) and can't find it. Please copy email to me at nick@namecity.com if
you can help.
Thanks in advance.
Nick
--
nick@spam.namecity.com
(please remove "spam" to reply)
------------------------------
Date: 24 Oct 1997 12:19:57 GMT
From: burt@ici.net (Burt Lewis)
Subject: Re: sending a short file?
Message-Id: <62q3pd$fqu$1@bashir.ici.net>
Becker,
All this can be done in Perl.
You would simply write your input variable to a file on the server.
FTP or TELNET would not be required providing you have the ability to write
CGI programs on your server.
Burt
In article <62oi4a$q7r$1@news.smart.net>, becker@smart.net says...
>
>Hello perl world,
>
> I'm trying to devise the easy/best way to accomplish this perhaps some
>of you can hint me. I have a set of Javascripts which do a bunch of
>HTML page layout and creates a dynamic form. At the point where the user
>clicks a SUBMIT button I need to gather all of the fields on this form and
>put it on a flat file on a server thru ftp would be guess... What's the
>best approach for this??
> o I thought about a perl script to start an ftp session but I don't
>have a file to put..since they come from memory
> o Do I have to get down to the sockets to do this?
> o A telnet session that appends lines to a file and closes once my pipe
>is finished??
>
> Any ideas/hint appreciated
>
> Becker Cuellar
>
------------------------------
Date: 24 Oct 1997 09:32:39 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Time-Date string / epoch seconds conversion
Message-Id: <62q81n$9p1@panix.com>
In <reyb3k734w.fsf@eyrie.graphics.cornell.edu> jwd@graphics.cornell.edu (James W. Durkin) writes:
>I have time/date strings (in Unix 'date' format) stored in a file that
>I need to read in, convert to epoch seconds for some manipulation
>(can't get away from that part), and write back out as new time/date
>strings. A quick look through CPAN shows a handful of modules that
>would help somewhat, but none with methods that quite to the trick.
>Any suggestions?
Date::Parse will convert an ASCII string representation of time to epoch
seconds. For example:
#!/usr/local/bin/perl -w
use Date::Parse;
$then = "Jan 1 2000 00:00";
$seconds_until_then = str2time($then); # convert to UNIX time value
$now = time; # express as UNIX time value
$seconds_left = $seconds_until_then - $now;
print "Only $seconds_left seconds until the year 2000.\n";
Date::Manip may make like easier for you, though...
--
Clay Irving <clay@panix.com> http://www.panix.com/~clay/
------------------------------
Date: 23 Oct 1997 20:35:54 -0700
From: johnh@dash.isi.edu (John Heidemann)
Subject: Re: WWW::Search and AltaVista
Message-Id: <johnh.877664116@dash.isi.edu>
On 22 Oct 1997 08:40:52 GMT, Kou Sato wrote:
> Hello. I have a question about WWW::Search and AltaVista.
>
> With a program like the following one, I could get almost
>all of the links found by AltaVista until at least last Apr.
>
>...
>
>
>But after AltaVist changed its interface(?) and I updated
>WWW::Search, I only get the first 10 links. Can anybody
>tell me why this happend and how to solve the problem?
>Thank you.
It's a constant struggle to keep WWW::Search's back-ends matching web
servers. The currently released verson of WWW::Search's AltaVista
back-end doesn't handle advancd queries (the "aq" option you have)
that span multiple pages.
I've fixed that bug in my code. I expect to do the next release this
weekend. As a work-around you should stick to simple queries until
then.
You'll be happy to know that the next release will also include a test
suite so that search engine changes can be more reliably diagnosed.
Finally, I would usually suggest doing:
my($search) = new WWW::Search('AltaVista::AdvanceWeb')
instead of
my($search) = new WWW::Search('AltaVista');
$query_opt_ref->{"pg"} = WWW::Search::escape_query("aq");
-John Heidemann
USC/ISI
------------------------------
Date: Fri, 24 Oct 1997 09:56:06 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: Year 2000 for GNU-Perl5
Message-Id: <1997102408165218191950N@roxboro-186.interpath.net>
Doug Seay <seay@absyss.fr> wrote:
] John Moreno wrote:
] >
] > Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:
] > ] However, if you code properly, your programs will not break. The
] > ] only gotcha in Perl is that many of the time/date functions return
] > ] the century - 1900. Simply adding 1900 yields a 4-digit date.
] >
] > What time/date functions are that? I'm only aware of $^T and time -
] > and I believe that they number it returns is platform dependent. On
] > the Mac it is the number of seconds since 01/01/1904.
]
] localtime() and gmtime() return the year-1900. Here's the scoop on
] localtime. It doesn't mention being Mac specific like time().
Thanks, I've found 'em now.
] ~> perldoc -f localtime
] =item localtime EXPR
]
] Converts a time as returned by the time function to a 9-element array
] with the time analyzed for the local time zone. Typically used as
] follows:
]
] # 0 1 2 3 4 5 6 7 8
] ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
] localtime(time);
]
] All array elements are numeric, and come straight out of a struct tm.
] In particular this means that $mon has the range 0..11 and $wday has
] the range 0..6 with sunday as day 0. Also, $year is the number of
] years since 1900, that is, $year is 123 in year 2023.
]
] If EXPR is omitted, uses the current time (C<localtime(time)>).
]
] In a scalar context, returns the ctime(3) value:
]
] $now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
And I just got through writing a script that creates the values 0-7 (at
least for 1997 - I hadn't thought of a way to make the day of the week
generic [but I did while writing this!]), but that's OK, I was mainly
doing it to learn. I don't have a single script that uses the time or
the date.
--
John Moreno
------------------------------
Date: Fri, 24 Oct 1997 12:12:07 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Year2000 problem with localtime();
Message-Id: <34508d18.683870643@news.mmc.org>
On Fri, 24 Oct 1997 11:54:36 +0100, Peter Meighan <pmeigh01@cork.cig.mot.com>
wrote, apparently without bothering to check his documentation:
>Hi y'all,
> Of the values returned by localtime, the $year value is coming out
>as '97'. Is there a plan to change this to `1997`? It's something that
>could cause *major* problems, don't you think?
Only if you don't add 1900 to the year . . .
You apparently had to read the documentation a *little bit* to determine the
structure returned by localtime() . . . why did you stop there? The very next
paragraph had the answer to your question.
To wit:
"All array elements are numeric, and come straight out of a struct tm.
In particular this means that $mon has the range 0..11 and $wday has
the range 0..6 with sunday as day 0. Also, $year is the number of
years since 1900, that is, $year is 123 in year 2023."
Since it comes out of a struct tm, I doubt it'll be changed . . . it ain't
broke. Well, until 2038, anyway . . . cuz then most current Unix
implementations get pretty broke as far as dates are concerned.
$ perldoc -f localtime
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
420 Cumberland Ave, Portland, Maine 04101
Voice: 207-871-2150 Fax: 207-871-6501 Email: drummj@mail.mmc.org
------------------------------
Date: Fri, 24 Oct 1997 10:22:15 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: Year2000 problem with localtime();
Message-Id: <1997102409384421145940N@roxboro-183.interpath.net>
Peter Meighan <pmeigh01@cork.cig.mot.com> wrote:
] Hi y'all,
] Of the values returned by localtime, the $year value is coming out
] as '97'. Is there a plan to change this to `1997`? It's something that
] could cause *major* problems, don't you think?
Let's see if I can be the first to tell you NO.
$year is a number representing the number of years since 1900, next time
try setting your system forward a couple of years and see what the
result is. In 2001, $year==101.
This seems to be the week for silly Y2C questions - somebody asked in
comp.sys.mac.programmer.codewarrior if codewarrior (mac/pc compiler/ide)
was complaint, and when told that the Y2P wasn't applicable didn't
consider that sufficient and wanted a specific statement saying it was
Y2C.
Can anybody come up with a way that a compiler or a compiler portion of
a IDE could have the Y2P? Not the libraries, or the code generated, but
the compiler itself. Now "make" could have a problem - not likely but
possible, you'd have to want to make it a problem when writing it, but
it's possible.
--
John Moreno
------------------------------
Date: Fri, 24 Oct 1997 16:16:04 +0100
From: Nick Jones <nicky@webgenie.co.uk>
Subject: Re: Year2000 problem with localtime();
Message-Id: <3450BBB4.5CE2@webgenie.co.uk>
Jeffrey R. Drumm wrote:
>
> On Fri, 24 Oct 1997 11:54:36 +0100, Peter Meighan <pmeigh01@cork.cig.mot.com>
> wrote, apparently without bothering to check his documentation:
>
> >Hi y'all,
> > Of the values returned by localtime, the $year value is coming out
> >as '97'. Is there a plan to change this to `1997`? It's something that
> >could cause *major* problems, don't you think?
>
> Only if you don't add 1900 to the year . . .
>
> You apparently had to read the documentation a *little bit* to determine the
> structure returned by localtime() . . . why did you stop there? The very next
> paragraph had the answer to your question.
>
> To wit:
>
> "All array elements are numeric, and come straight out of a struct tm.
> In particular this means that $mon has the range 0..11 and $wday has
> the range 0..6 with sunday as day 0. Also, $year is the number of
> years since 1900, that is, $year is 123 in year 2023."
>
> Since it comes out of a struct tm, I doubt it'll be changed . . . it ain't
> broke. Well, until 2038, anyway . . . cuz then most current Unix
> implementations get pretty broke as far as dates are concerned.
>
> $ perldoc -f localtime
>
> --
> Jeffrey R. Drumm, Systems Integration Specialist
> Maine Medical Center - Medical Information Systems Group
> 420 Cumberland Ave, Portland, Maine 04101
> Voice: 207-871-2150 Fax: 207-871-6501 Email: drummj@mail.mmc.org
oh err. this was a bit catty wasn't it?
--
------------------------------
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 1224
**************************************