Data-Table-Text

 view release on metacpan or  search on metacpan

lib/Data/Table/Text.pm  view on Meta::CPAN

  \%h
 } # readFiles

sub includeFiles($)                                                             # Read the given file and expand all lines that start "includeThisFile " with the file named by the rest of the line and keep doing this until all the included files have...
 {my ($expand) = @_;                                                            # File to expand
  my  %expanded;                                                                # Files already expanded

  my @l = readFile $expand;                                                     # Read the first file
  for my $i(1..99)                                                              # Limit on the number of expansion passes
   {my @L; my $changed = 0;                                                     # Latest expansion
    for my $l(@l)                                                               # Each line
     {if ($l =~ m(\AincludeThisFile\s(.*)\Z))
       {my $f = $1;
        confess "No such file:\n$f\n"          unless -e $f;
        confess "File already included:\n$f\n" if $expanded{$f}++;
        push @L, readFile $f;
        ++$changed;
       }
      else
       {push @L, $l;
       }
     }
    return @l unless $changed;                                                  # Return array of expanded lines if expansion is now complete
    @l = @L;
   }
  confess "Expansion too deep";
 } # includeFiles

sub appendFile($$)                                                              # Append to B<$file> a B<$string> of L<unicode> content encoded with L<utf8>, creating the $file first if necessary. Return the name of the $file on success else confess....
 {my ($file, $string) = @_;                                                     # File to append to, string to append
  $file or confess "No file name supplied\n";
  $string or carp "No string for file:\n$file\n";
  makePath($file);
  open my $F, ">>$file" or
    confess "Cannot open file for write file:\n$file\n$!\n";
  binmode($F, ":utf8");
  flock($F, 2);
  print  {$F} $string;
  close  ($F);
  -e $file or confess "Failed to write to file:\n$file\n";
  $file
 } # appendFile

sub createEmptyFile($)                                                          # Create an empty file unless the file already exists and return the name of the file else confess if the file cannot be created.
 {my ($file) = @_;                                                              # File to create or B<undef> for a temporary file
  $file //= temporaryFile;
  return $file if -e $file;                                                     # Return file name as proxy for success if file already exists
  makePath($file);
  open my $F, ">$file" or confess "Cannot create empty file:\n$file\n$!\n";
  binmode($F);
  print  {$F} '';
  close  ($F);
  -e $file or confess "Failed to create empty file:\n$file\n";
  $file                                                                         # Return file name on success
 } # createEmptyFile

sub binModeAllUtf8                                                              #P Set STDOUT and STDERR to accept utf8 without complaint.
 {binmode $_, ":utf8" for *STDOUT, *STDERR;
 }

sub setPermissionsForFile($$)                                                   # Apply L<chmod> to a B<$file> to set its B<$permissions>.
 {my ($file, $permissions) = @_;                                                # File, permissions settings per chmod
  return undef unless confirmHasCommandLineCommand(q(chmod));                   # Confirm we have chmod
  qx(chmod $permissions $file);                                                 # Use chmod to set permissions
 }

sub numberOfLinesInFile($)                                                      # Return the number of lines in a file.
 {my ($file) = @_;                                                              # File
  scalar split /\n/, readFile($file);                                           # Number of lines
 } # numberOfLinesInFile

sub overWriteHtmlFile($$)                                                       # Write an L<html> file to /var/www/html and make it readable.
 {my ($file, $data) = @_;                                                       # Target file relative to /var/www/html, data to write
  my $s = writeTempFile($data);
  my $t = fpf(q(/var/www/html/), $file);
  xxx qq(sudo mv $s $t; chmod o+r $t);
  unlink $s;
 }

sub overWritePerlCgiFile($$)                                                    # Write a L<Perl> file to /usr/lib/cgi-bin and make it executable after checking it for syntax errors.
 {my ($file, $data) = @_;                                                       # Target file relative to /var/www/html, data to write
  my $s = writeTempFile($data);
  my $r = qx(perl -c $s 2>&1);
  if ($r =~ m(syntax OK)si)
   {my $t = fpf(q(/usr/lib/cgi-bin/), $file);
    say STDERR qx(sudo mv $s $t; chmod o+rx $t);
   }
  else
   {my @data = map {[$_]} split m/\n/, $data;
    say STDERR formatTable([@data]);
    confess "Perl error:\n$r\n";
   }
  unlink $s;
 }

#D2 Copy                                                                        # Copy files and folders. The B<\Acopy.*Md5Normalized.*\Z> methods can be used to ensure that files have collision proof names that collapse duplicate content even when c...

sub copyFile($$)                                                                # Copy the B<$source> file encoded in utf8 to the specified B<$target> file in and return $target.
 {my ($source, $target) = @_;                                                   # Source file, target file
  owf($target, readFile($source));
  my $s = fileSize($source);
  my $t = fileSize($target);
  $s eq $t or lll
    "Copied file has a different size\n".formatTable
    ([[$s, $source], [$t, $target]], <<END);
Size Size of file
File Name of file
END
  $target                                                                       # Return target file name
 }

sub moveFileNoClobber($$)                                                       # Rename the B<$source> file, which must exist, to the B<$target> file but only if the $target file does not exist already.  Returns 1 if the $source file was successfull...
 {my ($source, $target) = @_;                                                   # Source file, target file
  if (-e $source and !-e $target)                                               # Rename possible
   {rename $source, $target;
    return 1;
   }
  0                                                                             # Rename not possible
 }

