Files
perl-CatalystX-REPL/perl-CatalystX-REPL.spec
2025-08-12 18:12:13 +02:00

101 lines
3.0 KiB
RPMSpec

#
# spec file for package perl-CatalystX-REPL
#
# 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 CatalystX-REPL
Name: perl-CatalystX-REPL
Version: 0.40.0
Release: 0
# 0.04 -> normalize -> 0.40.0
%define cpan_version 0.04
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Read-eval-print-loop for debugging your Catalyst application
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/F/FL/FLORA/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Carp::REPL)
BuildRequires: perl(Catalyst) >= 5.800.6
BuildRequires: perl(namespace::autoclean)
Requires: perl(Carp::REPL)
Requires: perl(Catalyst) >= 5.800.6
Requires: perl(namespace::autoclean)
Provides: perl(CatalystX::REPL) = %{version}
%undefine __perllib_provides
%{perl_requires}
# MANUAL BEGIN
BuildRequires: perl(Test::Expect)
# MANUAL END
%description
Using Carp::REPL with a Catalyst application is hard. That's because of all
the internal exceptions that are being thrown and caught by Catalyst during
application startup. You'd have to manually skip over all of those.
This role works around that by automatically setting up Carp::REPL after
starting your application, if the 'CATALYST_REPL' or 'MYAPP_REPL'
environment variables are set:
MYAPP_REPL=1 ./script/myapp_server.pl
# Hit an action
...
42 at lib/MyApp/Controller/Foo.pm line 8.
# instead of exiting, you get a REPL!
Trace begun at lib/MyApp/Controller/Foo.pm line 8
MyApp::Controller::Foo::bar('MyApp::Controller::Foo=HASH(0xc9fe20)', 'MyApp=HASH(0xcea6a4)') called at ...
... # Many more lines of stack trace
$ $c
MyApp=HASH(0xcea6ec)
$ $c->req->uri
http://localhost/foo/bar
$
Options like 'warn' or 'nodie' can be passed to Carp::REPL by putting them,
seperated by commas, into the environment variable:
MYAPP_REPL=warn,nodie ./script/myapp_server.pl
Carp::REPL uses Devel::REPL for the shell, so direct any questions how how
to use or customize the repl at that module.
%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 Changes README
%license LICENSE
%changelog