Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: locating ultima thule

by Aldebaran (Curate)
on Jan 05, 2019 at 06:32 UTC ( [id://1228066]=note: print w/replies, xml ) Need Help??


in reply to Re: locating ultima thule
in thread locating ultima thule

it was, after all, scraping a Fourmilab page for a table that does not contain the object you seek, but only the "major" solar system objects, which, unless it is staying close to one of those objects, did not seem that applicable

This is true indeed, and thanks for your comments. I looked at the module you posted and the long and short of it is I don't know how to track a single object in space, even possessing the physical values necessary. Nor did I find a perl way to tap into the services at the national jet lab. The ephemeris is the one way I know how to sort out the solar system. It's why I find this so extraordinary. How often do the Gods throw a Pluto Party, have all the titans show up, and leave only us behind to snap the pictures?

Ultima Thule is essentially invisible from where we are. Its great fortune was being able to occult a star, allowing for predictions of its morphology, which I think is taken to mean composition and shape in this context. These were verified with the fly-by.

I've marked where I think Ultima Thule is, but I can't get the page to load now, scratching my head as to why:

a is /home/bob/2.scripts/pages/2.pp/template_stuff/aimages/a.png b is a.png a is /home/bob/2.scripts/pages/2.pp/template_stuff/aimages/b.png b is b.png Path::Tiny paths require defined, positive-length parts at template_st +uff/html7.pm line 126. $

I've marked line 126 and don't see how the above could offend:

sub put_page { use 5.011; use utils1; use Net::SFTP::Foreign; use Encode; use open OUT => ':encoding(UTF-8)', ':std'; use Data::Dumper; my ( $sftp, $rvars ) = (@_); my %vars = %$rvars; #load html file to server my $server_dir = $vars{"server_dir"}; say "server dir is $server_dir"; my $return1 = createDir( $server_dir, $sftp ); say "return1 is $return1"; $sftp->setcwd("/$server_dir") or warn "setcwd1 failed $!\n"; $sftp->put( $vars{html_file} ) or die "html put failed $!\n"; #load css file to server $sftp->setcwd("/css") or warn "setcwd2 failed $@\n"; my $path3 = path( $vars{css_path}, $vars{"css_file"} ); say "path3 is $path3"; my $remote_css = $vars{"css_file"}; $sftp->put( "$path3", $remote_css ) or warn "css put failed $@\n"; # upload images my $image_dir = $vars{"image_dir"}; say "image dir is $image_dir"; my $return2 = createDir( $image_dir, $sftp ); say "return2 is $return2"; $sftp->setcwd("/$image_dir") or warn "setcwd2 failed $!\n"; my $return3 = createDir( $vars{remote_dir}, $sftp ); say "return3 is $return3"; $sftp->setcwd( $vars{remote_dir} ) or warn "setcwd3 failed $!\n"; print $sftp->cwd(), "\n"; print Dumper $rvars; my $ref_content = $vars{refc}; my @AoA = @$ref_content; for my $i ( 0 .. $#AoA ) { my $a = path( $vars{to_images}, $AoA[$i][0] ); say "a is $a"; my $b = $a->basename; #line 126 say "b is $b"; $sftp->put( $a, $b ) or warn "AoA put failed $@\n"; } undef $sftp; return }

Fishing for tips,

Replies are listed 'Best First'.
Re^3: locating ultima thule
by haukex (Archbishop) on Jan 05, 2019 at 12:01 UTC
    Path::Tiny paths require defined, positive-length parts

    AFAICT that means that one of the paths involved in the operation was either undef or had zero length. It'd be best if you dump the elements of the paths involved, in this case I guess that'd be $vars{to_images} and $AoA[$i][0], and if you're unsure as to what's causing the problem, show the output here.

      show the output here

      I did figure out what is going wrong, but I don't know how to fix it. Let me start by showing the tail end of the page creation process, where this thing is going off the rails:

      first value is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages Use of uninitialized value in concatenation (.) or string at template_ +stuff/html7.pm line 127, <STDIN> line 2. array part is undefined!...initializing: a is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages/quux b is quux AoA put failed first value is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages Use of uninitialized value in concatenation (.) or string at template_ +stuff/html7.pm line 127, <STDIN> line 2. array part is undefined!...initializing: a is /home/bob/2.scripts/pages/3.cw/template_stuff/aimages/quux b is quux AoA put failed return is 3.cw15.html $

      The offenders are create_page and put_page, who until recently, were part of main. Relegating them to be subroutines was great for legibility in main, but I seem to have developed issues. First of all, even though it tells me it fails every time, it gets a page on the net. The resulting page is weirdly-populated. ugly page

      My main data struture is a hash that I pass into all my subroutines:

      my $rvars = shift; my %vars = %$rvars;

      But then I want to create something with persistence, like:

      $vars{refc} = get_content($rvars); $rvars = \%vars; ## will same trick work?

      and then

      print "Put file to server(y/n)?: "; my $prompt2 = <STDIN>; chomp $prompt2; if ( $prompt2 eq ( "y" | "Y" ) ) { put_page( $sftp, $rvars ); }

      $ref_content's value is NULL, so this is not an effective pass.

      my $ref_content = $vars{refc}; my @AoA = @$ref_content; say "content----------"; print Dumper $ref_content; for my $i ( 0 .. $#AoA ) { say "first value is $vars{to_images} "; say "array part is $AoA[$i][0]"; if (!defined $AoA[$i][0]) { say "undefined!...initializing:"; $AoA[$i][0] = 'quux'; } my $a = path( $vars{to_images}, $AoA[$i][0] ); say "a is $a"; my $b = $a->basename; say "b is $b"; $sftp->put( $a, $b ) or warn "AoA put failed $@\n"; }

      It didn't always used to be this broken, so I'm happy to entertain suggestions....

        Ok, you've confirmed that $vars{refc}[$i][0] is undef, but as I said, please use Data::Dumper (or Data::Dump) to show the contents of $vars{refc}. Probably the data structure that get_content is returning doesn't match what you're doing with it in put_page.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-26 05:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found