# # spec file for package perl-Expect-Simple # # Copyright (c) 2024 SUSE LLC # # 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 https://bugs.opensuse.org/ # %define cpan_name Expect-Simple Name: perl-Expect-Simple Version: 0.40.0 Release: 0 # 0.04 -> normalize -> 0.40.0 %define cpan_version 0.04 License: GPL-1.0-or-later Summary: Wrapper around the Expect module URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/D/DJ/DJERIUS/%{cpan_name}-%{cpan_version}.tar.gz Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Expect) Requires: perl(Expect) Provides: perl(Expect::Simple) = %{version} %undefine __perllib_provides %{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. %prep %autosetup -n %{cpan_name}-%{cpan_version} %build perl Makefile.PL INSTALLDIRS=vendor %make_build %check make test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %doc ChangeLog Changes README %license LICENSE %changelog