SVN::Class(3pm)
π SVN::Class π
okay bestie, welcome to the manual page for SVN::Class β a little Perl gem from the User Contributed Perl Documentation collection, and fr fr it's giving "make Subversion not painful" energy. Let's get into it π«Ά
πΈ NAME πΈ
SVN::Class β manipulate Subversion workspaces with Perl objects. yes. objects. in Perl. iconic behavior.
β¨ SYNOPSIS β¨
use SVN::Class;
my $file = svn_file( 'path/to/file' );
my $fh = $file->open('>>');
print {$fh} "hello world\n";
$fh->close;
$file->add;
if ($file->modified) {
my $rev = $file->commit('the file changed');
print "$file was committed with revision $rev\n";
}
else {
croak "$file was not committed: " . $file->errstr;
}
my $dir = svn_dir( 'path/to/dir' );
$dir->mkpath unless -d $dir;
$dir->add; # recurses by default
$dir->commit('added directory') if $dir->modified;
likeβ¦ look at that. open a file, add it, commit it, done. no cap, this is the whole vibe π
π¦ DESCRIPTION π¦
SVN::Class extends Path::Class so you can do basic Subversion workspace management with objects instead of vibes and hope. And SVN::Class::File and SVN::Class::Dir are subclasses of Path::Class::File::Stat and Path::Class::Dir respectively. family tree, slay.
Now here's the tea π: SVN::Class does NOT use the SVN::Core Subversion SWIG bindings. Nope. Instead, it shells out to the plain old svn binary tool for all interactions, using IPC::Cmd. Why? Because the author wanted maximum portability and zero non-CPAN dependencies. king behavior, honestly π
π EXPORT π
SVN::Class exports two functions by default: svn_file() and svn_dir(). They work exactly like the dir() and file() functions in Path::Class. So if you don't want them auto-dumped into your namespace, just summon it like this:
use SVN::Class ();
π svn_file( file )
Works just like Path::Class::file(). literally that simple bestie.
π svn_dir( dir )
Works just like Path::Class::dir(). same energy, different function.
π METHODS π
SVN::Class inherits from Path::Class. Only the new or overridden methods get documented here, so don't come for the ones you already know π
π§ svn
Path to the svn binary. Defaults to "svn" and thus relies on your environment's PATH to find and execute the correct command. it trusts you. don't betray it.
π§ stdout
Get the stdout from the last svn_run().
π§ stderr
Get the stderr from the last svn_run().
π§ error
If the last svn_run() exited with non-zero, error() returns the same thing as stderr(). If svn_run() was successful, it returns the empty string. no drama, just facts β¨
π§ error_code
Returns the last exit value of svn_run().
π§ verbose
Get/set a true value to enable IPC output in svn_run().
π§ debug
Get/set a true value to see debugging output printed on stderr. turn it on when things are giving chaos π₯
π§ svn_run( cmd, opts, file )
Execute cmd given opts and file as arguments. This is a wrapper around the IPC::Run run() function.
optsshould be an array ref of options to pass tocmd.filedefaults to$self->stringify().
Returns the success code from IPC::Run run(). Sets the stdout, stderr, err, errstr, and error_code values in the SVN::Class object.
This method is used internally by all the Subversion commands. it's the backbone, the moment, the main character π
NOTE: In order to standardize the output of Subversion commands into a locale that is easily parse-able by other methods that callsvn_run()internally, all commands are run with"LC_ALL=C"to make sure output is ASCII only.
π§ log
Returns svn log of the file, or 0 on error. The log is returned as an arrayref (same as accessing stdout()).
π§ add
Schedule the object for addition to the repository. baby's first commit β¨
π§ delete
Schedule the object for removal from the repository. bye bestie π
π§ update
Get the latest version of the object from the repository.
π§ up
Alias for update(). same thing, shorter name, we love efficiency.
π§ revert
Undo the last Subversion action on the object. ctrl+z but for svn π
π§ commit( message )
Commit the object to the repository with the log message.
Returns the revision number of the commit on success, 0 on failure.
π§ status
Returns the workspace status of the object.
π§ modified
Returns true if the status() of the object is "Add" or "Modified".
π§ conflicted
Returns true if the status() of the object is "Conflicted". good luck bestie, godspeed π
π§ diff
Diff the workspace version of the object against either the repository or the current working baseline version.
π§ blame
Annotated accounting of who modified what lines of the object. the receipts. the callout post. π
π§ info
Returns an SVN::Class::Info instance with information about the current object, or 0 on failure.
π§ dump
Returns a Data::Dump serialization of the object. Useful for debugging. peak "let me see what's going on in here" energy π
π§ errstr
Returns the contents of error() as a newline-joined string.
π§ outstr
Returns the contents of stdout() as a newline-joined string.
π AUTHOR π
Peter Karman, "<karman at cpan.org>" β the icon who built this. π
π BUGS π
Please report any bugs or feature requests to "bug-svn-class at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Class>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. we love a feedback loop π«Ά
π SUPPORT π
You can find documentation for this module with the perldoc command.
perldoc SVN::Class
You can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/SVN-Class>
- CPAN Ratings
<http://cpanratings.perl.org/d/SVN-Class>
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Class>
- Search CPAN
<http://search.cpan.org/dist/SVN-Class>
π ACKNOWLEDGEMENTS π
I looked at SVN::Agent before starting this project. It has a different API, more like SVN::Client in the SVN::Core, but I cribbed some of the ideas. inspiration is everywhere bestie β¨
The Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software. shoutout π«Ά
π COPYRIGHT π
Copyright 2007 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so go off, remix it, it's yours π
β SEE ALSO β
Path::Class, Class::Accessor::Fast, SVN::Agent, IPC::Cmd
okay and that's the whole page!! this is SVN::Class, documented for perl v5.34.0, dated 2022-06-17, filed under the manual name SVN::Class(3pm). go forth and commit responsibly, bestie πβ¨π
π¦ where this page comes from
- debian bookworm: libsvn-class-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsvn-class-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsvn-class-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsvn-class-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsvn-class-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms