Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thank you for your reply, and I understand that it's hard to comment on code that has yet to be shown. I appreciated the remarks before I start into these: they give me goals to work towards. I've done about half of the changeover to Path::Tiny for this workspace, and I've been really pleased with results so far. I've chopped out many lines and even one entire routine. It would be very pleasing if I could wrest this software tool completely from bash. Where it starts is last html page with utf8 captions, showing a successful cloning of the last stable upgrade.

Alright, so on all of the files copied, if they match either "pl" or "sh", then I want them set to 0755. Should I set directories containing these scripts to 0755 as well?

Page for perlmonks shows progress with changing the path on the server directory. I've started to attack the clone script from the top, clearing out the modules I'm not gonna use anymore. For this task, I might only need Path::Tiny, but need to get some feeling as to how it works. Where I'm hung up now is with the logic from switching over from File::Copy. I've commented out what used to work:

#!/usr/bin/perl -w use strict; use 5.010; use utf8; use open qw/:std :utf8/; use Path::Tiny; # This script clones the template directory in $1 to $2. # Some names need munging. # $from is a populated child directory; $to is child dir to be create +d. $pop is the folder with the data. my ( $from, $to, $pop ) = @ARGV; my $ts = "template_stuff"; my $current = path(".")->absolute; #say "current is $current"; say "-------------"; say "making directories"; # make root directory of clone: my $rd1 = path( $current, $to )->mkpath; # define the paths within the target directory: my $rd3 = path( $current, $to, $ts )->mkpath; # $from template directory: my $rd6 = path( $current, $from, $ts ); say "-------------"; say "copying files"; opendir my $eh, $rd6 or die "dead $!\n"; while ( defined( $_ = readdir($eh) ) ) { if (m/(txt|pm|css|tmpl|pl|sh)$/) { say "matching is $_"; $a = path( $rd6, $_ ); #say "a is $a"; $b = path( $rd3, $_ ); #say "b is $b"; #copy( $a, $b ); path( $rd6, $_ )->copy($b); } }

Where I can't follow the logic is the analog of the copy command. Terminal output is:

$ ./ ------------- making directories ------------- copying files matching is 5.unicode1.css copy failed for /home/bob/1.scripts/pages/ +de1.css to 1/5.unicode1.css: No such file or directory at ./4.clone.p +l line 41. $

Thanks all for comments, and I *do read* what people post for me. Please understand, I'm a pilgrim who is overachieving to become a friar, so the more-complicated method calls in Path::Tiny are a bit tough for me. I think the investment in figuring it out and switching over is gonna be time well spent.

In reply to Re^2: shedding a bash wrapper and updating to Path::Tiny by Aldebaran
in thread shedding a bash wrapper and updating to Path::Tiny by Aldebaran

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2018-12-18 10:26 GMT
    Find Nodes?
      Voting Booth?
      How many stories does it take before you've heard them all?

      Results (79 votes). Check out past polls.