- initial package 0.04

* created by cpanspec 1.78.03

OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Expect-Simple?expand=0&rev=1
This commit is contained in:
Stephan Kulow
2011-01-19 13:47:57 +00:00
committed by Git OBS Bridge
commit 8be536f3bd
5 changed files with 221 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6df5c5916fae4f51cfefa0c210814e88332f470d82bd4d86ea84c0a70304852b
size 12764

View File

@@ -0,0 +1,6 @@
-------------------------------------------------------------------
Wed Jan 19 13:47:51 UTC 2011 - coolo@novell.com
- initial package 0.04
* created by cpanspec 1.78.03

188
perl-Expect-Simple.spec Normal file
View File

@@ -0,0 +1,188 @@
#
# spec file for package perl-Expect-Simple (Version 0.04)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Expect-Simple
Version: 0.04
Release: 1
License: GPL+
%define cpan_name Expect-Simple
Summary: wrapper around the Expect module
Url: http://search.cpan.org/dist/Expect-Simple/
Group: Development/Libraries/Perl
#Source: http://www.cpan.org/authors/id/D/DJ/DJERIUS/Expect-Simple-%{version}.tar.gz
Source: %{cpan_name}-%{version}.tar.bz2
BuildRequires: perl(Expect)
BuildRequires: perl
BuildRequires: perl-macros
Requires: perl(Expect)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%{perl_requires}
%description
'Expect::Simple' is a wrapper around the 'Expect' module which should
suffice for simple applications. It hides most of the 'Expect' machinery;
the 'Expect' object is available for tweaking if need be.
Generally, one starts by creating an *Expect::Simple* object using *new*.
This will start up the target program, and will wait until one of the
specified prompts is output by the target. At that point the caller should
*send()* commands to the program; the results are available via the
*before*, *after*, *match_str*, and *match_idx* methods. Since *Expect*
simulates a terminal, there will be extra '\r' characters at the end of
each line in the result (on UNIX at least). This is easily fixed:
($res = $obj->before) =~ tr/\r//d;
@lines = split( "\n", $res );
This is *not* done automatically.
Exceptions will be thrown on error (match with '/Expect::Simple/'). Errors
from *Expect* are available via the *error_expect* method. More human
readable errors are available via the *error* method.
The connection is automatically broken (by sending the specified disconnect
command to the target) when the *Expect::Simple* object is destroyed.
Methods
* new
$obj = Expect::Simple->new( \%attr );
This creates a new object, starting up the program with which to
communicate (using the *Expect* *spawn* method) and waiting for a
prompt. The passed hash reference must contain at least the *Prompt*,
*DisconnectCmd*, and *Cmd* elements. The available attributes are:
* Cmd
Cmd => $command,
Cmd => [ $command, $arg1, $arg2, ... ],
The command to which to connect. The passed command may either be a
scalar or an array.
* Prompt
This specifies one or more prompts to scan for. For a single
prompt, the value may be a scalar; for more, or for matching of
regular expressions, it should be an array reference. For example,
Prompt => 'prompt1> ',
Prompt => [ 'prompt1> ', 'prompt2> ', -re => 'prompt\d+>\s+' ]
All prompts are taken literally, unless immediately preceded by a
'-re' flag, in which case they are regular expressions.
* DisconnectCmd
This is the command to be sent to the target program which will
cause it to exit.
* RawPty
If set, then underlying *Expect* object's pty mode is set to raw
mode (see *Expect::raw_pty()*).
* Timeout
The time in seconds to wait until giving up on the target program
responding. This is used during program startup and when any
commands are sent to the program. It defaults to 1000 seconds.
* Debug
The value is passed to *Expect* via its *debug* method.
* Verbose
This results in various messages printed to the STDERR stream. If
greater than 3, it turns on *Expect*'s logging to STDOUT (via the
*log_stdout* *Expect* method.
* send
$obj->send( $cmd );
$obj->send( @cmds );
Send one or more commands to the target. After each command is sent,
it waits for a prompt from the target. Only the output resulting from
the last command is available via the *after*, *before*, etc.
methods.
* match_idx
This returns a unary based index indicating which prompt (in the list
of prompts specified via the 'Prompt' attribute to the *new* method)
was received after the last command was sent. It will be undef if
none was returned.
* match_str
This returns the prompt which was matched after the last command was
sent.
* before
This returns the string received before the prompt. If no prompt was
seen, it returns all output accumulated. This is usually what the
caller wants to parse. Note that the first line will (usually) be the
command that was sent to the target, because of echoing. Check this
out to be sure!
* after
This returns the 'after' string. Please read the *Expect* docs for
more enlightenment.
* error
This returns a cleaned up, more humanly readable version of the
errors from *Expect*. It'll be undef if there was no error.
* error_expect
This returns the original *Expect* error.
* expect_handle
This returns the *Expect* object, in case further tweaking is
necessary.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(644,root,root,755)
%doc ChangeLog Changes LICENSE README
%changelog