sub moveFileWithClobber($$)                                                     # Rename the B<$source> file, which must exist, to the B<$target> file but only if the $target file does not exist already.  Returns 1 if the $source file was successfull...
 {my ($source, $target) = @_;                                                   # Source file, target file
  if (-e $source)                                                               # Source file exists so rename
   {unlink $target;
    rename $source, $target;
    return 1;
   }
  0                                                                             # No such source file
 }

sub copyFileToFolder($$)                                                        # Copy the file named in B<$source> to the specified B<$targetFolder/> or if $targetFolder/ is in fact a file into the folder containing this file and return the target f...
 {my ($source, $targetFolder) = @_;                                             # Source file, target folder
  writeFile fpf(fp($targetFolder), fne($source)), readFile $source;
 }

sub nameFromStringMaximumLength {128}                                           #P Maximum length of a name generated from a string.

sub nameFromString($%)                                                          # Create a readable name from an arbitrary string of text.
 {my ($string, %options) = @_;                                                  # String, options

  my @name;
  if ($string =~ m(<(bookmap))s)                                                # The ghastly compromise
   {push @name, q(bm);
   }
  elsif ($string =~ m(<(bookmap|concept|glossentry|html|map|reference|task))s)  # The correct solution
   {push @name, substr($1, 0, 1);

lib/Data/Table/Text.pm  view on Meta::CPAN

    return ($c) | ($d<<8) | 0x80C0;
   }

  if ($c <= (1 << 16))                                                          # 3 bytes
   {my $e = ($c >>  0) & 0x3f;
    my $d = ($c >>  6) & 0x3f;
       $c = ($c >> 12);

    return ($c) | ($d<<8) | ($e<<16) | 0x8080E0
   }

  if ($c <= (1 << 21))                                                          # 4 bytes
   {my $f = ($c >>  0) & 0x3f;
    my $e = ($c >>  6) & 0x3f;
    my $d = ($c >> 12) & 0x3f;
       $c = ($c >> 18);
    return ($c) | ($d<<8) | ($e<<16) | ($f<<24) | 0x808080F0
   }

  confess "Invalid utf32 code: $c";
 }

#D1 System Constants                                                            # Extract system constants

my %getSystemConstantsFromIncludeFile;                                          # Cache system constants

sub getSystemConstantsFromIncludeFile($@)                                       # Get the value of the named system constants from an include file.
 {my ($file, @constants) = @_;                                                  # File to read, constants to get

  my %i;                                                                        # Unknown constants
  my %o;                                                                        # Known constants
  for my $c(@constants)                                                         # Classify constants requested between known and unknown
   {if (my $r = $getSystemConstantsFromIncludeFile{$c})
     {$o{$c} = $r;
     }
    else
     {$i{$c}++
     }
   }

  my @code = <<END;                                                             # Program to get constants we do not already have
#include <$file>
#include <stdio.h>
int main(void) {
  printf("{\\n");
END

  for my $c(sort keys %i)                                                       # Constants we still need
   {push @code, <<END
printf("\\\"$c\\\" => %ld,\\n", (long)$c);
END
   }

  push @code, <<END;
  printf("}\\n");
  return 0;
 }
END
  my $C = &getCCompiler;                                                        # Get C compiler
  my $c = owf(q(zzzTemporary.c), join "\n", @code);                             # Write and run a program to get the values
  my $r = eval qx($C $c; chmod ugo+x a.out; ./a.out; rm a.out);
  unlink $c;
  for my $c(sort keys %$r)                                                      # Update known constants
   {$o{$c} = $getSystemConstantsFromIncludeFile{$c} = $$r{$c}
   }

  %o
 }

my %getStructureSizeFromIncludeFile;                                            # Cache system structure sizes

sub getStructureSizeFromIncludeFile($$)                                         # Get the size of a system structure from an include file.
 {my ($file, $structure) = @_;                                                  # File to read, structure name

  return      $getStructureSizeFromIncludeFile{$structure}
    if exists $getStructureSizeFromIncludeFile{$structure};

  my @code = <<END;                                                             # Program to get constants we do not already have
#include <$file>
#include <stdio.h>
int main(void) {
  printf("%ld\\n", (long)sizeof($structure));
  return 0;
 }
END

  my $C = &getCCompiler;                                                        # Get C compiler
  my $c = owf(q(zzzTemporary.c), join "\n", @code);                             # Write and run a program to get the values
  my $r = eval qx($C $c; chmod ugo+x a.out; ./a.out; rm a.out);
  $getStructureSizeFromIncludeFile{$c} = $r;
 }

my %getFieldOffsetInStructureFromIncludeFile;                                   # Cache system field offsets

sub getFieldOffsetInStructureFromIncludeFile($$$)                               # Get the offset of a field in a system structures from an include file.
 {my ($file, $structure, $field) = @_;                                          # File to read, structure name, field name

  return      $getFieldOffsetInStructureFromIncludeFile{$structure}
    if exists $getFieldOffsetInStructureFromIncludeFile{$structure};

  my @code = <<END;                                                             # Program to get constants we do not already have
#include <$file>
#include <stdio.h>
int main(void) {
  printf("%ld\\n", (long)&((($structure *)0)->$field));
  return 0;
 }
END

  my $C = &getCCompiler;                                                        # Get C compiler
  my $c = owf(q(zzzTemporary.c), join "\n", @code);                             # Write and run a program to get the values
  my $r = eval qx($C $c; chmod ugo+x a.out; ./a.out; rm a.out);
  $getFieldOffsetInStructureFromIncludeFile{$c} = $r;
 }

