[30943] in Perl-Users-Digest
Perl-Users Digest, Issue: 2188 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 6 18:09:52 2009
Date: Fri, 6 Feb 2009 15:09:12 -0800 (PST)
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 2009 Volume: 11 Number: 2188
Today's topics:
automating a perl installation on a cluster (or using n <nospam@nospam.invalid>
Re: automating a perl installation on a cluster (or usi <tim@burlyhost.com>
Re: error printing page using LWP::Simple <peter@makholm.net>
Re: error printing page using LWP::Simple <tadmc@seesig.invalid>
Re: error printing page using LWP::Simple <zen13097@zen.co.uk>
Re: error printing page using LWP::Simple <tim@burlyhost.com>
Re: error printing page using LWP::Simple <tim@burlyhost.com>
Re: error printing page using LWP::Simple <tim@burlyhost.com>
Re: error printing page using LWP::Simple <larry@example.invalid>
Re: error printing page using LWP::Simple <larry@example.invalid>
Re: error printing page using LWP::Simple <tim@burlyhost.com>
Re: error printing page using LWP::Simple <tim@burlyhost.com>
Re: error printing page using LWP::Simple <tadmc@seesig.invalid>
Re: error printing page using LWP::Simple <tadmc@seesig.invalid>
Re: File handle to "in memory" file <zentara@highstream.net>
Re: File handle to "in memory" file <ben@morrow.me.uk>
Re: File handle to "in memory" file <uri@stemsystems.com>
Re: NVHOST Website Design & Custom Programming Supports <tadmc@seesig.invalid>
Re: Perl Peeves <baxter.brad@gmail.com>
Re: programming by evolution? <pc@p-cos.net>
Re: XXXXX Website Design & Custom Programming Supports <rabbits77@my-deja.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 6 Feb 2009 21:50:37 +0000 (UTC)
From: Rahul <nospam@nospam.invalid>
Subject: automating a perl installation on a cluster (or using non-standard nfs paths)
Message-Id: <Xns9BAAA127CE56650A1FC0D7811DDBC81@85.214.105.209>
I am configure a perl code (check_lm_sensors; a nagios plugin) so that I
can eventually roll it out on 200+ servers we have in our computer
cluster. The problem is that there are several dependancies. eg. the CPAN
modules Nagios::Plugin, Class::Accessor, Config::Tiny, version.
I already have one machine running where I used "perl -MCPAN -e 'install
Math::Calc::Units'" etc. for each dependancy that the original code
complained about. What's a better way of doing this so that I can
automate the process?
My approach:
All the nodes have a common nfs mounter directory too (/usr/local/) so I
thought of doing manual compiles once to this non-standard location by
using " perl Makefile.PL PREFIX=/usr/local/lib/perl; make; make test;
make install"
Unfortunately then the next programs down the line don't seem to find the
modules they need where they expect to find them. eg.
######error########
Can't locate Math/Calc/Units/Convert.pm in @INC (@INC contains:
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib64/perl5/site_perl/5.8.7/x86_64-linu
#########################
I tried " setenv PERL5LIB /usr/local/lib/perl" but many modules seem to
be installed deep down this heirarchy. PERL5LIB based searches do not
seem recursive?
Example: /usr/lib/perl5/site_perl/5.8.8/Math/Calc/Units/Convert.pm
So my $PERL5LIB does not help much unless I were to set each deep
location in there. Besides, when I manually browsed I find non-perl-
module files like "Grammar.y" that I am not sure if I need copied or not.
What's the best way to handle these twin related problems: (1) Automating
a multi-dependancy perl install to many servers (2) using non-standard
paths.
Any advice?
--
Rahul
------------------------------
Date: Fri, 06 Feb 2009 14:32:49 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: automating a perl installation on a cluster (or using non-standard nfs paths)
Message-Id: <nU2jl.61$Sj1.21@newsfe09.iad>
Rahul wrote:
> I am configure a perl code (check_lm_sensors; a nagios plugin) so that
> I can eventually roll it out on 200+ servers we have in our computer
> cluster. The problem is that there are several dependancies. eg. the
> CPAN modules Nagios::Plugin, Class::Accessor, Config::Tiny, version.
>
> I already have one machine running where I used "perl -MCPAN -e
> 'install Math::Calc::Units'" etc. for each dependancy that the
> original code complained about. What's a better way of doing this so
> that I can automate the process?
>
> My approach:
> All the nodes have a common nfs mounter directory too (/usr/local/) so
> I thought of doing manual compiles once to this non-standard location
> by using " perl Makefile.PL PREFIX=/usr/local/lib/perl; make; make
> test; make install"
>
> Unfortunately then the next programs down the line don't seem to find
> the modules they need where they expect to find them. eg.
Configure CPAN to automatically satisfy any dependencies, or figure our
in what order they would be required and just have them installed
first, and then install the required one's. You can just pass a perl
-MCPAN -e 'install Module::Name' in that order. Or, download the
source and compile them in their necessary order if you have issues
with CPAN. Though, there are likely other solutions, it should be a
fairly simply problem to solve and to automate.
Or, were you meaning you don't want to have to know the modules the
script itself requires, or have I otherwise misunderstood your
question? I've installed Nagios and created some automated scripts to
add new servers on the fly, and based on the server and type, it would
add monitors for different services, using common templates they'd
need. This also included sensors for various aspects (including an
external temperature sensor for the racks in the data center), and I
don't recall it requiring too much to run or automate (so you should be
able to do this without much trouble, unless I misunderstood your
question).
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 06 Feb 2009 12:21:45 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: error printing page using LWP::Simple
Message-Id: <87ljsjdd4m.fsf@vps1.hacking.dk>
Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
> Tim Greer wrote:
>> Larry Gates wrote:
>>> On Thu, 05 Feb 2009 20:50:36 -0800, Tim Greer wrote:
>>>> You'll need to use $t = (get $url or
>>>> "value"); instead -- that does work after trying.
>
> Works? Well, sort of. It assigns "value" to $t if $url does not
> contain a true value, but if $url contains a true value, it does not
> tell whether the get() function succeeds or why it fails.
Corrent. If the content of the url happens to be "" or "0" this
fails. You have to use the defined-or operator. This still don't allow
you to find out *why* get() failed, but this is becaus get() is a
simple interface that wont tell you that.
>> my $t = get $url || "There was a problem";
my $t = get($url) // "Fail!";
Uhmmm, we don't have a low precedence version of '//'?
//Makholm
------------------------------
Date: Fri, 6 Feb 2009 06:53:28 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: error printing page using LWP::Simple
Message-Id: <slrngoocm8.m2q.tadmc@tadmc30.sbcglobal.net>
Larry Gates <larry@example.invalid> wrote:
> On Thu, 05 Feb 2009 12:07:06 -0800, Tim Greer wrote:
>
>> Larry Gates wrote:
>>
>>> On Thu, 05 Feb 2009 07:43:31 -0600, Chris Mattern wrote:
>>>
>>>> On 2009-02-05, Larry Gates <larry@example.invalid> wrote:
>>>>>
>>>>> # use strict;
>>>>
>>>> Why?
>>>
>>> That's an example of me trying things to make it work,
Commenting out "use strict" is COUNTER to making things work, as
its proper use helps to find bugs.
The correct approach is to understand and correct the messages
that "use strict" generates.
This can most often be accomplished by adding 3 characters, "my ",
in front of the first use of every variable in the program.
>>> my $t = get 'http://www.fourmilab.ch/cgi-
>>> bin/
>>> Yoursky?z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>>> Is it not a problem that the url is folded over with newlines?
Yes, that is absolutely a problem. So fix it.
> use warnings;
> use LWP::Simple;
>
> # load the complete content of the url in question
> # via LWP::Simple::get(...)
>
> my $t = 'Something went right!';
> print "t is $t\n"; use strict;
>
> $t = get 'http://domain-and-url-here';
> print "t is $t\n"; use strict;
"use strict" is a compile-time directive, so it happens *before*
the print happens.
It will only be included once, so invoking it more than once
does not do anything at all.
The proper place for a single invocation of "use strict" is up near
the top of your program along with "use warnings".
If you wonder what "use strict" does, you can read its documentation with:
perldoc strict
> I get the same error with your site as I did.
If you call get() with a bad URL it will not work.
If get's arg has newlines that are not supposed to be there, it will fail.
If get's arg is a non-existant resource, it will fail.
What does your web browser do when you paste "http://domain-and-url-here"
into its location bar?
It is *supposed* to fail, so it does.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: 06 Feb 2009 13:53:41 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: error printing page using LWP::Simple
Message-Id: <498c40e5$0$24600$da0feed9@news.zen.co.uk>
On Fri, 06 Feb 2009 10:02:01 +0100, Peter Makholm <peter@makholm.net> wrote:
> Tim Greer <tim@burlyhost.com> writes:
>
> > This is why I suggested defining it and assigning a value first ($t =
> > "Someting went wrong!", so if it fails, it will show that, but I think
> > both methods would fail, actually.
>
> I read this like you proposing to write something like this:
>
> my $t = "Something is wrong";
> $t = get("http://example.com/");
>
> This would still leave $t with the value undef if the get request
> failed and would still give the 'uninitialized variable' warning when
> $t is used.
>
> But
>
> my $t = get("http://example.com/)
> or "Fail!";
>
> works correctly as you (and others) has suggested.
You have a problem there - "or" has lower precedence than "=".
ITYM:
my $t = get("http://example.com/)
|| "Fail!";
or
my $t = get("http://example.com/)
or print "Fail!";
------------------------------
Date: Fri, 06 Feb 2009 09:16:18 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: error printing page using LWP::Simple
Message-Id: <Cf_il.9$AC1.2@newsfe24.iad>
Peter Makholm wrote:
> Tim Greer <tim@burlyhost.com> writes:
>
>> This is why I suggested defining it and assigning a value first ($t =
>> "Someting went wrong!", so if it fails, it will show that, but I
>> think both methods would fail, actually.
>
> I read this like you proposing to write something like this:
>
> my $t = "Something is wrong";
> $t = get("http://example.com/");
I replied a few minutes after saying he's need to either:
my $t = get("http://example.com/" or "Something is wrong");
Or, better IMO:
my $t = get "http://example.com/" || "Something is wrong";
> This would still leave $t with the value undef if the get request
> failed and would still give the 'uninitialized variable' warning when
> $t is used.
Yes, that is true.
> But
>
> my $t = get("http://example.com/)
> or "Fail!";
>
> works correctly as you (and others) has suggested.
That works, too. :-)
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 06 Feb 2009 09:19:01 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: error printing page using LWP::Simple
Message-Id: <9i_il.10$AC1.5@newsfe24.iad>
Gunnar Hjalmarsson wrote:
> Tim Greer wrote:
>> Larry Gates wrote:
>>> On Thu, 05 Feb 2009 20:50:36 -0800, Tim Greer wrote:
>>>> You'll need to use $t = (get $url or
>>>> "value"); instead -- that does work after trying.
>
> Works? Well, sort of. It assigns "value" to $t if $url does not
> contain a true value, but if $url contains a true value,
That was in reply to someone that suggested get $url or "error", which
wouldn't work unless you put parenthesis. That's why I said "If you
use that, you could do this..."
my $t = get ($url) or "error"; would make more sense.
> it does not
> tell whether the get() function succeeds or why it fails.
Right.
>> You can also use:
>>
>> my $t = get $url || "There was a problem";
>
> Same objection.
>
True.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 06 Feb 2009 09:24:23 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: error printing page using LWP::Simple
Message-Id: <cn_il.1$g63.0@newsfe11.iad>
Gunnar Hjalmarsson wrote:
>> my $t = get $url || "There was a problem";
>
> Same objection.
By the way, I'm not familiar with this module and function, simply
because I've not used it before myself (I use other solutions), but I'm
curious what the objection above is? As in, I realize it doesn't say
why it failed, but I didn't see any method to have it report the
failure... I mean, since it just returns undefined if there's a
failure.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 6 Feb 2009 14:09:35 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: error printing page using LWP::Simple
Message-Id: <kx909wrtvumn.1n9q7ngxtp9p3.dlg@40tude.net>
On Thu, 05 Feb 2009 20:50:36 -0800, Tim Greer wrote:
> my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
> my $url_args = "z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
> my $t = (get "$site_url?$url_args" or "Problem");
> print "t is $t\n";
Big pimpin, Tim.
use strict;
use warnings;
use LWP::Simple;
# load the complete content of the url in question
# via LWP::Simple::get(...)
my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
my $url_args = 'z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
my $t = 'Something went right!';
print "t is $t\n";
$t = (get "$site_url?$url_args" or "Problem");
print "t is $t\n";
# perl scraper3.pl
#end script show target
<td>
<input type="text" name="jd" value="2454869.37545" size="20"
How do I grab the julian date from this? Full page listing after sig.
--
larry gates
Just put in another goto, and then it'll be readable. :-)
-- Larry Wall in <199804161810.LAA18902@wall.org>
<area shape="rect" coords="470,20,545,95" alt="38.5566,213.285"
href="/cgi-bin/Y
ourtel?lat=38.5566&ns=North&lon=213.285&fov=45&z=1" />
<area shape="rect" coords="470,95,545,170" alt="40.2684,232.160"
href="/cgi-bin/
Yourtel?lat=40.2684&ns=North&lon=232.160&fov=45&z=1" />
<area shape="rect" coords="470,170,545,245" alt="35.3917,253.395"
href="/cgi-bin
/Yourtel?lat=35.3917&ns=North&lon=253.395&fov=45&z=1" />
<area shape="rect" coords="470,245,545,320" alt="23.0317,270.958"
href="/cgi-bin
/Yourtel?lat=23.0317&ns=North&lon=270.958&fov=45&z=1" />
<area shape="rect" coords="470,320,545,395" alt="5.7588,282.432"
href="/cgi-bin/
Yourtel?lat=5.7588&ns=North&lon=282.432&fov=45&z=1" />
<area shape="rect" coords="470,395,545,470" alt="-12.8447,288.823"
href="/cgi-bi
n/Yourtel?lat=12.8447&ns=South&lon=288.823&fov=45&z=1" />
<area shape="rect" coords="470,470,545,545" alt="-30.1303,291.429"
href="/cgi-bi
n/Yourtel?lat=30.1303&ns=South&lon=291.429&fov=45&z=1" />
<area shape="rect" coords="470,545,545,619" alt="-44.8154,290.856"
href="/cgi-bi
n/Yourtel?lat=44.8154&ns=South&lon=290.856&fov=45&z=1" />
<area shape="rect" coords="545,20,619,95" alt="26.4997,216.082"
href="/cgi-bin/Y
ourtel?lat=26.4997&ns=North&lon=216.082&fov=45&z=1" />
<area shape="rect" coords="545,95,619,170" alt="25.7463,229.749"
href="/cgi-bin/
Yourtel?lat=25.7463&ns=North&lon=229.749&fov=45&z=1" />
<area shape="rect" coords="545,170,619,245" alt="20.6382,244.148"
href="/cgi-bin
/Yourtel?lat=20.6382&ns=North&lon=244.148&fov=45&z=1" />
<area shape="rect" coords="545,245,619,320" alt="10.8382,256.796"
href="/cgi-bin
/Yourtel?lat=10.8382&ns=North&lon=256.796&fov=45&z=1" />
<area shape="rect" coords="545,320,619,395" alt="-2.3921,266.127"
href="/cgi-bin
/Yourtel?lat=2.3921&ns=South&lon=266.127&fov=45&z=1" />
<area shape="rect" coords="545,395,619,470" alt="-16.9564,271.889"
href="/cgi-bi
n/Yourtel?lat=16.9564&ns=South&lon=271.889&fov=45&z=1" />
<area shape="rect" coords="545,470,619,545" alt="-30.9728,274.380"
href="/cgi-bi
n/Yourtel?lat=30.9728&ns=South&lon=274.380&fov=45&z=1" />
<area shape="rect" coords="545,545,619,619" alt="-43.2794,273.825"
href="/cgi-bi
n/Yourtel?lat=43.2794&ns=South&lon=273.825&fov=45&z=1" />
</map>
<center><h1>Sky above 355'N 10639'3"W at Fri 2009 Feb 6 21:00
UTC</h1></c
enter>
<center>
<a href="/yoursky/help/sky.html"><em><font size="-1">Explain symbols in the
map.
</font></em></a><br />
<img
src="/cgi-bin/Yoursky?di=993798CF5A500FD0F5203A94A187DA027397F0AB1B0A1AEAC0
15D57B1F667D586C4450676C349655D73C3607D5C3B1C2655E87486371C1D7DB4DC369B8420AE695
6B14B20E776E571CA9B59F28B7684ADF735EEB8A" usemap="#telmap" ismap="ismap"
width="
640" height="640" border="0" alt="Map of sky above 355'N 10639'3"W
at Fri
2009 Feb 6 21:00 UTC" /><br />
<em>Click in map to aim telescope.</em>
<br /><a
href="/cgi-bin/Yourhorizon?lat=35.083600&lon=106.651000&azimuth
=0&z=2&elements="><b>View horizon at this observing site.</b></a>
</center>
<form method="post" name="request" action="/cgi-bin/Yoursky">
<center>
<input type="submit" value="Update" />
<p />
<a href="/yoursky/help/controls.html"><em>Explain controls in the following
pane
l.</em></a>
<table border="border" cellpadding="5">
<tr>
<th>
<a href="/yoursky/help/controls.html#DateTime"><b>Date and
Time</b></a>
</th>
<td>
<table>
<tr>
<td>
<input type="radio" name="date" onclick="0" checked="checked" value="0" />
<a hr
ef="/yoursky/help/controls.html#Now">Now</a>
</td>
</tr>
<tr>
<td>
<input type="radio" name="date" onclick="0" value="1" /> <a
href="/yoursky/help/
controls.html#UTC">Universal time:</a>
</td>
<td>
<input type="text" name="utc" value="2009-02-06 21:00:39" size="20"
onchange="do
cument.request.date[1].checked=true;" />
</td>
</tr>
<tr>
<td>
<input type="radio" name="date" onclick="0" value="2" /> <a
href="/yoursky/help/
controls.html#Julian">Julian day:</a>
</td>
<td>
<input type="text" name="jd" value="2454869.37545" size="20"
onchange="document.
request.date[2].checked=true;" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>
<a href="/yoursky/help/controls.html#Site">Observing Site</a>
</th>
<td>
<table cellpadding="3">
<tr>
<td>
Latitude:
</td>
<td>
<input type="text" name="lat" value="355'" size="10" />
</td>
<td>
<label><input type="radio" name="ns" checked="checked" value="North" />
North</l
abel>
<label><input type="radio" name="ns" value="South" /> South</label>
</td>
</tr>
<tr>
<td>
Longitude:
</td>
<td>
<input type="text" name="lon" value="10639'3"" size="10" />
</td>
<td>
<label><input type="radio" name="ew" value="East" /> East</label>
<label><input type="radio" name="ew" checked="checked" value="West" />
West</lab
el>
</td>
</tr>
<tr>
<td align="center">
<a href="/yoursky/cities.html"><b>Set for nearby city</b></a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th><a href="/yoursky/help/controls.html#Options">Display Options</a>
</th>
<td>
<input type="checkbox" checked="checked" name="coords" /> <a
href="/yoursky/help
/controls.html#Coords">Ecliptic and equator</a>
<br />
<input type="checkbox" checked="checked" name="moonp" /> <a
href="/yoursky/help/
controls.html#Planets">Moon and planets</a>
<br />
<input type="checkbox" checked="checked" name="deep" /> <a
href="/yoursky/help/
controls.html#DeepSky">Deep sky objects of magnitude</a>
<input type="text" name="deepm" value="2.5" size="3" /> and brighter
<br />
<a href="/yoursky/help/controls.html#Constellations">Constellations:</a>
<br />
<input type="checkbox"
checked="
checked" name="consto" /> <a
href="/yoursky/help/controls.html#ConstO">Outlines<
/a>
<br />
<input type="checkbox"
checked="
checked" name="constn" /> <a
href="/yoursky/help/controls.html#ConstN">Names</a>
<label><input type="checkbox" name="consta" /> aligned with
horizon?</label>
<br />
<input type="checkbox"
checked="
checked" name="constb" /> <a
href="/yoursky/help/controls.html#ConstB">Boundarie
s</a>
<br />
<a href="/yoursky/help/controls.html#Stars">Stars:</a>
<br />
<a
href="/yoursky/help/controls.
html#StarMag">Show stars brighter than magnitude</a>
<input type="text" name="limag" value="5.5" size="3" />
<br />
<input type="checkbox"
checked="
checked" name="starn" /> <a
href="/yoursky/help/controls.html#StarName">Names fo
r magnitude</a>
<input type="text" name="starnm" value="2.0" size="3" /> and brighter
<br />
<input type="checkbox"
checked="
checked" name="starb" /> <a
href="/yoursky/help/controls.html#StarBFlam">Bayer/F
lamsteed codes</a> for mag.
<input type="text" name="starbm" value="2.5" size="3" /> and brighter
<br /><input type="checkbox" name="flip" /> <a
href="/yoursky/help/controls.html
#Invert">Invert North and South</a>
<br /><a href="/yoursky/help/controls.html#Imgsize">Image size</a>: <input
type=
"text" name="imgsize" value="640" size="6" /> pixels
<br /><a href="/yoursky/help/controls.html#Scheme">Colour scheme</a>:
<select na
me="scheme" size="1">
<option value="0" selected="selected">Colour</option>
<option value="1">Black on white background</option>
<option value="2">White on black background</option>
<option value="3">Night vision (red)</option>
</select>
</td>
</tr>
<tr>
<th><a href="/yoursky/help/elements.html">Asteroid and<br />Comet
Tracking</a
>
</th>
<td align="center">
<br />
Paste <a href="/yoursky/help/elements.html">orbital elements</a> below:
<label><input type="checkbox" name="edump" value="-xe" /> Echo
elements</label
>
<br />
<textarea name="elements" rows="1" cols="40">
</textarea><br />
</td>
</tr>
</table>
</center>
</form>
<p />
<a href="/yoursky/help/ephemeris.html"><b>Ephemeris:</b></a><center>
<table border="border" cellpadding="3">
<tr><th rowspan="2"> </th><th rowspan="2">Right<br />Ascension</th><th
rows
pan="2">Declination</th><th rowspan="2">Distance<br />(<span
title="Astronomical
units (149,597,871 km)">AU</span>)</th><th colspan="2">From 355'N
10639'3&quo
t;W:</th></tr>
<tr><th>Altitude</th><th>Azimuth</th></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=0&z=1">Sun</a></th><td
align="ri
ght">21h 22m 35s</td><td align="right">−15 22.3'</td><td
align="right">0.
986</td><td align="right">34.252</td><td
align="right">29.521</td><td>Up</td></t
r>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=1&z=1">Mercury</a></th><td
align
="right">19h 40m 10s</td><td align="right">−19 45.0'</td><td
align="right
">0.863</td><td align="right">17.140</td><td
align="right">49.551</td><td>Up</td
></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=2&z=1">Venus</a></th><td
align="
right">0h 7m 4s</td><td align="right">+3 25.6'</td><td
align="right">0.516</td>
<td align="right">54.988</td><td
align="right">−28.916</td><td>Up</td></tr
>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=3&z=1">Moon</a></th><td
align="r
ight">6h 46m 2s</td><td align="right">+25 35.2'</td><td align="right">57.0
<spa
n title="Earth radii (6378.14 km)">ER</span></td><td
align="right">−4.237<
/td><td align="right">−125.539</td><td>Set</td></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=4&z=1">Mars</a></th><td
align="r
ight">20h 16m 46s</td><td align="right">−20 44.0'</td><td
align="right">2
.336</td><td align="right">21.729</td><td
align="right">41.785</td><td>Up</td></
tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=5&z=1">Jupiter</a></th><td
align
="right">20h 40m 29s</td><td align="right">−18 49.2'</td><td
align="right
">6.067</td><td align="right">26.429</td><td
align="right">37.876</td><td>Up</td
></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=6&z=1">Saturn</a></th><td
align=
"right">11h 28m 50s</td><td align="right">+5 45.5'</td><td
align="right">8.530<
/td><td align="right">−48.690</td><td
align="right">170.062</td><td>Set</t
d></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=7&z=1">Uranus</a></th><td
align=
"right">23h 27m 5s</td><td align="right">−4 21.0'</td><td
align="right">2
0.923</td><td align="right">50.147</td><td
align="right">−9.577</td><td>Up
</td></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=8&z=1">Neptune</a></th><td
align
="right">21h 44m 39s</td><td align="right">−13 57.0'</td><td
align="right
">31.015</td><td align="right">37.604</td><td
align="right">24.097</td><td>Up</t
d></tr>
<tr><th><a href="/cgi-bin/uncgi/Yourtel?aim=9&z=1">Pluto</a></th><td
align="
right">18h 9m 47s</td><td align="right">−17 44.2'</td><td
align="right">3
2.271</td><td align="right">2.886</td><td
align="right">65.911</td><td>Up</td></
tr>
</table>
</center>
<blockquote>
<small>Azimuth in the above table
follows the astronomical convention: zero
degrees is South with positive angles toward the
West and negative angles toward the East.</small>
</blockquote><p />
<a href="/yoursky/#Skymap"><b>Back to <em>Sky Maps</em></b></a>
<a href="/yoursky/"><b>Up to <em>Your Sky</em></b></a>
<a href="/yoursky/credits.html"><b>Credits</b></a>
<a href="/yoursky/custom.html"><b>Customise</b></a>
<a href="/yoursky/help/help.html"><b>Help</b></a>
<p />
<hr />
<address>
by <a href="/">John Walker</a>
</address>
<p />
<blockquote>
<font size="-1"><em>Images produced by Your Sky are in the public
domain and may be used in any manner without permission, restriction,
attribution, or compensation. Back links to
<a href="http://www.fourmilab.ch/yoursky/">Your Sky</a> are
welcome.</em></font>
</blockquote>
</body>
</html>
C:\MinGW\source>
------------------------------
Date: Fri, 6 Feb 2009 14:20:53 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: error printing page using LWP::Simple
Message-Id: <1ic2m2a5nzrj2$.x31ak29fbj8$.dlg@40tude.net>
On Fri, 6 Feb 2009 06:53:28 -0600, Tad J McClellan wrote:
>>>> my $t = get 'http://www.fourmilab.ch/cgi-
>>>> bin/
>>>> Yoursky?z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>
>>>> Is it not a problem that the url is folded over with newlines?
>
>
> Yes, that is absolutely a problem. So fix it.
I've asked this question before and didn't get an answer I could use. How
does a person do proper line continuations in perl?
--
larry gates
So please don't think I have a "down" on the MVS people. I'm just pulling
off their arms to beat other people over the head with.
-- Larry Wall in <199808050415.VAA24026@wall.org>
------------------------------
Date: Fri, 06 Feb 2009 13:23:21 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: error printing page using LWP::Simple
Message-Id: <eT1jl.189$Kr1.89@newsfe13.iad>
Larry Gates wrote:
> On Thu, 05 Feb 2009 20:50:36 -0800, Tim Greer wrote:
>
>> my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
>> my $url_args = "z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>> my $t = (get "$site_url?$url_args" or "Problem");
>> print "t is $t\n";
>
> Big pimpin, Tim.
>
> use strict;
> use warnings;
> use LWP::Simple;
>
> # load the complete content of the url in question
> # via LWP::Simple::get(...)
>
> my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
> my $url_args = 'z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>
> my $t = 'Something went right!';
> print "t is $t\n";
>
> $t = (get "$site_url?$url_args" or "Problem");
>
>
> print "t is $t\n";
>
>
> # perl scraper3.pl
>
> #end script show target
>
> <td>
> <input type="text" name="jd" value="2454869.37545" size="20"
>
> How do I grab the julian date from this? Full page listing after sig.
Well, first of all that was just in response to someone mentioning or,
I'd change the code:
my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
my $url_args = 'z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
my $t = get "$site_url?$url_args" || "There was a problem".
I'd also consider using something else, like useragent, so you know what
the problem was, instead of just having it be undefined. Sometimes you
can act on the problem, or at least know not to try again if it's
forbidden on the target site, or whatever else.
You can grab the Julian date with something like:
my $juldate = ($t =~ m/name="jd" value="([^"]+)"/) ? $1 : "No date";
Of course, there are dozens of ways of doing this.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 06 Feb 2009 13:31:01 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: error printing page using LWP::Simple
Message-Id: <C_1jl.191$Kr1.131@newsfe13.iad>
Larry Gates wrote:
> On Fri, 6 Feb 2009 06:53:28 -0600, Tad J McClellan wrote:
>
>>>>> my $t = get 'http://www.fourmilab.ch/cgi-
>>>>> bin/
>>>>> Yoursky?z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>>
>>>>> Is it not a problem that the url is folded over with newlines?
>>
>>
>> Yes, that is absolutely a problem. So fix it.
>
> I've asked this question before and didn't get an answer I could use.
> How does a person do proper line continuations in perl?
Probably, something like:
my $t = get(
'http://www.fourmilab.ch/cgi-bin/Yoursky?' .
'z=1&lat=35.0836&ns=North&lon=106.651&ew=West'
) || "There was a problem.";
print "t is $t\n";
Would work.
The other methods are as I mentioned before. Set a variable for the
domain, URL and args and just pass it to get() that way.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 6 Feb 2009 15:40:49 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: error printing page using LWP::Simple
Message-Id: <slrngopbj1.sj3.tadmc@tadmc30.sbcglobal.net>
Larry Gates <larry@example.invalid> wrote:
><input type="text" name="jd" value="2454869.37545" size="20"
>
> How do I grab the julian date from this?
You use a module that understands HTML for processing HTML data.
---------------------------
#!/usr/bin/perl
use warnings;
use strict;
use HTML::TreeBuilder;
use LWP::Simple;
my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
my $url_args = 'z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
my $t = get "$site_url?$url_args" || "Problem";
my $tree = HTML::TreeBuilder->new_from_content($t);
foreach my $elem ( $tree->find_by_attribute('name', 'jd') ) {
print $elem->attr('value'), "\n";
}
---------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 6 Feb 2009 15:44:24 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: error printing page using LWP::Simple
Message-Id: <slrngopbpo.sj3.tadmc@tadmc30.sbcglobal.net>
Larry Gates <larry@example.invalid> wrote:
> On Fri, 6 Feb 2009 06:53:28 -0600, Tad J McClellan wrote:
>
>>>>> my $t = get 'http://www.fourmilab.ch/cgi-
>>>>> bin/
>>>>> Yoursky?z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
>>
>>>>> Is it not a problem that the url is folded over with newlines?
>>
>>
>> Yes, that is absolutely a problem. So fix it.
>
> I've asked this question before and didn't get an answer I could use. How
> does a person do proper line continuations in perl?
By pressing the wide key labeled "Enter" or "Return" on your keyboard. :-)
If you instead meant to ask how to get a really long string that
does not hit the wordwrap limit, then use the concatenation operator:
my $t = get 'http://www.fourmilab.ch/cgi-'
. 'bin/'
. 'Yoursky?z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 06 Feb 2009 09:36:56 -0500
From: zentara <zentara@highstream.net>
Subject: Re: File handle to "in memory" file
Message-Id: <j9ioo4h24kp5545c98ec60apq8btei10cg@4ax.com>
On Thu, 05 Feb 2009 07:42:52 +0100, Frank Seitz <devnull4711@web.de>
wrote:
>Hi folks,
>
>with
>
> open $fh,'>',\$var
>
>I can connect a file handle $fh with a scalar $var.
>
>How can I find out, given $fh, whether $fh is connected
>with a scalar and which scalar it is connected with.
>
>Frank
When you create the filehandle, store the variable in a hash.
Sort of a little database telling you which filhandles go where,
exactly.
Like:
#!/usr/bin/perl
use warnings;
use strict;
my %handle;
my $var;
print \$var,"\n";
open my $fh, '>',\$var or die "$!\n";
$handle{$fh}{'var'} = \$var;
print $handle{$fh}{'var'},"\n";
__END__
zentara
--
I'm not really a human, but I play one on earth.
http://www.zentara.net/~zentaran/Remember_How_Lucky_You_Are.html
------------------------------
Date: Fri, 6 Feb 2009 15:28:08 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: File handle to "in memory" file
Message-Id: <8h1u56-jr91.ln1@osiris.mauzo.dyndns.org>
Quoth zentara <zentara@highstream.net>:
> On Thu, 05 Feb 2009 07:42:52 +0100, Frank Seitz <devnull4711@web.de>
> wrote:
>
> > open $fh,'>',\$var
> >
> >I can connect a file handle $fh with a scalar $var.
> >
> >How can I find out, given $fh, whether $fh is connected
> >with a scalar and which scalar it is connected with.
>
> When you create the filehandle, store the variable in a hash.
> Sort of a little database telling you which filhandles go where,
> exactly.
>
> Like:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my %handle;
>
> my $var;
> print \$var,"\n";
> open my $fh, '>',\$var or die "$!\n";
>
> $handle{$fh}{'var'} = \$var;
>
> print $handle{$fh}{'var'},"\n";
This is good advice in general, but you need to be careful. If $fh gets
reblessed into a different class, its stringification will change and
the key won't match. If $fh goes out of scope, its address may be
reused, and you will have an entry in %handle that points to the wrong
variable; also, the ref in %handle will prevent $var from being GCed
when $fh is. If you are using ithreads, $fh will have a different
address in any new threads you create, so again the key won't match.
If you have 5.10, all of these problems can be solved by using
Hash::Util::Fieldhash on %handle. Otherwise, look into Class::InsideOut.
Ben
------------------------------
Date: Fri, 06 Feb 2009 13:33:24 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: File handle to "in memory" file
Message-Id: <x7ab8zxvnv.fsf@mail.sysarch.com>
>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
FS> Christian Winter wrote:
>> Frank Seitz schrieb:
>>> with
>>>
>>> open $fh,'>',\$var
>>>
>>> I can connect a file handle $fh with a scalar $var.
>>>
>>> How can I find out, given $fh, whether $fh is connected
>>> with a scalar and which scalar it is connected with.
>> I don't think there's a solution to that which doesn't entail
>> delving into the depth of the header files and analyzing the
>> file handle's glob magic.
FS> It's a pity, because I think I need this.
i would wager a large sum of quatloos that you don't need it. please
post your (imagined :) reasons for needing this. how would you have many
scalar files where you needed to track which var was attached to which
handle? and if you did, a trivial and correct solution would be to
manage a hash of the refs to the vars and the handles (maybe two hashes,
one for each mapping direction). there, simple pure perl and no need for
guts introspection. i still want to know what is your design and
reasoning for needed so many of these and to track them. when i hear
about tracking of handles and files and such i smell XY problems. and my
perl nose is especially acute!
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Fri, 6 Feb 2009 15:48:29 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: NVHOST Website Design & Custom Programming Supports Cancer Charities
Message-Id: <slrngopc1d.sj3.tadmc@tadmc30.sbcglobal.net>
shopbeenvied.nv@gmail.com <shopbeenvied.nv@gmail.com> wrote:
> NVHOST.com wants to make the world a better place!
By using the same methods employed by pornographers and con artists?
Many people will not want to do business with an evil company.
Spamming is evil.
NVHOST.com is a spammer.
NVHOST.com is evil.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 6 Feb 2009 08:35:08 -0800 (PST)
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: Perl Peeves
Message-Id: <844849cf-b1b7-44fa-8bb0-0918fa75ece2@i20g2000prf.googlegroups.com>
On Feb 3, 5:01=A0pm, t...@panix.com (Tim McDaniel) wrote:
> In article <4987b2d5$0$194$e4fe5...@news.xs4all.nl>,
> Hans Mulder =A0<han...@xs4all.nl> wrote:
>
> >Perldoc perlop describes what unary - does with string arguments.
>
> Thank you for that information. =A0I didn't know that either. =A0The Perl
> 5.00502 man page explanation:
>
> =A0 =A0 =A0 =A0Unary "-" performs arithmetic negation if the operand is
> =A0 =A0 =A0 =A0numeric. =A0If the operand is an identifier, a string cons=
isting
> =A0 =A0 =A0 =A0of a minus sign concatenated with the identifier is return=
ed.
> =A0 =A0 =A0 =A0Otherwise, if the string starts with a plus or minus, a st=
ring
> =A0 =A0 =A0 =A0starting with the opposite sign is returned. =A0One effect=
of
> =A0 =A0 =A0 =A0these rules is that -bareword is equivalent to the string
> =A0 =A0 =A0 =A0"-bareword". =A0If, however, the string begins with a non-
> =A0 =A0 =A0 =A0alphabetic character (exluding "+" or "-"), Perl will atte=
mpt
> =A0 =A0 =A0 =A0to convert the string to a numeric and the arithmetic nega=
tion
> =A0 =A0 =A0 =A0is performed. =A0If the string cannot be cleanly converted=
to a
> =A0 =A0 =A0 =A0numeric, Perl will give the warning 'Argument "the string"
> =A0 =A0 =A0 =A0isn't numeric in negation (-) at ....'
Just some observations:
From: http://perldoc.perl.org/perldata.html
Barewords
A word that has no other interpretation in the grammar will be
treated as if it were a quoted string. These are known as "barewords".
As with filehandles and labels, a bareword that consists entirely
of lowercase letters risks conflict with future reserved words, and
if you use the use warnings pragma or the -w switch, Perl will warn
you about any such words.
$ perl -v
This is perl, v5.8.8 built for sun4-solaris
$ perl -wle'$_=3Dbareword;print'
Unquoted string "bareword" may clash with future reserved word at -e
line 1.
bareword
(as predicted)
$ perl -wle'$_=3D-bareword;print'
-bareword
$ perl -wle'$_=3D - -bareword;print'
+bareword
(unary "-" silences the warning, I guess)
$ perl -wle'$_=3D - +bareword;print'
Unquoted string "bareword" may clash with future reserved word at -e
line 1.
-bareword
$ perl -wle'$_=3D+bareword;print'
Unquoted string "bareword" may clash with future reserved word at -e
line 1.
bareword
(unary "+" doesn't appear to silence the warning)
$ perl -wle'$_=3D_bareword;print'
_bareword
(i.e., it does not consist of all lowercase letters, so no warning)
$ perl -wle'$_=3D-_bareword;print'
-_bareword
(hmmm, so 'If, however, the string begins with a non-
alphabetic character (exluding "+" or "-"), Perl will attempt
to convert the string to a numeric and the arithmetic negation
is performed.' should maybe include 'or begins with "_"'
somewhere?)
$ perl -wle'$_=3D - -_bareword;print'
+_bareword
$ perl -wle'$_=3D - +_bareword;print'
-_bareword
$ perl -wle'$_=3D+_bareword;print'
_bareword
--
Brad
------------------------------
Date: Fri, 06 Feb 2009 14:32:21 +0100
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: programming by evolution?
Message-Id: <6v2sf4Fhuh4mU1@mid.individual.net>
Xah Lee wrote:
> Pascal Constanza is a Common Lisp fanatic.
It's Costanza, not Constanza.
Thank you,
Pascal
--
ELS'09: http://www.european-lisp-symposium.org/
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
------------------------------
Date: Fri, 06 Feb 2009 17:04:04 -0500
From: rabbits77 <rabbits77@my-deja.com>
Subject: Re: XXXXX Website Design & Custom Programming Supports Cancer Charities
Message-Id: <b6b79$498cb3d6$c650990a$24252@news.eurofeeds.com>
Tad J McClellan wrote:
> shopbeenvied.nv@gmail.com <shopbeenvied.nv@gmail.com> wrote:
>
>> XXXXX.com wants to make the world a better place!
>
>
> By using the same methods employed by pornographers and con artists?
>
> Many people will not want to do business with an evil company.
>
>
>
>
> Spamming is evil.
>
> XXXXX.com is a spammer.
>
> XXXXX.com is evil.
Then why did you repeat their url not once, not twice, but three times!?!?
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 2188
***************************************