Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > perl.beginners > #19294

Is this bit of scrip a reasonable way to test something

Newsgroups perl.beginners
Subject Is this bit of scrip a reasonable way to test something
Date 2022-01-02 22:28 -0500
Message-ID <87h7al33bb.fsf@local.lan> (permalink)
From beginners@perl.org (hput via beginners)

Show all headers | View raw


I was just coding in in ksh93 for simple script but tangled up with
way matching and regex work in ksh93.

Finally trashed it turned to perl.

Just have familiarity with one way of test in shell script:

Put it in an if clause like (in shell):


  if [ cd somedir ];then
    print "ok permissions were good to enter somedir"
  fi

-------       -------       ---=---       -------       ------- 
Wanting to see if an encrypted dir is open
-------       -------       ---=---       -------       ------- 

  #!/usr/local/bin/perl

  use strict;
  use warnings;

  my $loc = './s';

  print "Testing with `chdir', if my perms are good to enter $loc\n";

  if (chdir $loc) {
    print "my perms  worked to enter <$loc>\n";
  }

Is this a reasonable way to do this or am I missing some thing that
will be quicker and more `perl' like?

Back to perl.beginners | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Is this bit of scrip a reasonable way to test something beginners@perl.org (hput via beginners) - 2022-01-02 22:28 -0500
  Re: Is this bit of scrip a reasonable way to test something vlado@dnlp.ca (Vlado Keselj) - 2022-01-03 01:43 -0400

csiph-web