in reply to Re^2: Recover a path from a config file
in thread Recover a path from a config file

I don't want to get into that example in too much detail as it serves no proper purpose. However, I do have issues with it, for example the local $/ doesn't assign anything so doesn't do anything. Meanwhile I have been thinking what would a proper solution be and I keep getting back to the fact that this is not the best way write a config file. Better would be to have
{ folder => 'path',
in the following hash, instead of
my $folder = 'path';
In any case, unless the config file is used to load all configuration data rather than pick just one item, then it is being misused as well as ill-conceived. There are two types of config file. The language portable one that is just a list of identifiers followed by their values and the "normal" perl way: a class-qualified symbol and a hash assigned to it, which is intended to be loaded in easily enough using just one "require" statement.

Unfortunately, the OP seems to be suffering from an organisation culture that stubbornly resists change even to fix bad implementations. In the wider Perl community we know who they are by reputation and simply avoid working there!

One world, one people

Replies are listed 'Best First'.
Re^4: Recover a path from a config file
by BrowserUk (Patriarch) on Jun 07, 2016 at 14:06 UTC
    for example the local $/ doesn't assign anything so doesn't do anything.

    local $/; has the effect of setting $/ to undef; thus the subsequent <$fh> reads the entire file. (Slurps it per the comment.)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.
      thanks for that browser. I would still advocate assigning undef to it explicitly though for clarity.
      local $/ = undef; $slurp = <fh>;
      is in fact the example given in perlsub and I feel with good reason.

      One world, one people

        Do you write: my $c = undef; for all your lexicals?

        local declares & initialises a new, scoped copy of a variable.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
        In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.
Re^4: Recover a path from a config file
by Chaoui05 (Scribe) on Jun 07, 2016 at 14:59 UTC

    Thanks for the improvements.

    Problem is that i am not allowed to touch config.file.I use this kind of config.file in order to improve my Perl approach.

     unless the config file is used to load all configuration data rather than pick just one item

    Yes, it is the case in part

     In the wider Perl community we know who they are by reputation and simply avoid working there!

    Hope i will be one of this wider community !

    Thanks

    *****Lost in translation****TIMTOWTOI****