#D1 Unix domain communications                                                  # Send messages between processes via a unix domain socket.

sub newUdsr(@)                                                                  #P Create a communicator - a means to communicate between processes on the same machine via L<Udsr::read|/Udsr::read> and L<Udsr::write|/Udsr::write>.
 {my (@parms) = @_;                                                             # Attributes per L<Udsr Definition|/Udsr Definition>
   my $u = genHash(q(Udsr),                                                     # Package name
    client       => undef,                                                      # Client socket and connection socket
    headerLength => 8,                                                          #I Length of fixed header which carries the length of the following message

    serverAction => undef,                                                      #I Server action sub, which receives a communicator every time a client creates a new connection. If this server is going to be started by systemd  as a service with the ...

    serverPid    => undef,                                                      # Server pid which can be used to kill the server via kill q(kill), $pid
    socketPath   => q(unix-domain-socket-test.sock),                            #I Socket file

    serviceName  => q(zzz),                                                     #I Service name for install by systemd
    serviceUser  => q(),                                                        #I Userid for service
    @_
   );
 }

sub newUdsrServer(@)                                                            # Create a communications server - a means to communicate between processes on the same machine via L<Udsr::read|/Udsr::read> and L<Udsr::write|/Udsr::write>.
 {my (@parms) = @_;                                                             # Attributes per L<Udsr Definition|/Udsr Definition>
  my $u = newUdsr(@_);
  my $f = $u->socketPath;
  unlink $f;
  my $s = IO::Socket::UNIX->new(Type=>SOCK_STREAM(), Local=>$f, Listen=>1);     # Create socket
  xxx(qq(chmod ugo=rwx $f));                                                    # Ensure that www-data can read and write to the socket
# lll "Created unix domain socket as user:", qx(/usr/bin/whoami);
  if (my $pid = fork)                                                           # Run the server in a process by itself
   {$u->serverPid = $pid;                                                       # Record server pid so it can be killed
    return $u;
   }
  else                                                                          # Run the server action on a client connection
   {while (my $con = $s->accept())
     {$u->client = $con;
      call sub{$u->serverAction->($u)};                                         # The server action sub should use the read and write routines in the passed communicator to interact with the client .
      $con->close;
     }
    exit;
   }
 }

sub newUdsrClient(@)                                                            # Create a new communications client - a means to communicate between processes on the same machine via L<Udsr::read|/Udsr::read> and L<Udsr::write|/Udsr::write>.
 {my (@parms) = @_;                                                             # Attributes per L<Udsr Definition|/Udsr Definition>
  my $u = newUdsr(@_);
  my $s = $u->client = IO::Socket::UNIX->new(Type=>SOCK_STREAM(), Peer => $u->socketPath);
  my $r1 = $!; my $r2 = $?;
  $s or confess join "\n", "Cannot create unix domain socket:",
    dump($u), dump({q($!)=>$r1, q($?)=>$r2, q(userId)=>qx(/usr/bin/whoami)});
  $u
 }

sub Udsr::write($$)                                                             # Write a communications message to the L<newUdsrServer|/newUdsrServer> or the L<newUdsrClient|/newUdsrClient>.
 {my ($u, $msg) = @_;                                                           # Communicator, message
  my $con = $u->client;
# $msg //= '';                                                                  # undef seems to get reported as wide char
  my $m = pad(length($msg), $u->headerLength).$msg;
  $con or confess "No unix domain socket:\n". dump($u);                         # Complain if the socket has not been created
  $con->print($m);
  $u
 }

sub Udsr::read($)                                                               # Read a message from the L<newUdsrServer|/newUdsrServer> or the L<newUdsrClient|/newUdsrClient>.
 {my ($u) = @_;                                                                 # Communicator
  my $con = $u->client;
  $con->read(my $length, $u->headerLength);
  $con->read(my $data,   $length);
  $data
 }

sub Udsr::kill($)                                                               # Kill a communications server.
 {my ($u) = @_;                                                                 # Communicator
  my $p = $u->serverPid;                                                        # Server Pid
  kill 'KILL', $p if $p;                                                        # Kill server
  $u->serverPid = undef;                                                        # Server Pid
  unlink $u->socketPath;                                                        # Remove socket
  $u
 }

