From cce5cb3278784235492877b4efa489b82629ac44 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sun, 14 Dec 2025 20:37:17 +0100 Subject: [PATCH] moved to codeberg --- .woodpecker/build.yaml | 23 - .woodpecker/release.sh | 54 -- .woodpecker/release.yaml | 23 - Changelog | 34 -- Inspect.pm | 1164 ------------------------------------ MANIFEST | 16 - Makefile.PL | 32 - README | 55 -- README.md | 3 + sample/bin/inspect.pl | 142 ----- sample/formats/sample.conf | 45 -- sample/formats/sample.csv | 1 - sample/formats/sample.ini | 263 -------- sample/formats/sample.json | 49 -- sample/formats/sample.perl | 29 - sample/formats/sample.xml | 33 - sample/formats/sample.yml | 116 ---- t/run.t | 51 -- t/testshell.pl | 25 - 19 files changed, 3 insertions(+), 2155 deletions(-) delete mode 100644 .woodpecker/build.yaml delete mode 100755 .woodpecker/release.sh delete mode 100644 .woodpecker/release.yaml delete mode 100644 Changelog delete mode 100644 Inspect.pm delete mode 100644 MANIFEST delete mode 100644 Makefile.PL delete mode 100644 README create mode 100644 README.md delete mode 100644 sample/bin/inspect.pl delete mode 100644 sample/formats/sample.conf delete mode 100644 sample/formats/sample.csv delete mode 100644 sample/formats/sample.ini delete mode 100644 sample/formats/sample.json delete mode 100644 sample/formats/sample.perl delete mode 100644 sample/formats/sample.xml delete mode 100644 sample/formats/sample.yml delete mode 100644 t/run.t delete mode 100755 t/testshell.pl diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml deleted file mode 100644 index 873d003..0000000 --- a/.woodpecker/build.yaml +++ /dev/null @@ -1,23 +0,0 @@ -matrix: - include: - # - image: perl:5.22.4-stretch - # - image: perl:5.36.0-slim-bullseye - # - image: perl:5.38.0-slim-bookworm - # - image: perl:5.40.0-slim-bookworm - # - image: perl:5.42.0-slim-bookworm - - image: perl:5.43.5-slim-bookworm - -steps: - test: - when: - event: [push] - image: ${image} - commands: - - apt-get update -y - - apt-get install -y gcc - - cpanm -n YAML - - cpanm -n File::Temp - - cpanm -n Term::ReadLine - - perl Makefile.PL - - make - - make test diff --git a/.woodpecker/release.sh b/.woodpecker/release.sh deleted file mode 100755 index a44513a..0000000 --- a/.woodpecker/release.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# This is my own simple codeberg generic releaser. It takes to -# binaries to be uploaded as arguments and takes every other args from -# env. Works on tags or normal commits (push), tags must start with v. - - -set -e - -die() { - echo $* - exit 1 -} - -if test -z "$DEPLOY_TOKEN"; then - die "token DEPLOY_TOKEN not set" -fi - -git fetch --all - -# determine current tag or commit hash -version="$CI_COMMIT_TAG" -previous="" -log="" -if test -z "$version"; then - version="${CI_COMMIT_SHA:0:6}" - log=$(git log -1 --oneline) -else - previous=$(git tag -l | grep -E "^v" | tac | grep -A1 "$version" | tail -1) - log=$(git log -1 --oneline "${previous}..${version}" | sed 's|^|- |g') -fi - -# release body -printf "# Changes\n\n %s\n" "$log" > body.txt - -# create the release -https --ignore-stdin --check-status -b -A bearer -a "$DEPLOY_TOKEN" POST \ - "https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases" \ - tag_name="$version" name="Release $version" body=@body.txt > release.json - -# we need the id to upload files -ID=$(jq -r .id < release.json) - -if test -z "$ID"; then - cat release.json - die "failed to create release" -fi - -# actually upload -for file in "$@"; do - https --ignore-stdin --check-status -A bearer -a "$DEPLOY_TOKEN" -f POST \ - "https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases/$ID/assets" \ - "name=${file}" "attachment@${file}" -done diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml deleted file mode 100644 index 596150a..0000000 --- a/.woodpecker/release.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# build release - -steps: - compile: - when: - event: [tag] - image: perl:5.43.5-slim-bookworm - commands: - - perl Makefile.PL - - make - - make dist - - release: - image: alpine:latest - when: - event: [tag] - environment: - DEPLOY_TOKEN: - from_secret: DEPLOY_TOKEN - commands: - - apk update - - apk add --no-cache bash httpie jq git - - .woodpecker/release.sh ${CI_REPO_NAME}-$CI_COMMIT_TAG.tar.gz diff --git a/Changelog b/Changelog deleted file mode 100644 index 2dc36b0..0000000 --- a/Changelog +++ /dev/null @@ -1,34 +0,0 @@ -0.07 - added |more support to list and show commands. - -0.06 - fixed crash, which happened when one executed the - 'list' command if inside an array. now we divert - to 'show' in such a case. - -0.05 - signal value matches in search with quotes - -0.04 - fixed drop/append/pop/shift commands to work inside - arrays as well. - - fixed the quit command (it literally called 'exit') - -0.03 - re-factored error handling a little - - add 'search' command (alias: /) - - added [de]serialize methods, which can be overwritten, - by default we use YAML for serialization, but this - can be changed. - -0.02 - interactive command errors now lead to abort of - inspect() if reading from STDIN. - - fixed "get struct" - -0.01 - initial commit diff --git a/Inspect.pm b/Inspect.pm deleted file mode 100644 index 1ed73cf..0000000 --- a/Inspect.pm +++ /dev/null @@ -1,1164 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) 2015-2017 T.v.Dein . All -# Rights Reserved. Std. disclaimer applies. Artistic License, same as -# perl itself. Have fun. -# - - -package Data::Interactive::Inspect; - -use Carp::Heavy; -use Carp; - -use Term::ReadLine; -use File::Temp qw(tempfile); # required by the 'edit' command -use YAML; # config + export/import + 'edit' command - -use strict; -use warnings; -no strict 'refs'; - -use Data::Dumper; - -$Data::Interactive::Inspect::VERSION = 0.07; - -use vars qw(@ISA); - -use vars qw(@ISA @EXPORT @EXPORT_OK); -require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(); -@EXPORT_OK = qw(); - - -sub new { - my ($class, @param) = @_; - - $class = ref($class) || $class; - - # defaults (= valid parameters) - my $self = { - name => '', - begin => sub { print STDERR "unsupported\n"; }, - commit => sub { print STDERR "unsupported\n"; }, - rollback => sub { print STDERR "unsupported\n"; }, - export => sub { my ($db) = @_; return $db; }, - serialize => sub { my $db = shift; return YAML::Dump($db); }, - deserialize => sub { my $db = shift; return YAML::Load($db); }, - struct => {}, - editor => 'vi', - more => 'more', - silent => 0, - }; - - bless $self, $class; - - # by default unsupported - $self->{transactions} = 0; - - if ($#param >= 1) { - # hash interface - my %p = @param; - foreach my $k (keys %{$self}) { - if (exists $p{$k}) { - $self->{$k} = $p{$k}; - } - } - if (exists $p{begin} && $p{commit} && $p{rollback}) { - # user supplied the relevant functions - $self->{transactions} = 1; - } - } - elsif ($#param == 0) { - # 1 param, the struct - $self->{struct} = $param[0]; - } - # else: no params given, work with defaults - - if (! $self->{struct}) { - croak "Sorry param 'struct' must be set to a perl data structure\n"; - } - - # map commands+shortcuts to functions - $self->{command} = { - l => 'list', - list => 'list', - show => 'show', - sh => 'show', - dump => 'dump', - d => 'dump', - get => 'get', - g => 'get', - enter => 'enter', - cd => 'enter', - set => 'set', - edit => 'edit', - e => 'edit', - append=> 'append', - drop => 'drop', - pop => 'mypop', - shift => 'myshift', - search=> 'search', - '/' => 'search', - help => 'help', - h => 'help', - '?' => 'help', - quit => 'quit', - q => 'quit', - }; - - if ($self->{transactions}) { - # map if supported - foreach my $c (qw(begin commit rollback)) { - $self->{command}->{$c} = $c; - } - } - - if (! $self->{name}) { - $self->{name} = sprintf "data\@0x%x", $self->{struct}; - } - - # map which commands take a key param - $self->{commandargs} = [qw(get set edit show append pop shift drop enter cd search /)]; - - # holds current level - $self->{db} = $self->{struct}; - - # path to current level - $self->{path} = []; - - # set to 1 if transactions supported and implemented - $self->{session} = 0; - - $self->{quit} = 0; - - return $self; -} - - - - -sub inspect { - my ($self, $__cmds) = @_; - - if ($__cmds) { - # unit tests und scripts - $self->{silent} = 1; - foreach (split /\n/, $__cmds) { - if (! $self->process($_, 1) ) { - last; - } - } - return $self->{struct}; - } - - if (-t STDIN) { - # interactive with prompt and history - $| = 1; - my $term = new Term::ReadLine 'Data::Interactive::Inspect'; - $term->ornaments(0); - my $attribs = $term->Attribs; - - $self->{term} = $term; - $self->{complete_words} = [ map { if (length($_) > 2 ) {$_} } keys %{$self->{command}} ]; - $attribs->{completion_entry_function} = $attribs->{list_completion_function}; # avoid file completion - $attribs->{attempted_completion_function} = sub { - my ($begin, $line, $start, $end, $term) = @_; - return $self->complete($begin, $line, $start, $end, $term); - }; - - my $prompt = $self->prompt; - while ( defined ($_ = $term->readline($prompt)) ) { - if (! $self->process($_) ) { - print "last\n"; - last; - } - $prompt = $self->prompt; - } - } - else { - while () { - if (! $self->process($_, 1) ) { - last; - } - } - } - return $self->{struct}; -} - -sub prompt { - my $self = shift; - my $prompt = $self->{name}; - - if (@{$self->{path}}) { - $prompt .= " " . join('->', @{$self->{path}}); - } - if ($self->{session}) { - $prompt .= '%'; - } - $prompt .= '> '; - return $prompt; -} - -sub complete { - my ($self, $begin, $line, $start, $end, $term) = @_; - - my @matches = (); - - my $cmd = $line; - $cmd =~ s/\s\s*.*$//; - $cmd =~ s/\s*$//; - - if ($start == 0) { - # match on a command - @matches = $self->{term}->completion_matches ($begin, sub { - my ($text, $state) = @_; - my @name = @{$self->{complete_words}}; - unless ($state) { - $self->{complete_idx} = 0; - } - while ($self->{complete_idx} <= $#name) { - $self->{complete_idx}++; - return $name[$self->{complete_idx} - 1] - if ($name[$self->{complete_idx} - 1] =~ /^$text/); - } - # no match - return undef; - }); - } - elsif ($line =~ /[^\s]+\s+[^\s]+\s+/) { - # command line is complete ($cmd $arg), stop with completion - @matches = undef; - } - else { - # match on a command arg - if (grep {$cmd eq $_} @{$self->{commandargs}}) { - # only match for commands which support args - @matches = $self->{term}->completion_matches ($begin, sub { - my ($text, $state) = @_; - my @name = keys %{$self->{db}}; - unless ($state) { - $self->{complete_idxp} = 0; - } - while ($self->{complete_idxp} <= $#name) { - $self->{complete_idxp}++; - return $name[$self->{complete_idxp} - 1] - if ($name[$self->{complete_idxp} - 1] =~ /^$text/); - } - # no match - return undef; - }); - } - else { - # command doesn't support args - @matches = undef; - } - } - - return @matches; -} - -sub process { - my ($self, $line, $failonerr) = @_; - - return 1 if(!defined $line); - - # special treatment to search command - $line =~ s|^/(.+)|/ $1|; - - my $r; - my ($cmd, @args) = split /\s\s*/, $line; - - return 1 if (!defined $cmd); - return 1 if ($cmd =~ /^\s*$/); - return 1 if ($cmd =~ /^#/); - - - - if ($cmd eq '..') { - $self->up; - } - else { - if (exists $self->{command}->{$cmd}) { - my $func = $self->{command}->{$cmd}; - if (! grep {$cmd eq $_} @{$self->{commandargs}}) { - @args = (); - } - $r = $self->$func(@args); - return 0 if($failonerr && !$r); # fail if not interactive - return 0 if($self->{quit}); # finish - } - else { - if (ref($self->{db}) =~ /hash/i) { - if (exists $self->{db}->{$cmd}) { - $r = $self->enter($cmd); - return 0 if($failonerr && !$r); # fail if not interactive - } - else { - print STDERR "no such command: $cmd\n"; - return 0 if $failonerr; - } - } - else { - print STDERR "no such command: $cmd\n"; - return 0 if $failonerr; - } - } - } - return 1; -} - - - -# command implementations -sub __interactive__ {}; - -sub _fail { - my ($self, $msg) = @_; - print STDERR $msg; - return 0; -} - -sub _failkey { - my $self = shift; - return $self->_fail(" parameter missing\n"); -} - -sub _failidx { - my $self = shift; - return $self->_fail(" must be a number, since we're inside an array\n"); -} - -sub _more { - my ($self, $out) = @_; - if (open LESS, "|$self->{more}") { - print LESS $out; - close LESS; - } - else { - print $out; - } -} - -sub quit { - my $self = shift; - $self->{quit} = 1; - return 0; -} - -sub set { - my($self, $key, @value) = @_; - - return $self->_failkey() if(! defined $key); - - my $var; - my $code = "\$var = @value;"; - { - no strict; - no warnings; - eval $code; - } - if ($@) { - return $self->_fail("failed to insert: $@\n"); - } - else { - $self->{db}->{$key} = $var; - $self->done; - } - return 1; -} - -sub append { - my($self, $key, @value) = @_; - - if (ref($self->{db}) !~ /array/i) { - return $self->_failkey() if(! defined $key); - - if (exists $self->{db}->{$key}) { - if (ref($self->{db}->{$key}) !~ /array/i) { - return $self->_fail("\"$key\" already exists and is not an array\n"); - } - } - } - else { - # inside an array, ignore $key - @value = ($key, @value); - } - - my $var; - my $code = "\$var = @value;"; - eval $code; - if ($@) { - return $self->_fail("failed to evaluate: $@\n"); - } - else { - if (ref($self->{db}) =~ /array/i) { - push @{$self->{db}}, $var; - } - else { - push @{$self->{db}->{$key}}, $var; - } - $self->done; - } - - return 1; -} - -sub drop { - my($self, $key) = @_; - - if (ref($self->{db}) =~ /array/i) { - return $self->_failidx if($key !~ /^\d*$/); - if (scalar @{$self->{db}} -1 < $key) { - return $self->_fail("array element $key exceeds number of elements in current array\n"); - } - else { - splice @{$self->{db}}, $key, 1; - $self->done; - } - } - else { - return $self->_failkey() if(! defined $key); - - if (exists $self->{db}->{$key}) { - delete $self->{db}->{$key}; - $self->done; - } - else { - return $self->_fail("no such key: \"$key\"\n"); - } - } - - return 1; -} - -sub mypop { - my($self, $key) = @_; - - if (ref($self->{db}) !~ /array/i) { - return $self->_failkey() if(! defined $key); - - if (exists $self->{db}->{$key}) { - if (ref($self->{db}->{$key}) !~ /array/i) { - return $self->_fail("\"$key\" is not an array\n"); - } - } - my $ignore = pop @{$self->{db}->{$key}}; - $self->done; - } - else { - my $ignore = pop @{$self->{db}}; - } - - return 1; -} - -sub myshift { - my($self, $key) = @_; - - if (ref($self->{db}) !~ /array/i) { - return $self->_failkey() if(! defined $key); - - if (exists $self->{db}->{$key}) { - if (ref($self->{db}->{$key}) !~ /array/i) { - return $self->_fail("\"$key\" is not an array\n"); - } - } - my $ignore = shift @{$self->{db}->{$key}}; - $self->done; - } - else { - my $ignore = shift @{$self->{db}}; - } - return 1; -} - -sub get { - my($self, $key, $search) = @_; - - return $self->_failkey() if(! defined $key); - - my $out; - my @K; - if ($key =~ /^\/.*\/$/) { - # regex - $key =~ s#^/##; - $key =~ s#/$##; - foreach my $k (keys %{$self->{db}}) { - if ($k =~ /$key/) { - push @K, $k; - } - } - } - else { - if (ref($self->{db}) =~ /array/i) { - return $self->_failidx if($key !~ /^\d*$/); - if (scalar @{$self->{db}} -1 < $key) { - return $self->_fail("array element $key exceeds number of elements in current array\n"); - } - else { - $out .= "[$key] =>\n" . $self->dump($self->{db}->[$key], 1) - } - } - elsif (exists $self->{db}->{$key}) { - push @K, $key; - } - else { - return $self->_fail("no such key: \"$key\"\n"); - } - } - - foreach my $key (@K) { - if (ref($self->{db}->{$key}) =~ /hash/i || ref($self->{db}->{$key}) =~ /array/i) { - # FIXME: something nicer - $out .= "$key =>\n" . $self->dump($self->{db}->{$key}, 1) - } - else { - $out .= "$key => \"$self->{db}->{$key}\"\n"; - } - } - print $out; - - return 1; -} - -sub dump { - my ($self, $obj, $noprint) = @_; - my $out; - if ($obj) { - $out = $self->{serialize}->($self->{export}->($obj)); - } - else { - $out = $self->{serialize}->($self->{export}->($self->{db})); - } - - if ($noprint) { - return $out; - } - else { - $self->_more($out); - } - - return 1; -} - -sub edit { - my ($self, $key) = @_; - - return $self->_failkey() if(! defined $key); - - if (exists $self->{db}->{$key}) { - my $data = $self->{serialize}->($self->{export}->($self->{db}->{$key})); - my ($fh, $filename) = tempfile(); - print $fh $data; - close $fh; - system("$self->{editor}", $filename); - open IN, "<$filename"; - my $newdata = join '', ; - close IN; - if ($newdata eq $data) { - # FIXME: use checksum or something else which is faster - print "unchanged\n"; - } - else { - my $perl; - eval { - $perl = $self->{deserialize}->($newdata); - }; - if ($@) { - return $self->_fail("$@\n"); - } - else { - $self->{db}->{$key} = $perl; - $self->done; - } - } - unlink($filename); - } - else { - return $self->_fail("no such key: \"$key\"\n"); - } - - return 1; -} - -sub list { - my $self = shift; - - if (ref($self->{db}) eq 'ARRAY') { - # already implements array listing - $self->show; - } - else { - my $out = join("\n", sort keys %{$self->{db}}) . "\n"; - $self->_more($out); - } - - return 1; -} - -sub show { - my ($self, $indent) = @_; - my $out; - - if (ref($self->{db}) =~ /array/i) { - my $pos = 0; - foreach my $item (@{$self->{db}}) { - $out .= "$pos:\n"; - if (ref($item)) { - $out .= $self->_showhash($item, " "); - } - else { - $out .= " $item\n"; - } - $pos++; - } - } - else { - $out = $self->_showhash($self->{db}); - } - - $self->_more($out); - - return 1; -} - -sub _showhash { - my($self, $db, $indent) = @_; - - if (!defined $indent) { - $indent = ''; - } - - my $out; - foreach my $key (sort keys %{$db}) { - $out .= sprintf "%s%-30s", $indent, $key; - if (ref($db->{$key}) =~ /hash/i) { - $out .= "{ .. }\n"; - } - elsif (ref($db->{$key}) =~ /array/i) { - $out .= "[ .. ]\n"; - } - else { - $out .= "\"$db->{$key}\"\n"; - } - } - - return $out; -} - -sub enter { - my ($self, $key) = @_; - - return $self->_failkey() if(! defined $key); - - if ($key eq '..') { - $self->up; - } - else { - if (ref($self->{db}) =~ /array/i) { - # "cd" into array element - return $self->_failidx if($key !~ /^\d*$/); - push @{$self->{path}}, "[${key}]"; - push @{$self->{prev}}, $self->{db}; - $self->{db} = $self->{db}->[$key]; - } - elsif (ref($self->{db}->{$key}) =~ /hash/i || ref($self->{db}->{$key}) =~ /array/i) { - # "cd" into the hash pointed at by $key - push @{$self->{prev}}, $self->{db}; - push @{$self->{path}}, $key; - $self->{db} = $self->{db}->{$key}; - print "=> $key\n"; - } - else { - return $self->_fail("not a hash: \"$key\"\n"); - } - } - - return 1; -} - -sub up { - my $self = shift; - if (@{$self->{prev}}) { - $self->{db} = pop @{$self->{prev}}; - pop @{$self->{path}}; - print "<=\n"; - } - else { - return $self->_fail("already on top level\n"); - } - - return 1; -} - -sub search { - my ($self, $regex) = @_; - - if (! defined $regex) { - $self->_fail(" parameter missing\n"); - } - - $self->{spath} = []; - - return $self->_search($self->{db}, $regex); -} - -sub _search { - my($self, $db, $regex) = @_; - - if (ref($db) =~ /hash/i) { - foreach my $key (sort keys %{$db}) { - $self->_searchmatch($key, $regex, 0); - push @{$self->{spath}}, $key; - $self->_search($db->{$key}, $regex); - pop @{$self->{spath}}; - } - } - elsif (ref($db) =~ /array/i) { - my $pos = 0; - foreach my $item (@{$db}) { - push @{$self->{spath}}, "[${pos}]"; - $self->_search($item, $regex); - pop @{$self->{spath}}; - $pos++; - } - } - else { - $self->_searchmatch($db, $regex, 1); - } - - return 1; -} - -sub _searchmatch { - my ($self, $key, $regex, $quote) = @_; - $quote = $quote ? '"' : ''; - if ($key =~ /$regex/) { - print join(' => ', @{$self->{spath}}) . ": ${quote}$ {key}${quote}\n"; - } -} - -sub done { - my $self = shift; - if (! $self->{silent}) { - print "ok\n"; - } -} - -sub help { - my $self = shift; - print qq(Display commands: - list - list keys of current level - show - same as list but with values - dump - dump everything from current level - get | /regex/ - display value of , or the value - of all keys matching /regex/ - search - search for - -Navigation commands: - enter - change level into sub-hash of - -Edit commands: - set - set to - edit - edit structure behind [1] - append [] - append to array , leave - if you are currently inside an array - drop - delete key , use a number if inside - an array - pop [] - remove last element of array , - shift [] - remove first element of array - leave if inside an array -); - - if ($self->{transactions}) { - print qq( -Transaction commands: - begin - start a transaction session - commit - store everything changed within session - rollback - discard changes -); - } - - print qq( -Misc commands: - help - get help - ctrl-d | quit - exit - -Shortcuts: - .. - go one level up - l - list - d - dump - sh - show - cd - enter - - enter [2] - / - search - -Hints: -[1] can be perl code, e.g: set pw { user => 'max' } -[2] doesn't work if correlates to a command -); -} - - -1; - -=head1 NAME - -Data::Interactive::Inspect - Inspect and manipulate perl data structures interactively - -=head1 SYNOPSIS - - use Data::Interactive::Inspect; - my $data = foo(); # get a hash ref from somewhere - - # new shell object, the simple way - my $shell = Data::Interactive::Inspect->new($data); - - # or - my $shell = Data::Interactive::Inspect->new( - struct => $data, - name => 'verkehrswege', - begin => sub { .. }, - commit => sub { .. }, - rollback => sub { .. }, - serialize => sub { .. }, - deserialize => sub { .. }, - editor => 'emacs', - more => 'less' - ); - - $data = $shell->inspect(); # opens a shell and returns modified hash ref on quit - - -=head1 DESCRIPTION - -This module provides an interactive shell which can be used to inspect and modify -a perl data structure. - -You can browse the structure like a directory, display the contents, add and remove -items, whatever you like. It is possible to include complete perl data structures. - -The module works with hash and array references. - -=head1 METHODS - -=head2 new - -The B function takes either one parameter (a reference to a hash or array) -or a hash reference with parameters. The following parameters are supported: - -=over - -=item B - -The hash or array reference to inspect. - -=item B - -Will be displayed on the prompt of the shell. - -=item B - -By default L opens B if the user issues the B -command. Use this parameter to instruct it otherwise. - -=item B - -By default L uses B to display data which doesn't -fit the terminal window. Use this parameter to instruct it otherwise. - -=item B, B, B - -If your data is tied to some backend which supports transactions, you can provide -functions to implement this. If all three are defined, the user can use transaction -commands in the shell. - -Look at L for an example implementation. - -=item B, B - -By default L uses L for serialization, which -is used in the B and B commands. You can change this by assigning -code refs to these parameters. - -B will be called with the structure to be serialized as its sole -parameter and is expected to return a string. - -B will be called with a string as parameter and is expected to -return a structure. - -=back - -=head2 inspect - -The B method starts the shell. Ii does return if the user leaves it, otherwise -it runs forever. - -The shell runs on a terminal and with STDIN. - -The interactive shell supports command line editing, history and completion (for -commands and hash keys), if L or L is -installed. - -=head1 INTERACTIVE COMMANDS - -=head2 DISPLAY COMMANDS - -=over - -=item B - -Lists the keys of the current level of the structure. - -Shortcut: B. - -=item B - -Does nearly the same as B but also shows the content of the -keys. If a key points to a structure (like a hash or an array), B -whill not display anything of it, but instead indicate, that there'e -more behind that key. - -For arrays the array indices are displayed as well. - -Shortcut: B. - -=item B - -Dumps out everything of the current level of the structure. - -Shortcut: B. - -=item B key | /regex/> - -Displays the value of B. If you specify a regex, the values of -all matching keys will be shown. - -If the current structure is an array you can specify the array index -as the parameter. - -=item B regex | / - -Search for B through the current structure. Looks for -keys an values. - -Beware that this make take some time depending on the size -of the structure. - -=back - -=head2 NAVIGATION COMMANDS - -=over - -=item B key - -You can use this command to enter a sub hash of the current hash. -It works like browsing a directory structure. You can only enter -keys which point to sub hashes. - -Shortcuts: B - -If the key you want to enter doesn't collide with a command, then -you can also just directly enter the key without 'enter' or 'cd' in -front of it, eg: - - my.db> list - subhash - my.db> subhash - my.db subhash> dump - my.db subhash> .. - my.db>^D - -If the current structure is an array you can use the array index -to enter a specific array item. - -If you specify B<..> as parameter (or as its own command like in the -example below), you go one level up and leave the current sub hash. - -=back - -=head2 EDIT COMMANDS - -=over - -=item B key value - -Use the B command to add a new key or to modify the value -of a key. B may be a valid perl structure, which you can -use to create sub hashes or arrays. Example: - - my.db> set users [ { name => 'max'}, { name => 'joe' } ] - ok - mydb> get users - users => - { - 'name' => 'max' - }, - { - 'name' => 'joe' - } - -B command overwrites existing values -without asking>. - -=item B key - -You can edit a whole structure pointed at by B with the -B command. It opens an editor with the structure converted -to L. Modify whatever you wish, save, and the structure will -be saved to the database. - -=item B key value - -This command can be used to append a value to an array. As with the -B command, B can be any valid perl structure. - -If you are currently inside an array, leave the B parameter. - -=item B key - -Delete a key. - -Again, note that all commands are executed without further asking -or warning! - -If you are currently inside an array, the B parameter must be -an array index. - -=item B key - -Remove the last element of the array pointed at by B. - -If you are currently inside an array, leave the B parameter. - -=item B key - -Remove the first element of the array pointed at by B. - -If you are currently inside an array, leave the B parameter. - -=back - -=head2 TRANSACTION COMMANDS - -B. - -=over - -=item B - -Start a transaction. - -=item B - -Save all changes made since the transaction began. - -=item B - -Discard all changes of the transaction. - -=back - -=head2 MISC COMMANDS - -=over - -=item B - -Display a short command help. - -Shortcuts: B or B. - -=item B - -Quit the interactive shell - -Shortcuts: B. - -=back - -=head1 LIMITATIONS - -The data structure you are inspecting with L may -contain code refs. That's not a problem as long as you don't touch them. - -Sample: - - my $c = { - opt => 'value', - hook => sub { return 1; }, - }; - my $shell = Data::Interactive::Inspect->new($c); - $shell->inspect(); - -Execute: - - data@0x80140a468> dump - --- - hook: !!perl/code '{ "DUMMY" }' - opt: value - data@0x80140a468> set hook blah - data@0x80140a468> edit hook - -Both commands would destroy the code ref. The first one would just overwrite it -while the other one would remove the code (in fact it remains a code ref but -it will contain dummy code only). - -=head1 TODO - -=over - -=item Add some kind of select command - -Example: - -struct: - - { - users => [ - { login => 'max', uid => 1 }, - { login => 'leo', uid => 2 }, - ] - } - - > select login from users where uid = 1 - -which should return 'max'. - -(may require a real world parser) - -=item Add some kind of schema support - -Given the same structure as above: - - > update users set uid = 4 where login = 'max' - -=back - -=head1 AUTHOR - -T.v.Dein - -=head1 BUGS - -Report bugs to -http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data::Interactive::Inspect - -=head1 COPYRIGHT - -Copyright (c) 2015-2017 by T.v.Dein . All rights -reserved. - -=head1 LICENSE - -This program is free software; you can redistribute it -and/or modify it under the same terms as Perl itself. - -=head1 VERSION - -This is the manual page for L Version 0.07. - -=cut diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 9561518..0000000 --- a/MANIFEST +++ /dev/null @@ -1,16 +0,0 @@ -MANIFEST -Makefile.PL -Inspect.pm -README -Changelog -META.yml Module meta-data (added by MakeMaker) -META.json Module meta-data (added by MakeMaker) -t/run.t -sample/bin/inspect.pl -sample/formats/sample.csv -sample/formats/sample.yml -sample/formats/sample.ini -sample/formats/sample.xml -sample/formats/sample.json -sample/formats/sample.conf -sample/formats/sample.perl diff --git a/Makefile.PL b/Makefile.PL deleted file mode 100644 index 795a282..0000000 --- a/Makefile.PL +++ /dev/null @@ -1,32 +0,0 @@ -# -# Makefile.PL - build file for Data::Interactive::Inspect -# -# Copyright (c) 2007-2014 T. v.Dein . -# All Rights Reserved. Std. disclaimer applies. -# Artistic License, same as perl itself. Have fun. -# - -use ExtUtils::MakeMaker; - -WriteMakefile( - NAME => 'Data::Interactive::Inspect', - VERSION_FROM => 'Inspect.pm', - ABSTRACT => 'Inspect and manipulate perl data structures interactively', - LICENSE => 'perl', - AUTHOR => 'Thomas v.Dein ', - clean => { FILES => '*~ */*~' }, - PREREQ_PM => { - 'YAML' => 0, - 'File::Temp' => 0, - 'Term::ReadLine' => 0, - }, - dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, - test => { TESTS => 't/*.t' }, - 'META_MERGE' => { - resources => { - repository => 'https://codeberg.org/scip/Data-Interactive-Inspect', - }, - }, - -); - diff --git a/README b/README deleted file mode 100644 index cc2a826..0000000 --- a/README +++ /dev/null @@ -1,55 +0,0 @@ -NAME - Data::Interactive::Inspect - Inspect and manipulate perl data structures interactively - -SYNOPSIS - use Data::Interactive::Inspect; - my $data = foo(); # get a hash ref from somewhere - - # new shell object, the simple way - my $shell = Data::Interactive::Inspect->new($data); - - # or - my $shell = Data::Interactive::Inspect->new( - struct => $data, - name => 'verkehrswege', - begin => sub { .. }, - commit => sub { .. }, - rollback => sub { .. }, - editor => 'emacs', - more => 'less' - ); - - $data = $shell->inspect(); # opens a shell and returns modified hash ref on quit - -DESCRIPTION - This module provides an interactive shell which can be used to inspect - and modify a perl data structure. - -INSTALLATION - - to install, type: - perl Makefile.PL - make - make test - make install - - to read the complete documentation, type: - perldoc Data::Interactive::Inspect - -AUTHOR - T.v.Dein - -BUGS - Report bugs to - http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data::Interactive::Inspect - -COPYRIGHT - Copyright (c) 2015-2017 by T.v.Dein . All rights - reserved. - -LICENSE - This program is free software; you can redistribute it and/or modify it - under the same terms as Perl itself. - -VERSION - This is the manual page for Data::Interactive::Inspect Version 0.07. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d7df6a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +> [!CAUTION] +> This software is now being maintained on [Codeberg](https://codeberg.org/scip/Data-Interactive-Inspect/). + diff --git a/sample/bin/inspect.pl b/sample/bin/inspect.pl deleted file mode 100644 index 84ac4a2..0000000 --- a/sample/bin/inspect.pl +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (c) 2015-2017 T.v.Dein . All -# Rights Reserved. Std. disclaimer applies. Artistic License, same as -# perl itself. Have fun. - -# This script can be used to interactively browse perl data -# structures, which it reads from STDIN or a file. You can use it, for -# instance, by printing some data structure in your application using -# Data::Dumper and piping this output into this scripts input. - -# However, if the argument is a file and has a known suffix, the -# script automatically converts it into a perl data structure and -# drops you into an interactive shell on that. That way you can -# interactively browse XML or YAML files. Supported suffixes are: xml, -# json, csv, yml, ini, conf. - -# If the data structure evaulates, you'll be dropped into an interactive -# prompt. Enter '?' to get help. - -# The script also demonstrates how to use different serializers. - -use Data::Interactive::Inspect; -use Data::Dumper; -use YAML; # needs to be installed anyway -use strict; - - -sub usage { - print STDERR qq( -Usage: $0 - -Reads a perl data structure from . If is -, read from -STDIN. Evaluates and start an interactive Data::Interactive::Inspect -shell, which can be used to analyze the data. -); - exit 1; -} - - -my $arg = shift; -my $perl = 1; -my ($code); - -if (! $arg) { - usage; -} - -if ($arg ne '-' && ! -e $arg) { - print STDERR "$arg not found or not readable!\n"; - usage; -} - -if ($arg eq '-') { - loaddumper(join '', <>); -} -else { - if ($arg =~ /\.xml$/i) { - eval { require XML::Simple; }; - die "Sorry, XML::Simple is not installed, XML not supported!\n" if($@); - my $xml = new XML::Simple; - $code = $xml->XMLin($arg); - $perl = 0; - } - elsif ($arg =~ /\.(yaml|yml)$/i) { - $code = YAML::LoadFile($arg); - $perl = 0; - } - elsif ($arg =~ /\.ini$/i) { - eval { require Config::INI::Reader; }; - die "Sorry, Config::INI is not installed, INI not supported!\n" if($@); - $code = Config::INI::Reader->read_file($arg); - $perl = 0; - } - elsif ($arg =~ /\.conf$/i) { - eval { require Config::General; }; - die "Sorry, Config::General is not installed, CONF not supported!\n" if($@); - %{$code} = Config::General::ParseConfig(-ConfigFile => $arg, -InterPolateVars => 1, -UTF8 => 1); - $perl = 0; - } - elsif ($arg =~ /\.json$/i) { - eval { require JSON; }; - die "Sorry, JSON is not installed, JSON not supported!\n" if($@); - my $json = JSON->new->utf8(); - $code = $json->decode(slurp($arg)); - } - elsif ($arg =~ /\.csv$/i) { - eval { require Text::CSV::Slurp; }; - die "Sorry, Text::CSV::Slurp is not installed, CSV not supported!\n" if($@); - $code = Text::CSV::Slurp->load(file => $arg); - } - else { - loaddumper(slurp($arg)); - } -} - -if ($@) { - print STDERR "Parser or Eval error: $@!\n"; - exit 1; -} -else { - if ($perl) { - Data::Interactive::Inspect->new(struct => $code, - serialize => sub { my $db = shift; - my $c = Dumper($db); - $c =~ s/^\s*\$[a-zA-Z0-9_]*\s*=\s*/ /; - return $c; - }, - deserialze => sub { my $code = shift; - $code = "\$code = $code"; - eval $code; - return $code; - }, - )->inspect; - } - else { - # no perl struct, stay with default - Data::Interactive::Inspect->new(struct => $code)->inspect; - } -} - - -sub slurp { - my $arg = shift; - open CODE, "<$arg" or die "Could not open data file $arg: $!\n"; - my $code = join '', ; - close CODE; - return $code; -} - -sub loaddumper { - my $dump = shift; - $dump =~ s/^\s*\$[a-zA-Z0-9_]*\s*=\s*/\$code = /; - eval $dump; # fills global $code -} - - - - - - - diff --git a/sample/formats/sample.conf b/sample/formats/sample.conf deleted file mode 100644 index ca9b600..0000000 --- a/sample/formats/sample.conf +++ /dev/null @@ -1,45 +0,0 @@ - - - name stein - age 25 - - - name bird - age 31 - - -domain nix.to -domain b0fh.org -domain foo.bar -message < -host = blah.blubber - - - - user1 hans - - - - user2 max - - -quoted = "this one contains whitespace at the end " - -quotedwithquotes = " holy crap, it contains \"masked quotes\" and 'single quotes' " - - diff --git a/sample/formats/sample.csv b/sample/formats/sample.csv deleted file mode 100644 index 3bd0db2..0000000 --- a/sample/formats/sample.csv +++ /dev/null @@ -1 +0,0 @@ -policyID,statecode,county,eq_site_limit,hu_site_limit,fl_site_limit,fr_site_limit,tiv_2011,tiv_2012,eq_site_deductible,hu_site_deductible,fl_site_deductible,fr_site_deductible,point_latitude,point_longitude,line,construction,point_granularity 119736,FL,CLAY COUNTY,498960,498960,498960,498960,498960,792148.9,0,9979.2,0,0,30.102261,-81.711777,Residential,Masonry,1 448094,FL,CLAY COUNTY,1322376.3,1322376.3,1322376.3,1322376.3,1322376.3,1438163.57,0,0,0,0,30.063936,-81.707664,Residential,Masonry,3 206893,FL,CLAY COUNTY,190724.4,190724.4,190724.4,190724.4,190724.4,192476.78,0,0,0,0,30.089579,-81.700455,Residential,Wood,1 333743,FL,CLAY COUNTY,0,79520.76,0,0,79520.76,86854.48,0,0,0,0,30.063236,-81.707703,Residential,Wood,3 172534,FL,CLAY COUNTY,0,254281.5,0,254281.5,254281.5,246144.49,0,0,0,0,30.060614,-81.702675,Residential,Wood,1 785275,FL,CLAY COUNTY,0,515035.62,0,0,515035.62,884419.17,0,0,0,0,30.063236,-81.707703,Residential,Masonry,3 995932,FL,CLAY COUNTY,0,19260000,0,0,19260000,20610000,0,0,0,0,30.102226,-81.713882,Commercial,Reinforced Concrete,1 223488,FL,CLAY COUNTY,328500,328500,328500,328500,328500,348374.25,0,16425,0,0,30.102217,-81.707146,Residential,Wood,1 433512,FL,CLAY COUNTY,315000,315000,315000,315000,315000,265821.57,0,15750,0,0,30.118774,-81.704613,Residential,Wood,1 142071,FL,CLAY COUNTY,705600,705600,705600,705600,705600,1010842.56,14112,35280,0,0,30.100628,-81.703751,Residential,Masonry,1 253816,FL,CLAY COUNTY,831498.3,831498.3,831498.3,831498.3,831498.3,1117791.48,0,0,0,0,30.10216,-81.719444,Residential,Masonry,1 894922,FL,CLAY COUNTY,0,24059.09,0,0,24059.09,33952.19,0,0,0,0,30.095957,-81.695099,Residential,Wood,1 422834,FL,CLAY COUNTY,0,48115.94,0,0,48115.94,66755.39,0,0,0,0,30.100073,-81.739822,Residential,Wood,1 582721,FL,CLAY COUNTY,0,28869.12,0,0,28869.12,42826.99,0,0,0,0,30.09248,-81.725167,Residential,Wood,1 842700,FL,CLAY COUNTY,0,56135.64,0,0,56135.64,50656.8,0,0,0,0,30.101356,-81.726248,Residential,Wood,1 874333,FL,CLAY COUNTY,0,48115.94,0,0,48115.94,67905.07,0,0,0,0,30.113743,-81.727463,Residential,Wood,1 580146,FL,CLAY COUNTY,0,48115.94,0,0,48115.94,66938.9,0,0,0,0,30.121655,-81.732391,Residential,Wood,3 456149,FL,CLAY COUNTY,0,80192.49,0,0,80192.49,86421.04,0,0,0,0,30.109537,-81.741661,Residential,Wood,1 767862,FL,CLAY COUNTY,0,48115.94,0,0,48115.94,73798.5,0,0,0,0,30.11824,-81.745335,Residential,Wood,3 353022,FL,CLAY COUNTY,0,60946.79,0,0,60946.79,62467.29,0,0,0,0,30.065799,-81.717416,Residential,Wood,1 367814,FL,CLAY COUNTY,0,28869.12,0,0,28869.12,42727.74,0,0,0,0,30.082993,-81.710581,Residential,Wood,1 671392,FL,CLAY COUNTY,0,13410000,0,0,13410000,11700000,0,0,0,0,30.091921,-81.711929,Commercial,Reinforced Concrete,3 772887,FL,CLAY COUNTY,0,1669113.93,0,0,1669113.93,2099127.76,0,0,0,0,30.117352,-81.711884,Residential,Masonry,1 983122,FL,CLAY COUNTY,0,179562.23,0,0,179562.23,211372.57,0,0,0,0,30.095783,-81.713181,Residential,Wood,3 934215,FL,CLAY COUNTY,0,177744.16,0,0,177744.16,157171.16,0,0,0,0,30.110518,-81.727478,Residential,Wood,1 \ No newline at end of file diff --git a/sample/formats/sample.ini b/sample/formats/sample.ini deleted file mode 100644 index ccaa63b..0000000 --- a/sample/formats/sample.ini +++ /dev/null @@ -1,263 +0,0 @@ - - -[Settings] - -;====================================================================== - -; Set detailed log for additional debugging info - -DetailedLog=1 - -RunStatus=1 - -StatusPort=6090 - -StatusRefresh=10 - -Archive=1 - -; Sets the location of the MV_FTP log file - -LogFile=/opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log - -;====================================================================== - -Version=0.9 Build 4 Created July 11 2004 14:00 - -ServerName=Unknown - - -[FTP] - -;====================================================================== - -; set the FTP server active - -RunFTP=1 - -; defines the FTP control port - -FTPPort=21 - -; defines the FTP data port - -FTPDataPort=20 - - -FTPDir=/opt/ecs/mvuser/MV_IPTel/data/FTPdata - -; FTP Timeout (secs) - -FTP_TimeOut=5 - -; Enable SuperUser - -EnableSU=1 - -; set the SuperUser Name - -SUUserName=mvuser - -; set the SuperUser Password - -SUPassword=Avaya - -; - -;====================================================================== - -[FTPS] - -;====================================================================== - -; set the FTPS server active - -RunFTPS=0 - -; defines the FTP control port - -FTPPort=990 - -; defines the FTP data port - -FTPDataPort=889 - -;====================================================================== - - -[TFTP] - -;====================================================================== - -; set the Trivial FTP server active - -RunTrivialFTP=1 - -; defines the Trivial FTP port - -TrivialFTPPort=69 - - -TFTPDir=/opt/ecs/mvuser/MV_IPTel/data/TFTPdata - -;====================================================================== - -[HTTP] - -;====================================================================== - -; set the HTTP download server active - -RunHTTP=1 - -; defines the HTTP download port - -HTTPPort=81 - -; Sets the location of the HTTP data directory for downloads - -HTTPDir=/opt/ecs/mvuser/MV_IPTel/data/HTTPdata - -;====================================================================== - -[HTTPS] - -;====================================================================== - -; set the HTTPS download server active - -RunHTTPS=0 - -; defines the HTTPS download port - -HTTPSPort=411 - -; Sets the location of the HTTPS data directory for downloads - -HTTPSDir=/opt/ecs/mvuser/MV_IPTel/data/HTTPSdata - -; Sets the location of the CertFile - -CertFile=/opt/ecs/mvuser/MV_IPTel/certs/IPTelcert.pem - -; Sets the location of the KeyFile - -KeyFile=/opt/ecs/mvuser/MV_IPTel/certs/IPTelkey.pem - -; Use Client Authorization - -ClientAuth=0 - -; narrow config for Avaya IPTel (TLSV1 using RSA_NULL_SHA) - -IPTel=0 - -; sets the SSL variants if not Avaya IPtel (IPTel=0) - -SSLV2=0 - -SSLV3=0 - -TLSV1=1 - -UseProxy=0 - -ProxyAddr=simon.avaya.com - -ProxyPort=9000 - -;====================================================================== - -[BACKUP_SERVERS] - -;====================================================================== - -FileServer=0 - -RequestUpdates=0 - -RequestBackup=0 - -; Enable use of the Primary file server - -UsePrimarySvr=0 - -; Primary file server IP address ( or resolvable DNS) - -PrimaryIP=192.168.0.13 - -; Enable use of the Secondary file server - -UseSecondarySvr=0 - -; Secondary file server IP address ( or resolvable DNS) - -SecondaryIP=192.168.0.10 - -; Sets the update interval for Backups & updates ; 1 = min; 2 - -UpdateInterval=2 - -;Send FTP backup to the customer sever - -CustomFTP=1 - -; FTP backup directory customer sever - -CustomFTPDir=home/mvuser/backup - -; FTP backup directory user login name - -CustomFTPUName=tom - -; FTP backup directory user password - -CustomFTPPwd=jerry - -; Enable CDR Backup - enable=1 on both File Server & Client - -CDRBackup=0 - -; Enable BCMS Backup - enable=1 on both File Server & Client - -BCMSBackup=0 - -; Retain CDR / BCMS copy data for x days ( Receiver always + 1 - -RetainDays=7.0 - -;====================================================================== - - -[SNMP] - -;================================================================ - -; - -; Validate FTP store with SNMP check - -UseSNMP=1 - -; In case the SNMPGET syntax changes you can redefine the commands - -; Uncomment the relevant line to override the internal command - -;the syntax is "Command + IPADDR + ExtObj + Awk - -; the IPADRR is derived from the connection - -; Note there are relavant spaces at the start/end of the component - -;Command=/usr/bin/snmpget - -;Params= -v2c -cpublic - -;ExtObject=.1.3.6.1.4.1.6889.2.69.1.4.9.0 - -;TypeObject=.1.3.6.1.4.1.6889.2.69.1.1.2.0 - -;Awk=| awk -F \" '' {print $2 } '' - -;================================================================ - diff --git a/sample/formats/sample.json b/sample/formats/sample.json deleted file mode 100644 index 41b2c4a..0000000 --- a/sample/formats/sample.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "abstract" : "Inspect and manipulate perl data structures interactively", - "author" : [ - "Thomas v.Dein " - ], - "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005", - "license" : [ - "perl_5" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Data-Interactive-Inspect", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "runtime" : { - "requires" : { - "File::Temp" : "0", - "Term::ReadLine" : "0", - "YAML" : "0" - } - } - }, - "release_status" : "stable", - "resources" : { - "repository" : { - "url" : "https://codeberg.org/scip/Data-Interactive-Inspect" - } - }, - "version" : 0.06, - "x_serialization_backend" : "JSON::PP version 2.27300" -} diff --git a/sample/formats/sample.perl b/sample/formats/sample.perl deleted file mode 100644 index ac30c29..0000000 --- a/sample/formats/sample.perl +++ /dev/null @@ -1,29 +0,0 @@ -$VAR1 = { - 'food' => { - 'Berry-Berry Belgian Waffles' => { - 'price' => '$8.95', - 'calories' => '900', - 'description' => 'Light Belgian waffles covered with an assortment of fresh berries and whipped cream' - }, - 'Homestyle Breakfast' => { - 'price' => '$6.95', - 'calories' => '950', - 'description' => 'Two eggs, bacon or sausage, toast, and our ever-popular hash browns' - }, - 'Belgian Waffles' => { - 'calories' => '650', - 'price' => '$5.95', - 'description' => 'Two of our famous Belgian Waffles with plenty of real maple syrup' - }, - 'French Toast' => { - 'price' => '$4.50', - 'calories' => '600', - 'description' => 'Thick slices made from our homemade sourdough bread' - }, - 'Strawberry Belgian Waffles' => { - 'price' => '$7.95', - 'calories' => '900', - 'description' => 'Light Belgian waffles covered with strawberries and whipped cream' - } - } - }; diff --git a/sample/formats/sample.xml b/sample/formats/sample.xml deleted file mode 100644 index 62cc296..0000000 --- a/sample/formats/sample.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - Belgian Waffles - $5.95 - Two of our famous Belgian Waffles with plenty of real maple syrup - 650 - - - Strawberry Belgian Waffles - $7.95 - Light Belgian waffles covered with strawberries and whipped cream - 900 - - - Berry-Berry Belgian Waffles - $8.95 - Light Belgian waffles covered with an assortment of fresh berries and whipped cream - 900 - - - French Toast - $4.50 - Thick slices made from our homemade sourdough bread - 600 - - - Homestyle Breakfast - $6.95 - Two eggs, bacon or sausage, toast, and our ever-popular hash browns - 950 - - diff --git a/sample/formats/sample.yml b/sample/formats/sample.yml deleted file mode 100644 index e0d477b..0000000 --- a/sample/formats/sample.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- -cloud: - # Cloud Name: The cloud name must not contain spaces or special - # characters. The name is used for the OpenStack region name. The - # default value for the ICOS Hybrid cloud is RegionTwo. - name: RegionTwo - # Cloud Description - description: ICOS Hybrid - Controller + N Compute Topology - x86 KVM - # Cloud Administrator (admin) User's Password. For the ICOS Hybrid - # cloud, the cloud administrator user's password is contained in the - # password JSON file. It can be overridden here if needed. - password: ~ - # Cloud Password JSON File. This is required for the ICOS Hybrid cloud. - # Copy the example password file for the ICOS Hybrid cloud located in - # the ICM chef-repo to the deployment folder, rename it, and set the - # password values in the file for the on premise admin user and services - # required for the ICOS Hybrid cloud. Enter the fully qualified path and - # file name of that password file here. - password_file: YOUR_PASSWORD_FILE - # Cloud Database Service Type: db2, mariadb or mysql - database_service_type: db2 - # Cloud Messaging Service Type: rabbitmq or qpid - messaging_service_type: rabbitmq -# (Optional) Cloud SSL certificate chain file. This is not required. -# If not specified, the cacert_file will be created automatically, -# and placed on the Chef server. Only specify this value if you are -# providing your own cloud SSL certificate chain file, and controller -# SSL certificate and private key files for FIPS compliance. If specified, -# it must include all certificate chains required in the hybrid environment -# including any needed in the off-premise region. -# cacert_file: YOUR_CLOUD_CACERT_FILE_LOCATION - # Cloud Features: The cloud features to be enabled or disabled. The - # icos_hybrid_cloud, and fips_compliance features are enabled, by default. The - # self_service_portal feature must be disabled for the ICOS Hybrid cloud. - features: - self_service_portal: disabled - platform_resource_scheduler: enabled - icos_hybrid_cloud: enabled - fips_compliance: enabled - # Cloud Topology: References the node name(s) for each role - # within the cloud's topology. A self_service_portal_node_name - # should not be specified for the ICOS Hybrid cloud. - topology: - database_node_name: controller - controller_node_name: controller - self_service_portal_node_name: ~ - kvm_compute_node_names: kvm_compute - -# ================================================================ -# Environment Information -# ================================================================ -environment: - base: example-ibm-os-single-controller-n-compute - default_attributes: - # (Optional) Add Default Environment Attributes - - override_attributes: - # (Optional) Add Override Environment Attributes - ntp.servers: [0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org, 3.pool.ntp.org] - -# ================================================================ -# Hybrid Cloud Information. -# ================================================================ -hybrid: - # The Keystone Identity service endpoint host. Enter either the host FQDN or - # it's IP address. This value is not validated. Please ensure it is correct. - # The value is defaulted to 192.168.101.10 for the ICOS Hybrid cloud. - keystone_endpoint_host: 192.168.101.10 - # The Identity service admin tenant name. The value is defaulted to - # on-prem-admin for the ICOS Hybrid cloud. - admin_tenant_name: on-prem-admin - # The Identity service admin user name. The value is defaulted to - # admin-on-prem for the ICOS Hybrid cloud. - admin_user: admin-on-prem - # The SSL certificate chain file for the ICOS region. Enter the local - # location on the Chef server of the ICOS SSL certificate chain file as a - # fully qualified path and file name. This value is required unless both the - # on-premise region, and the ICOS system have trusted, commercially signed - # SSL certificates. This value is ignored if the optional cacert_file value - # is specified. - off_prem_certificate_chain_file: YOUR_OFF_PREM_CERTIFICATE_CHAIN_FILE_LOCAL_LOCATION - -# ================================================================ -# Node Information -# ================================================================ -nodes: - - name: controller - description: Cloud controller node - fqdn: YOUR_CONTROLLER_NODE_FQDN - password: ~ - identity_file: ~ - nics: - management_network: eth0 - data_network: eth1 - # (Optional) Node Attribute JSON File - attribute_file: ~ - # (Optional) Controller SSL certificate and private key files. - # These values are not required. If not specified, the cert_file and - # key_file will be created automatically, and placed on the Chef - # server. Only specify these values if you are providing your own cloud - # SSL certificate chain file, and controller SSL certificate and - # private key files for FIPS compliance. - # cert_file: YOUR_CONTROLLER_CERTIFICATE_FILE_LOCATION - # key_file: YOUR_CONTROLLER_PRIVATE_KEY_FILE_LOCATION - - name: kvm_compute - description: Cloud KVM compute node - fqdn: YOUR_KVM_COMPUTE_NODE_FQDN - password: ~ - identity_file: ~ - nics: - management_network: eth0 - data_network: eth1 - # (Optional) Node Attribute JSON File - attribute_file: ~ - # Copy the kvm_compute node section above for additional - # KVM compute nodes in your cloud. diff --git a/t/run.t b/t/run.t deleted file mode 100644 index 311e096..0000000 --- a/t/run.t +++ /dev/null @@ -1,51 +0,0 @@ -# -*-perl-*- - -use Test::More tests => 10; -#use Test::More qw(no_plan); - -require_ok( 'Data::Interactive::Inspect' ); - -my $cfg = { - 'v27' => '10', - 'v28' => 'ten', - - 'AoA' => [ 1, 2, 3, 4 ], - - 'AoH' => { - 'Homer' => { user => 'homer', uid => 100 }, - 'Bart' => { user => 'bart', uid => 101 }, - 'Lisa' => { user => 'lisa', uid => 102 }, - }, - }; - -my $shell = new_ok('Data::Interactive::Inspect', [ $cfg ]); -ok($shell, "Data::Interactive::Inspect->new() returns an obj"); - -my $orig; -foreach my $k (keys %{$cfg}) { - $orig->{$k} = $cfg->{$k}; -} - - -my $m1 = $shell->inspect("set v27 888\n"); -isnt($orig->{v27}, $m1->{v27}, "hash modified"); - -my $m2 = $shell->inspect("set GY { nom => 400 }"); -is_deeply($m2->{GY}, { nom => 400 }, "add a sub hash"); - -my $m3 = $shell->inspect("pop AoA"); -is_deeply($m3->{AoA}, [1,2,3], "remove last element of array"); - -my $m4 = $shell->inspect("shift AoA"); -is_deeply($m4->{AoA}, [2,3], "remove 1st element of arry"); - -my $m5 = $shell->inspect("append AoA 9"); -is_deeply($m5->{AoA}, [2,3,9], "append to array"); - -my $m6 = $shell->inspect("drop v28"); -isnt($orig->{v28}, $m6->{v28}, "delete a key"); - -my $m7 = $shell->inspect("enter AoH\nenter Bart\nset uid 0\n"); -is_deeply($m7->{AoH}->{Bart}, { user => 'bart', uid => 0 }, "browse and modify deeply"); - -done_testing(); diff --git a/t/testshell.pl b/t/testshell.pl deleted file mode 100755 index 8e26cc4..0000000 --- a/t/testshell.pl +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl - -use lib qw (blib/lib); -use Data::Interactive::Inspect; -use Data::Dumper; -my $s = { - h => [1,2,3,4,5], - users => [ - { login => 'max', age => 12 }, - { login => 'leo', age => 23 }, - ], - any => { - fear => { - settings => { - height => 89, - mode => 'normal', - looks => [ 3,5,6], - } - }, - } - }; - -my $shell = Data::Interactive::Inspect->new($s); -my $x = $shell->inspect(); -#print Dumper($x);