Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Script error after PAR

by MorayJ (Beadle)
on Feb 12, 2013 at 22:22 UTC ( #1018457=perlquestion: print w/replies, xml ) Need Help??
MorayJ has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks

I have a script in which I use Cwd to get the current directory (getcwd) and then open a file in that directory.

This seems to work fine when running under perl. But when I use pp on it to package it so it can run independently, it returns the message ' no such file or directory' when trying to create the file that worked before.

Is it expected for par to bring in differences, or is there something obvios I'm overlooking?

Thanks for your time


Replies are listed 'Best First'.
Re: Script error after PAR
by Anonymous Monk on Feb 13, 2013 at 08:09 UTC

    Is it expected for par to bring in differences, or is there something obvios I'm overlooking?

    Yes, par brings in a different environment,

    Yes, you're overlooking something obvious :)

      Hmmmm, ok. I've done a couple of other scripts using PAR/pp and they have worked as they did pre-executable.

      Would you be kind enough to point out what I am missing? I can't see anything about having to make changes to a script to make it suitable so don't know where to look.


Re: Script error after PAR
by MorayJ (Beadle) on Feb 13, 2013 at 20:12 UTC

    Me again!

    Right, I didn't really give enough information here, but it looks like the problem was that opening a file with >:encoding(utf8) just works when run through the perl interpreter.

    You need to have use Encoding in the script for par to work with it.



      Indeed, I didn't!

      Thanks for the tip.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1018457]
Approved by davido
[Discipulus]: 2 weekends ago LanX
[Lotus1]: cb is nsfw this morning
[Lotus1]: I wonder if ascii art would work in the cb....
[jedikaiti]: lolol
Tux looks up his status to find being an Abbot
[choroba]: pm-cb-g now shows the number of unread messages, commit on its way to github
[Tux]: choroba any plans for highlight patterns?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2017-09-20 16:02 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (237 votes). Check out past polls.