Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello ovedpo15,

> Always when I run my tests I get:

probably something related with tests path? Is $pack a full path or a relative one? Is a temp dir?

Depending on the OS there are method to see who is maintaining the file open. I suppose you are on linux.. If not inspect also $^E to see last system error.

Your open is better written (as already pointed) in the 3 form; this as the avantage to have the path at disposition when printing errors.

You can also try to see if fileno returns something. Avoid also unnecessary parentheses

my $full_path = '/path/to/file'; #open my $fh, '>', $full_path or die "Unable to open [$full_path] to w +rite!"; # see tinita below.. open my $fh, '>', $full_path or die "Unable to open [$full_path] to wr +ite! $!"; ... # this one or some variation.. close $fh or warning "unable to close [$full_path] $! fileno: ".(filen +o $fh)." -e ".(-e $full_path); # more checks on directory? die if fileno $fh;

PS you have a typo in the title: correct it for future seekers

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Failed to close file -- tests by Discipulus
in thread Failed to close file by ovedpo15

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-26 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found