Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I am very new to Perl, and don't know how to debug this error

There are checklists for that , I use them all the time (don't be fooled by the titles), Basic debugging checklist , brian's Guide to Solving Any Perl Problem, CGI Help Guide , Troubleshooting Perl CGI scripts ... More generic advice :) On debugging, verify everything, talk to teddybear ... checklists and more , perltrap, perltrap, Common Perl Pitfalls / perltrap

"permission denied" is about as clear as it can get: Q: can I have this cookie? A: No.

its because readdir does NOT return the complete path and you forgot to chdir

readdir is very low level, if you use Path::Tiny it can even do the die-ing for you, ex

$ perl -e " use Path::Tiny qw/ path /; path(qw/./)->openrw_raw; " Error open (+<:raw) on '.': Permission denied at -e line 1.

Then you can write functions that take arguments like this

#!/usr/bin/perl -- use strict; use warnings; use POSIX(); use Path::Tiny qw/ path /; Main( @ARGV ); exit( 0 ); sub Main { my $date = POSIX::strftime('%Y-%m-%d', localtime); my $dirp = path( 'f:/lawprod/law/prd9/work/COMDATAFILE/IN/' ); my $diri = $dirp->iterator( { qw/ recurse 0 / }); while( my $file = $diri->() ){ if( $file =~ /^\Q$threenodes\E/ ){ FrobnicateInnoculate( $file->openrw_raw ); } } } sub FrobnicateInnoculate { my( $filehandle ) = @_; ... close $filehandle; }

cpan Path::Tiny

perlintro#Simple matching, quotemeta, eq for string comparison not == (because perlnumber), http://p3rl.orrg/POSIX#strftime

chromatics free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too.
Learn Perl in about 2 hours 30 minutes
Beginning Perl (free) Chapter 6: Files and Data


In reply to Re: error on file open by Anonymous Monk
in thread error on file open by maynard517

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [usemodperl]: yea but http only has tar.gz, i wanna download modules with core perl, but http seems to make it impossible, that's my only question, how to find http mirrors like meta, or how to do it with core perl, but options now seem totally broken (on purpose :-(
    marto wanders off
    [usemodperl]: Corion it's really not misguided, it's the only way, to do something... wonderful IMHO
    [Corion]: usemodperl: Why don't you set up your own (http-only) CPAN mirror? Or just fatpack your scripts? I wonder what problem you're trying to solve here.
    [usemodperl]: don't worry about that, it's really cool, i promise!
    [Corion]: usemodperl: Well, if the world changes and makes your "wonderful" approach not work anymore, you can either change your approach, or change the world. You seem to want to change others instead.
    [usemodperl]: no dude i'm just asking how to access meta via http and you are getting defensive for some reason (did you turn off http at meta? :-)
    [choroba]: why do you need to access metacpan via http?
    [usemodperl]: stop asking why, just say how
    usemodperl pulls teeth...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (9)
    As of 2018-06-24 16:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?



      Results (126 votes). Check out past polls.

      Notices?