sub Udsr::webUser($$)                                                           # Create a systemd installed server that processes http requests using a specified userid. The systemd and CGI files plus an installation script are written to the specif...
 {my ($u, $folder) = @_;                                                        # Communicator, folder to contain server code

  clearFolder($folder, 9);                                                      # Clear the output folder

  my $parms = join ', ',                                                        # Parameters to hand to server and client
    map {my $v = $$u{$_}; defined($v) ? qq($_ => q($v)) : ()}
    grep {!m/serverAction/} keys %$u;

lib/Data/Table/Text.pm  view on Meta::CPAN

    api             => [q(Application Porgramming Interface(API)),              "https://en.wikipedia.org/wiki/API"                                                                                               ],
    appaapps        => [q(prb.appaapps.com),                                    "http://www.appaaps.com"                                                                                                          ],
    apt             => [q(<b>sudo apt-get</b>),                                 "https://en.wikipedia.org/wiki/APT_(software)"                                                                                    ],
    arm             => [q(Arm),                                                 "https://en.wikipedia.org/wiki/ARM_architecture_family"                                                                           ],
    aramco          => [q(Saudi Aramco),                                        "https://en.wikipedia.org/wiki/Saudi_Aramco"                                                                                      ],
    arena           => [q(arena),                                               "https://en.wikipedia.org/wiki/Region-based_memory_management"                                                                    ],
    arenas          => [q(arenas),                                              "https://en.wikipedia.org/wiki/Region-based_memory_management"                                                                    ],
    arRay           => [q(array),                                               "https://en.wikipedia.org/wiki/Dynamic_array"                                                                                     ],
    arRays          => [q(arrays),                                              "https://en.wikipedia.org/wiki/Dynamic_array"                                                                                     ],
    as400           => [q(as400),                                               "https://en.wikipedia.org/wiki/IBM_System_i"                                                                                      ],
    ascii           => [q(Ascii),                                               "https://en.wikipedia.org/wiki/ASCII"                                                                                             ],
    asic            => [q(application specific integrated circuit),             "https://en.wikipedia.org/wiki/Application-specific_integrated_circuit"                                                           ],
    asimov          => [q(Isaac Asimov),                                        "https://en.wikipedia.org/wiki/Asimov"                                                                                            ],
    asin            => [q(ASIN),                                                "https://en.wikipedia.org/wiki/Amazon_Standard_Identification_Number"                                                             ],
    assemble        => [q(assemble),                                            "https://en.wikipedia.org/wiki/Assembly_language#Assembler"                                                                       ],
    assembler       => [q(assembler),                                           "https://en.wikipedia.org/wiki/Assembly_language#Assembler"                                                                       ],
    assembly        => [q(assembly),                                            "https://en.wikipedia.org/wiki/Assembly_language"                                                                                 ],
    att             => [q(ATT),                                                 "https://www.att.com/internet/fiber/"                                                                                             ],
    audioFile       => [q(audio file),                                          "https://en.wikipedia.org/wiki/Audio_file_format"                                                                                 ],
    automation      => [q(automation),                                          "https://en.wikipedia.org/wiki/Automation"                                                                                        ],
    avx512          => [q(Advanced Vector Extensions),                          "https://en.wikipedia.org/wiki/AVX-512"                                                                                           ],
    avx             => [q(Advanced Vector Extensions),                          "https://en.wikipedia.org/wiki/AVX-512"                                                                                           ],
    awsami          => [q(Amazon Web Services - Amazon Machine Image),          "https://en.wikipedia.org/wiki/Amazon_Machine_Image"                                                                              ],
    awscli          => [q(Amazon Web Services Command Line Interface),          "https://aws.amazon.com/cli/"                                                                                                     ],
    awsforecast     => [q(Amazon Web Services Forecast),                        "https://eu-west-1.console.aws.amazon.com/forecast"                                                                               ],
    aws             => [q(Amazon Web Services),                                 "http://aws.amazon.com"                                                                                                           ],
    az              => [q(Arizona),                                             "https://en.wikipedia.org/wiki/Arizona"                                                                                           ],
    azure           => [q(Azure),                                               "https://en.wikipedia.org/wiki/Microsoft_Azure"                                                                                   ],
    backend         => [q(back end),                                            "https://en.wikipedia.org/wiki/Front_end_and_back_end"                                                                            ],
    bandwidth       => [q(Bandwidth),                                           "https://en.wikipedia.org/wiki/Bandwidth_(computing)"                                                                             ],
    ban             => [q(Briana Ashley Nevarez),                               "https://www.linkedin.com/in/briana-nevarez-b66b621b0/"                                                                           ],
    base64          => [q(base 64 encoding),                                    "https://en.wikipedia.org/wiki/Base64"                                                                                            ],
    bash            => [q(Bash),                                                "https://en.wikipedia.org/wiki/Bash_(Unix_shell)"                                                                                 ],
    bigEndian       => [q(Big Endian),                                          "https://en.wikipedia.org/wiki/Endianness"                                                                                        ],
    binarysearch    => [q(Binary Search),                                       "https://metacpan.org/release/Binary-Heap-Search"                                                                                 ],
    bit             => [q(bit),                                                 "https://en.wikipedia.org/wiki/Bit"                                                                                               ],
    bitBus          => [q(bit bus),                                             "https://en.wikipedia.org/wiki/Bus_(computing)"                                                                                   ],
    bitterend       => [q(Bitter End),                                          "https://en.wikipedia.org/wiki/Knot#Bitter_end"                                                                                   ],
    blackbird       => [q(SR71 BlackBird),                                      "https://en.wikipedia.org/wiki/Lockheed_SR-71_Blackbird"                                                                          ],
    blob            => [q(blob),                                                "https://en.wikipedia.org/wiki/Binary_large_object"                                                                               ],
    bonnevilleDam   => [q(Bonneville Dam),                                      "https://en.wikipedia.org/wiki/Bonneville_Dam"                                                                                    ],
    boolean         => [q(Boolean),                                             "https://en.wikipedia.org/wiki/Boolean_data_type"                                                                                 ],
    boson           => [q(Boson),                                               "https://en.wikipedia.org/wiki/Boson"                                                                                             ],
    browser         => [q(web browser),                                         "https://en.wikipedia.org/wiki/Web_browser"                                                                                       ],
    btree           => [q(B-Tree),                                              "https://en.wikipedia.org/wiki/B-tree"                                                                                            ],
    bubbleSort      => [q(Bubble Sort),                                         "https://en.wikipedia.org/wiki/Bubble_sort"                                                                                       ],
    bulktreeg       => [q(Bulk Tree),                                           "https://github.com/philiprbrenan/TreeBulk"                                                                                       ],
    button          => [q(Button),                                              "https://en.wikipedia.org/wiki/Button_(computing)"                                                                                ],
    buridansDonkey  => [q(Buridan's Donkey),                                    "https://en.wikipedia.org/wiki/Buridan%27s_ass"                                                                                   ],
    camelCase       => [q(camelCase),                                           "https://en.wikipedia.org/wiki/Camel_case"                                                                                        ],
    carbonDioxide   => [q(carbon dioxide),                                      "https://en.wikipedia.org/wiki/Carbon_dioxide"                                                                                    ],
    cauchy          => [q(Augustin Louis Cauchy),                               "https://en.wikipedia.org/wiki/Augustin-Louis_Cauchy"                                                                             ],
    cdk             => [q(cloud development kit),                               "https://aws.amazon.com/cdk/"                                                                                                     ],
    certbot         => [q(Certbot),                                             "https://certbot.eff.org/lets-encrypt/ubuntufocal-apache"                                                                         ],
    cgi             => [q(Common Gateway Interface),                            "https://en.wikipedia.org/wiki/Common_Gateway_Interface"                                                                          ],
    chartjs         => [q(Chart.js),                                            "https://www.chartjs.org/"                                                                                                        ],
    chatgpt         => [q(Chat GPT),                                            "https://platform.openai.com/docs/guides/text-generation"                                                                         ],
    china           => [q(Made In China),                                       "https://www.made-in-china.com/"                                                                                                  ],
    siliconChip     => [q(chip),                                                "https://en.wikipedia.org/wiki/Integrated_circuit"                                                                                ],
    chips           => [q(chips),                                               "https://en.wikipedia.org/wiki/Integrated_circuit"                                                                                ],
    chmod           => [q(chmod),                                               "https://linux.die.net/man/1/chmod"                                                                                               ],
    chown           => [q(chown),                                               "https://linux.die.net/man/1/chown"                                                                                               ],
    cicd            => [q(CI/CD),                                               "https://en.wikipedia.org/wiki/Continuous_integration"                                                                            ],
    CICS            => [q(CICS),                                                "https://en.wikipedia.org/wiki/CICS"                                                                                              ],
    cicero          => [q("The sinews of war are an infinite supply of money"), "https://en.wikipedia.org/wiki/Cicero#Legacy"                                                                                     ],
    cloudComputing  => [q(Cloud Computing),                                     "https://en.wikipedia.org/wiki/Cloud_computing"                                                                                   ],
    co2             => [q(Carbon Dioxide),                                      "https://en.wikipedia.org/wiki/Carbon_dioxide"                                                                                    ],
    codeMentor      => [q(Code Mentor),                                         "https://www.codementor.io/"                                                                                                      ],
    codementor      => [q(Codementor),                                          'https://www.codementor.io/@philiprbrenan'                                                                                        ],
    codeMentor      => [q(Codementor),                                          'https://www.codementor.io/@philiprbrenan'                                                                                        ],
    code            => [q(code),                                                "https://en.wikipedia.org/wiki/Computer_program"                                                                                  ],
    commandline     => [q(command line),                                        "https://en.wikipedia.org/wiki/Command-line_interface"                                                                            ],
    commandLine     => [q(command line),                                        "https://en.wikipedia.org/wiki/Command-line_interface"                                                                            ],
    comment         => [q(comment),                                             "https://en.wikipedia.org/wiki/Comment_(computer_programming)"                                                                    ],
    comparator      => [q(comparator),                                          "https://en.wikipedia.org/wiki/Digital_comparator"                                                                                ],
    computer        => [q(computer),                                            "https://en.wikipedia.org/wiki/Computer"                                                                                          ],
    compuware       => [q(Compuware),                                           "https://en.wikipedia.org/wiki/Compuware",                                                                                        ],
    concept         => [q(concept),                                             "http://docs.oasis-open.org/dita/dita/v1.3/errata02/os/complete/part3-all-inclusive/langRef/technicalContent/concept.html#concept"],
    confess         => [q(confess),                                             "http://perldoc.perl.org/Carp.html#SYNOPSIS/"                                                                                     ],
    conicSection    => [q(Conic Sections),                                      "https://en.wikipedia.org/wiki/Conic_section"                                                                                     ],
    conref          => [q(conref),                                              "http://docs.oasis-open.org/dita/dita/v1.3/errata02/os/complete/part3-all-inclusive/archSpec/base/conref.html#conref"             ],
    conwayLaw       => [q(Conway's Law),                                        "https://en.wikipedia.org/wiki/Conway%27s_law"                                                                                    ],
    cookie          => [q(cookie),                                              "https://en.wikipedia.org/wiki/Cookie"                                                                                            ],
    corpus          => [q(corpus),                                              "https://en.wikipedia.org/wiki/Text_corpus"                                                                                       ],
    coverage        => [q(coverage),                                            "https://en.wikipedia.org/wiki/Code_coverage"                                                                                     ],
    cpan            => [q(CPAN),                                                "https://metacpan.org/author/PRBRENAN"                                                                                            ],
    cpl             => [q(C programming language),                              "https://b-ok.xyz/book/633119/db5c78"                                                                                             ],
    cpp             => [q(C++ programming language),                            "https://en.wikipedia.org/wiki/C%2B%2B"                                                                                           ],
    cpu             => [q(CPU),                                                 "https://en.wikipedia.org/wiki/Central_processing_unit"                                                                           ],
    cpus            => [q(CPUs),                                                "https://en.wikipedia.org/wiki/Central_processing_unit"                                                                           ],
    cray            => [q(Cray),                                                "https://en.wikipedia.org/wiki/Cray"                                                                                              ],
    cron            => [q(cron),                                                "https://en.wikipedia.org/wiki/Cron"                                                                                              ],
    css             => [q(Cascading Style Sheets),                              "https://en.wikipedia.org/wiki/CSS"                                                                                               ],
    csv             => [q(csv),                                                 "https://en.wikipedia.org/wiki/Comma-separated_values"                                                                            ],
    curl            => [q(curl),                                                "https://linux.die.net/man/1/curl"                                                                                                ],
    cvs             => [q(Concurrent Versions System),                          "https://people.redhat.com/~jlaska/documentation-guide-en/ch-cvs.html"                                                            ],
    dag             => [q(DAG),                                                 "https://en.wikipedia.org/wiki/Directed_acyclic_graph"                                                                            ],
    darpa           => [q(DARPA),                                               "https://en.wikipedia.org/wiki/DARPA"                                                                                             ],
    davidSuzuki     => [q(David Suzuki),                                        "https://en.wikipedia.org/wiki/David_Suzuki"                                                                                      ],
    daTa            => [q(data),                                                "https://en.wikipedia.org/wiki/Data"                                                                                              ],
    dataBase        => [q(database),                                            "https://en.wikipedia.org/wiki/Database"                                                                                          ],
    dataCenter      => [q(Data Center),                                         "https://en.wikipedia.org/wiki/Data_center"                                                                                       ],
    dataStructure   => [q(data structure),                                      "https://en.wikipedia.org/wiki/Data_structure"                                                                                    ],
    db2             => [q(DB2),                                                 "https://en.wikipedia.org/wiki/IBM_Db2_Family"                                                                                    ],
    dbi             => [q(DBI),                                                 "https://dbi.perl.org/"                                                                                                           ],
    ddg             => [q(DuckDuckGo),                                          "https://www.duckduckgo.com"                                                                                                      ],
    ddt             => [q(Data::Table::Text),                                   "https://metacpan.org/pod/Data::Table::Text"                                                                                      ],
    debug           => [q(debug),                                               "https://en.wikipedia.org/wiki/Debugging"                                                                                         ],
    decartes        => [q(Renee Descartes),                                     "https://en.wikipedia.org/wiki/Ren%C3%A9_Descartes"                                                                               ],
    dependencies    => [q(dependencies),                                        "https://en.wikipedia.org/wiki/Coupling_(computer_programming)"                                                                   ],
    dexl            => [q(Data::Edit::Xml::Lint),                               "https://metacpan.org/release/Data-Edit-Xml-Lint"                                                                                 ],
    dex             => [q(Data::Edit::Xml),                                     "https://metacpan.org/pod/Data::Edit::Xml"                                                                                        ],
    dexr            => [q(Data::Edit::Xml::Reuse),                              "https://metacpan.org/release/Data-Edit-Xml-Reuse"                                                                                ],
    dexx            => [q(Data::Edit::Xml::Xref),                               "https://metacpan.org/release/Data-Edit-Xml-Xref"                                                                                 ],
    dfa             => [q(DFA),                                                 "https://metacpan.org/pod/Data::DFA"                                                                                              ],
    dhahran         => [q(Dhahran),                                             "https://en.wikipedia.org/wiki/Dhahran"                                                                                           ],
    dictionary      => [q(dictionary),                                          "https://en.wikipedia.org/wiki/Associative_array"                                                                                 ],
    die             => [q(die),                                                 "http://perldoc.perl.org/functions/die.html"                                                                                      ],
    digit           => [q(numeric digit),                                       "https://en.wikipedia.org/wiki/Numerical_digit"                                                                                   ],
    diff            => [q(diff),                                                "https://en.wikipedia.org/wiki/Diff"                                                                                              ],
    diospiros       => [q(diospiros),                                           "https://en.wikipedia.org/wiki/Persimmon"                                                                                         ],

lib/Data/Table/Text.pm  view on Meta::CPAN

    my $F = writeTempFile(qw(aaa bbb));
    is_deeply [readFile $F], ["aaa
", "bbb
"];

    eval {writeFile($f,  q(ccc))};
    ok $@ =~ m(File already exists:)i;

    overWriteFile($F,    q(ccc));
    ok   readFile($F) eq q(ccc);

    unlink $f, $F;


=head3 createEmptyFile ($file)

Create an empty file unless the file already exists and return the name of the file else confess if the file cannot be created.

     Parameter  Description
  1  $file      File to create or B<undef> for a temporary file

B<Example:>


    my $D = temporaryFolder;
    ok  -d $D;

    my $d = fpd($D, q(ddd));
    ok !-d $d;


    my @f = map {createEmptyFile(fpe($d, $_, qw(txt)))} qw(a b c);  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

    is_deeply [sort map {fne $_} findFiles($d, qr(txt\Z))], [qw(a.txt b.txt c.txt)];

    my @D = findDirs($D);
    my @e = ($D, $d);
    my @E = sort @e;
    is_deeply [@D], [@E];

    is_deeply [sort map {fne $_} searchDirectoryTreesForMatchingFiles($d)],
              ["a.txt", "b.txt", "c.txt"];

    is_deeply [sort map {fne $_} fileList(prefferedFileName "$d/*.txt")],
              ["a.txt", "b.txt", "c.txt"];

    ok -e $_ for @f;

    is_deeply scalar(searchDirectoryTreeForSubFolders $D), 2;

    my @g = fileList(qq($D/*/*.txt));
    ok @g == 3;

    clearFolder($D, 5);
    ok onWindows ? 1 : !-e $_ for @f;
    ok onWindows ? 1 : !-d $D;


=head3 setPermissionsForFile   ($file, $permissions)

Apply L<chmod|https://linux.die.net/man/1/chmod> to a B<$file> to set its B<$permissions>.

     Parameter     Description
  1  $file         File
  2  $permissions  Permissions settings per chmod

B<Example:>


  if (1)
   {my $f = temporaryFile();

    setPermissionsForFile($f, q(ugo=r));  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

    my $a = qx(ls -la $f);
    ok $a =~ m(-r--r--r--)s;

    setPermissionsForFile($f, q(u=rwx));  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

    my $b = qx(ls -la $f);
    ok $b =~ m(-rwxr--r--)s;
   }


=head3 numberOfLinesInFile ($file)

Return the number of lines in a file.

     Parameter  Description
  1  $file      File

B<Example:>


    my $f = writeFile(undef, "a
b
");


    ok numberOfLinesInFile($f) == 2;                                                # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲



=head3 overWriteHtmlFile   ($file, $data)

Write an L<HTML|https://en.wikipedia.org/wiki/HTML> file to /var/www/html and make it readable.

     Parameter  Description
  1  $file      Target file relative to /var/www/html
  2  $data      Data to write

B<Example:>



    overWriteHtmlFile   (q(index.html), q(<html><h1>Hello</h1></html>));  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

    overWritePerlCgiFile(q(gen.pl),     q(...));


=head3 overWritePerlCgiFile($file, $data)

Write a L<Perl|http://www.perl.org/> file to /usr/lib/cgi-bin and make it executable after checking it for syntax errors.

     Parameter  Description

lib/Data/Table/Text.pm  view on Meta::CPAN

337 L<runInParallel|/runInParallel> - Process the elements of an array in parallel using a maximum of B<$maximumNumberOfProcesses> processes.

338 L<runInSquareRootParallel|/runInSquareRootParallel> - Process the elements of an array in square root parallel using a maximum of B<$maximumNumberOfProcesses> processes.

339 L<s3Delete|/s3Delete> - Return an S3 --delete keyword from an S3 option set.

340 L<s3DownloadFolder|/s3DownloadFolder> - Download a specified B<$folder> on S3 to a B<$local> folder using the specified B<%options> if any.

341 L<s3FileExists|/s3FileExists> - Return (name, size, date, time) for a B<$file> that exists on S3 else () using the specified B<%options> if any.

342 L<s3ListFilesAndSizes|/s3ListFilesAndSizes> - Return {file=>size} for all the files in a specified B<$folderOrFile> on S3 using the specified B<%options> if any.

343 L<s3Profile|/s3Profile> - Return an S3 profile keyword from an S3 option set.

344 L<s3ReadFile|/s3ReadFile> - Read from a B<$file> on S3 and write the contents to a local file B<$local> using the specified B<%options> if any.

345 L<s3ReadString|/s3ReadString> - Read from a B<$file> on S3 and return the contents as a string using specified B<%options> if any.

346 L<s3WriteFile|/s3WriteFile> - Write to a file B<$fileS3> on S3 the contents of a local file B<$fileLocal> using the specified B<%options> if any.

347 L<s3WriteString|/s3WriteString> - Write to a B<$file> on S3 the contents of B<$string> using the specified B<%options> if any.

348 L<s3ZipFolder|/s3ZipFolder> - Zip the specified B<$source> folder and write it to the named B<$target> file on S3.

349 L<s3ZipFolders|/s3ZipFolders> - Zip local folders and upload them to S3 in parallel.

350 L<saveAwsDomain|/saveAwsDomain> - Make the server at L<Amazon Web Services|http://aws.amazon.com> with the given domain name the default primary server as used by all the methods whose names end in B<r> or B<Remote>.

351 L<saveAwsIp|/saveAwsIp> - Make the server at L<Amazon Web Services|http://aws.amazon.com> with the given IP address the default primary server as used by all the methods whose names end in B<r> or B<Remote>.

352 L<saveCodeToS3|/saveCodeToS3> - Save source code every B<$saveCodeEvery> seconds by zipping folder B<$folder> to zip file B<$zipFileName> then saving this zip file in the specified L<S3|https://aws.amazon.com/s3/> B<$bucket> using any additional ...

353 L<saveSourceToS3|/saveSourceToS3> - Save source code.

354 L<searchDirectoryTreeForSubFolders|/searchDirectoryTreeForSubFolders> - Search the specified directory under the specified folder for sub folders.

355 L<searchDirectoryTreesForMatchingFiles|/searchDirectoryTreesForMatchingFiles> - Search the specified directory trees for the files (not folders) that match the specified extensions.

356 L<setCombination|/setCombination> - Count the elements in sets B<@s> represented as arrays of strings and/or the keys of hashes.

357 L<setDifference|/setDifference> - Subtract the keys in the second set represented as a hash from the first set represented as a hash to create a new hash showing the set difference between the two.

358 L<setFileExtension|/setFileExtension> - Given a B<$file>, change its extension to B<$extension>.

359 L<setIntersection|/setIntersection> - Intersection of sets B<@s> represented as arrays of strings and/or the keys of hashes.

360 L<setIntersectionOverUnion|/setIntersectionOverUnion> - Returns the size of the intersection over the size of the union of one or more sets B<@s> represented as arrays and/or hashes.

361 L<setPackageSearchOrder|/setPackageSearchOrder> - Set a package search order for methods requested in the current package via AUTOLOAD.

362 L<setPartitionOnIntersectionOverUnion|/setPartitionOnIntersectionOverUnion> - Partition, at a level of B<$confidence> between 0 and 1, a set of sets B<@sets> so that within each partition the L<setIntersectionOverUnion|/setIntersectionOverUnion> ...

363 L<setPartitionOnIntersectionOverUnionOfHashStringSets|/setPartitionOnIntersectionOverUnionOfHashStringSets> - Partition, at a level of B<$confidence> between 0 and 1, a set of sets B<$hashSet> represented by a hash, each hash value being a string...

364 L<setPartitionOnIntersectionOverUnionOfHashStringSetsInParallel|/setPartitionOnIntersectionOverUnionOfHashStringSetsInParallel> - Partition, at a level of B<$confidence> between 0 and 1, a set of sets B<$hashSet> represented by a hash, each hash ...

365 L<setPartitionOnIntersectionOverUnionOfSetsOfWords|/setPartitionOnIntersectionOverUnionOfSetsOfWords> - Partition, at a level of B<$confidence> between 0 and 1, a set of sets B<@sets> of words so that within each partition the L<setIntersectionOv...

366 L<setPartitionOnIntersectionOverUnionOfStringSets|/setPartitionOnIntersectionOverUnionOfStringSets> - Partition, at a level of B<$confidence> between 0 and 1, a set of sets B<@strings>, each set represented by a string containing words and punctu...

367 L<setPermissionsForFile|/setPermissionsForFile> - Apply L<chmod|https://linux.die.net/man/1/chmod> to a B<$file> to set its B<$permissions>.

368 L<setUnion|/setUnion> - Union of sets B<@s> represented as arrays of strings and/or the keys of hashes.

369 L<showGotVersusWanted|/showGotVersusWanted> - Show the difference between the wanted string and the wanted string.

370 L<showHashes|/showHashes> - Create a map of all the keys within all the hashes within a tower of data structures.

371 L<showHashes2|/showHashes2> - Create a map of all the keys within all the hashes within a tower of data structures.

372 L<spellCheck|/spellCheck> - Spell checker

373 L<squareArray|/squareArray> - Create a two dimensional square array from a one dimensional linear array.

374 L<startProcess|/startProcess> - Start new processes while the number of child processes recorded in B<%$pids> is less than the specified B<$maximum>.

375 L<storeFile|/storeFile> - Store into a B<$file>, after creating a path to the file with L<makePath> if necessary, a data B<$structure> via L<Storable|https://metacpan.org/pod/Storable>.

376 L<stringMd5Sum|/stringMd5Sum> - Get the Md5 sum of a B<$string> that might contain L<utf8|https://en.wikipedia.org/wiki/UTF-8> code points.

377 L<stringsAreNotEqual|/stringsAreNotEqual> - Return the common start followed by the two non equal tails of two non equal strings or an empty list if the strings are equal.

378 L<subNameTraceBack|/subNameTraceBack> - Find the names of the calling subroutines and return them as a blank separated string of names.

379 L<subScriptString|/subScriptString> - Convert alphanumerics in a string to sub scripts.

380 L<subScriptStringUndo|/subScriptStringUndo> - Undo alphanumerics in a string to sub scripts.

381 L<sumAbsAndRel|/sumAbsAndRel> - Combine zero or more absolute and relative names of B<@files> starting at the current working folder to get an absolute file name.

382 L<summarizeColumn|/summarizeColumn> - Count the number of unique instances of each value a column in a table assumes.

383 L<superScriptString|/superScriptString> - Convert alphanumerics in a string to super scripts.

384 L<superScriptStringUndo|/superScriptStringUndo> - Undo alphanumerics in a string to super scripts.

385 L<swapFilePrefix|/swapFilePrefix> - Swaps the start of a B<$file> name from a B<$known> name to a B<$new> one if the file does in fact start with the $known name otherwise returns the original file name as it is.

386 L<swapFolderPrefix|/swapFolderPrefix> - Given a B<$file>, swap the folder name of the $file from B<$known> to B<$new> if the file $file starts with the $known folder name else return the $file as it is.

387 L<syncFromS3InParallel|/syncFromS3InParallel> - Download from L<S3|https://aws.amazon.com/s3/> by using "aws s3 sync --exclude '*' --include '.

388 L<syncToS3InParallel|/syncToS3InParallel> - Upload to L<S3|https://aws.amazon.com/s3/> by using "aws s3 sync --exclude '*' --include '.

389 L<temporaryFile|/temporaryFile> - Create a new, empty, temporary file.

390 L<temporaryFolder|/temporaryFolder> - Create a new, empty, temporary folder.

391 L<timeStamp|/timeStamp> - Hours:minute:seconds.

392 L<transitiveClosure|/transitiveClosure> - Transitive closure of a hash of hashes.

393 L<trim|/trim> - Remove any white space from the front and end of a string.

394 L<Udsr::kill|/Udsr::kill> - Kill a communications server.

395 L<Udsr::read|/Udsr::read> - Read a message from the L<newUdsrServer|/newUdsrServer> or the L<newUdsrClient|/newUdsrClient>.

396 L<Udsr::webUser|/Udsr::webUser> - Create a systemd installed server that processes http requests using a specified userid.

397 L<Udsr::write|/Udsr::write> - Write a communications message to the L<newUdsrServer|/newUdsrServer> or the L<newUdsrClient|/newUdsrClient>.



( run in 1.886 second using v1.01-cache-2.11-cpan-d7f47b0818f )