Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^6: rename to UTF8 filename

by exilepanda (Monk)
on Jul 31, 2012 at 04:06 UTC ( #984561=note: print w/ replies, xml ) Need Help??


in reply to Re^5: rename to UTF8 filename
in thread rename to UTF8 filename

Thanks Man! It works now, and inspires a lot! I found I have 2 problem here.

1. If I don't use Path::Class, Win32::Unicode::File cannot survive on it's own. It ends up with Undefined subroutine.... when I call moveW()( How do you know that?? ). And I found the errorW(), dieW() won't work at all. Not sure if I missed something when I download this module via ppm.

2. I forgot the BOM char in my text list. It ends up by messing the file name and so File not found. After adding read ( F, $_, 1 ), then start to read. It reads correctly and moveW works!

But then, would you point out where absolute() and basename() method import from? I can't find it in the perldoc where the modules you used.

Anyway, thank you very much!


Comment on Re^6: rename to UTF8 filename
Select or Download Code
Re^7: rename to UTF8 filename
by Anonymous Monk on Aug 13, 2012 at 10:53 UTC

    If I don't use Path::Class, Win32::Unicode::File cannot survive on it's own. It ends up with Undefined subroutine.... when I call moveW()( How do you know that?? ).

    What does that mean?

    $ perl -E " use Win32::Unicode::File; use Data::Dump; dd \@Win32::Unic +ode::File::EXPORT, \&moveW ; moveW()" ( [ "file_type", "file_size", "copyW", "moveW", "unlinkW", "touchW", "renameW", "statW", "utimeW", ], sub { ... }, ) Usage: moveW(from, to [, over]) at -e line 1.

    And I found the errorW(), dieW() won't work at all. Not sure if I missed something when I download this module via ppm.

    You sure?

    $ perl -E " use Win32::Unicode; use Data::Dump; errorW(); dd [ $@, er +rorW() ]; eval { moveW() }; dd [ $@, errorW()]; eval { moveW(qw{ . . + }) }; dd[$@, errorW()]; dieW 666;" ["", "The handle is invalid."] [ "Usage: moveW(from, to [, over]) at -e line 1.\n", "The handle is invalid.", ] ["", "The handle is invalid."] 666 at -e line 1.

    But then, would you point out where absolute() and basename() method import from? I can't find it in the perldoc where the modules you used.

    Path::Class gives you Path::Class::File and Path::Class::Dir objects

    $ perl -MPath::Class -E " say file(1) " 1 $ perl -MPath::Class -E " say ref file(1) " Path::Class::File $ perl -MPath::Class -MData::Dump -E " dd file(1) " bless({ dir => undef, file => 1, file_spec_class => undef }, "Path::Cl +ass::File") $ perl -MPath::Class -E " say file(1)->basename " 1 $

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-10-20 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (75 votes), past polls