in reply to Re^11: search and replace strings in different files in a directory
in thread search and replace strings in different files in a directory
I am getting the strange feeling that my undertaking of writing a "simple" script turns out to be a much larger project than I had anticipated.
Its not that much larger, its just that there is a lot of details :) Its like learning to sing in a new language, there is new sentence structure and new word list ... and you still have to practice hitting your notes :)(reading about it is different than doing it)
Think pre-teen versus a mother versus a car mechanic -- pre-teen probably knows that the wheels go round and round, mom knows when to drive for service, and mechanic knows how to replace parts (including what manual to read )
You're at the mom stage studying for mechanic -- you can get there if you're willing :) its just details
probably student driver stage trying to pass the written exam (analogies are hard:)
/bin/sh: gcc-4: Kommando nicht gefunden. Makefile:367: recipe for target 'Cwd.o' failed make: *** Cwd.o Error 127
Like Corion already said, looks like you're missing gcc-4 :)
Wide character in die at ... Path/Tiny. ... line 57 in the script
Isn't that wonderfully convenient? I think so (problem detected, error reported informatively)
So there is a problem with the filename, its got extra stuff. So, to solve the cause you work your way backwards, which function feeds RetrieveAndBackupXML? Which function feeds that function? Is it still called GetPaths? That is where you employ File::BOM, like
sub GetPaths { use File::BOM; ## my @paths = path( shift )->lines_utf8; my @paths = path( shift )->lines( { binmode => ":via(File::BOM)" } + ); s/\s+$// for @paths; # "chomp" return @paths; } ## end sub GetPaths
other way without File::BOM
sub GetPaths { my @paths = path( shift )->lines_utf8; s/\x{feff}//g for @paths; # "de-bom" s/\s+$// for @paths; # "chomp" return @paths; } ## end sub GetPaths
A tip: if you add use Carp::Always; you will get a stack of error messages, like
use Carp::Always; use Path::Tiny qw/ path /; sub f{g(@_);} sub g { r( @_ ); } sub r { path(shift)->lines } f(666); __END__ Error open (<) on '666': No such file or directory at C:/citrusperl/si +te/lib/Path/Tiny.pm line 1469. Path::Tiny::Error::throw('Path::Tiny::Error', 'open (<)', 666, 'No + such file or directory') called at C:/citrusperl/site/lib/Path/Tiny. +pm line 126 Path::Tiny::_throw('Path::Tiny=ARRAY(0xabe0a4)', 'open (<)') calle +d at C:/citrusperl/site/lib/Path/Tiny.pm line 740 Path::Tiny::filehandle('Path::Tiny=ARRAY(0xabe0a4)', 'HASH(0xae824 +c)', '<', undef) called at C:/citrusperl/site/lib/Path/Tiny.pm line 9 +00 Path::Tiny::lines('Path::Tiny=ARRAY(0xabe0a4)') called at - line 5 main::r(666) called at - line 4 main::g(666) called at - line 3 main::f(666) called at - line 6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: search and replace strings in different files in a directory
by PitifulProgrammer (Acolyte) on Sep 02, 2014 at 09:33 UTC | |
by PitifulProgrammer (Acolyte) on Sep 02, 2014 at 12:12 UTC | |
by Anonymous Monk on Sep 03, 2014 at 01:19 UTC | |
by PitifulProgrammer (Acolyte) on Sep 03, 2014 at 07:14 UTC | |
by Anonymous Monk on Sep 03, 2014 at 08:14 UTC | |
|