GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
VCS::Lite::Delta(3) User Contributed Perl Documentation VCS::Lite::Delta(3)

VCS::Lite::Delta - VCS::Lite differences

  use VCS::Lite;

  # diff

  my $lit = VCS::Lite->new('/home/me/foo1.txt');
  my $lit2 = VCS::Lite->new('/home/me/foo2.txt');
  my $difftxt = $lit->delta($lit2)->diff;
  print OUTFILE $difftxt;

  # patch

  my $delt = VCS::Lite::Delta->new('/home/me/patch.diff');
  my $lit3 = $lit->patch($delt);
  print OUTFILE $lit3->text;

This module provides a Delta class for the differencing functionality of VCS::Lite

The underlying object of VCS::Lite::Delta is an array of difference chunks (hunks) such as that returned by Algorithm::Diff.

The constructor takes the following forms:

  my $delt = VCS::Lite::Delta->new( '/my/file.diff',$sep); # File name
  my $delt = VCS::Lite::Delta->new( \*FILE,$sep);       # File handle
  my $delt = VCS::Lite::Delta->new( \$string,$sep); # String as scalar ref
  my $delt = VCS::Lite::Delta->new( \@foo, $id1, $id2) # Array ref

$sep here is a regexp by which to split strings into tokens. The default is to use the natural perl mechanism of $/ (which is emulated when not reading from a file). The arrayref form is assuming an array of hunks such as the output from Algorithm::Diff::diff.

The other forms assume the input is the text form of a diff listing, either in diff format, or in unified format. The input is parsed, and errors are reported.

  print OUTFILE $delt->diff

This generates a standard diff format, for example:

4c4 < Now wherefore stopp'st thou me? --- > Now wherefore stoppest thou me?

  print OUTFILE $delt->udiff

This generates a unified diff (like diff -u) similar to the form in which patches are submitted.

  my ($id1,$id2) = $delt->id;
  $delt2->id('foo.pl@@1','foo.pl@@3')

The id method allows get and set of the names associated with the two elements being diffed. The id is set for delta objects returned by VCS::Lite->diff, to the element IDs of the VCS::Lite objects being diffed.

Diff format omits the file names, hence the IDs will not be populated by new. This is not the case with diff -u format, which includes the file names which are passed in and available as IDs.

  my @hunklist = $delt->hunks

A hunk is a technical term for a section of input containing a difference. Each hunk is an arrayref, containing the block of lines. Each line is itself an arrayref, for example:

  [
    [ '+', 9, 'use Acme::Foo;'],
    [ '-', 9, 'use Acme::Bar;'],
  ]

See the documentation on Algorithm::Diff for more details of this structure.

Algorithm::Diff.

There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties that are not explained within the POD documentation, please send an email to barbie@cpan.org or submit a bug to the RT system (see link below). However, it would help greatly if you are able to pinpoint problems or even supply a patch.

http://rt.cpan.org/Public/Dist/Display.html?Name=VCS-Lite

Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me.

  Original Author: Ivor Williams (RIP)          2002-2009
  Current Maintainer: Barbie <barbie@cpan.org>  2009-2015

  Copyright (c) Ivor Williams, 2002-2006
  Copyright (c) Barbie,        2009-2015

This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.
2015-01-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.