Dear Monnks,

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.

It is a bit frustrating, but we would not be humans if we could not learn from mistakes. Anyway, you kindly offered your help in your last reply and I think I need it (again), since I cannot figure out the current error messages I have been getting

First message is Cygwin-related (not sure if this is the right place, should I open a new post?).

What I can figure out is that Cygwin won't install the module, but I have not idea why, since any other installation of perl modules on this machine worked like a charm.

NE Configuring S/SM/SMUELLER/PathTools-3.47.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Cwd Writing MYMETA.yml and MYMETA.json SMUELLER/PathTools-3.47.tar.gz /usr/bin/perl Makefile.PL -- OK Running make for S/SM/SMUELLER/PathTools-3.47.tar.gz cp lib/File/Spec/OS2.pm blib/lib/File/Spec/OS2.pm cp lib/File/Spec/Mac.pm blib/lib/File/Spec/Mac.pm cp lib/File/Spec/VMS.pm blib/lib/File/Spec/VMS.pm cp lib/File/Spec/Functions.pm blib/lib/File/Spec/Functions.pm cp lib/File/Spec/Epoc.pm blib/lib/File/Spec/Epoc.pm cp lib/File/Spec/Cygwin.pm blib/lib/File/Spec/Cygwin.pm cp lib/File/Spec.pm blib/lib/File/Spec.pm cp Cwd.pm blib/lib/Cwd.pm cp lib/File/Spec/Unix.pm blib/lib/File/Spec/Unix.pm cp lib/File/Spec/Win32.pm blib/lib/File/Spec/Win32.pm Running Mkbootstrap for Cwd () chmod 644 Cwd.bs /usr/bin/perl.exe /usr/lib/perl5/5.14/ExtUtils/xsubpp -typemap /usr/l +ib/perl5/5.14/ExtUtils/typemap Cwd.xs > Cwd.xsc && mv Cwd.xsc Cwd.c gcc-4 -c -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g -fno-strict-ali +asing -pipe -fstack-protector -DUSEIMPORTLIB -O3 -DVERSION=\"3.47\" + -DXS_VERSION=\"3.47\" "-I/usr/lib/perl5/5.14/i686-cygwin-threads-64 +int/CORE" -DDOUBLE_SLASHES_SPECIAL=0 Cwd.c /bin/sh: gcc-4: Kommando nicht gefunden. Makefile:367: recipe for target 'Cwd.o' failed make: *** [Cwd.o] Error 127 SMUELLER/PathTools-3.47.tar.gz make -- NOT OK Failed during this command: SMUELLER/PathTools-3.47.tar.gz : make NO cpan[2]>

I switched to my DOS cmd and thought this would work out, however, when running the script, I got this error message

c:\dev>perl script.pl Wide character in die at C:/strawberry/perl/site/lib/Path/Tiny.pm line + 1492. Error opendir on '´╗┐Z:/../file.xml': Invalid argument at +script.pl line 57.

line 57 in the script would be the line with ->children qr/.../(*.xml), which retrieves the xml files:

sub RetrieveAndBackupXML { #~ my( $directory ) = @_; ## same as shift @_ ## same as shift my $directory = shift; my $date = POSIX::strftime( '%Y-%m-%d', localtime ); #sets cu +rrent date and time to be added to backup file my $bak = "$date.bak"; #date added to the .bak file my @xml_files = path( $directory )->children( qr/\.xml$/ ); for my $file ( @xml_files ) { Replace( $file, "$file-$bak" ); #sub Replace using it's 2 para +meters as defined below } }

Those xml-files are unicode, so I am wondering why I am getting this wide character message again

Would be grand if you guys could assist me in this matter, if you need more information about the code or my system let me know.

Kind regards

C.

In reply to Re^11: search and replace strings in different files in a directory by PitifulProgrammer
in thread search and replace strings in different files in a directory by PitifulProgrammer

Title:
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, details, 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, summary, 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.