Module Maintenance
TIP Include the   backup option to patch when you're first using patch to 
avoid losing data. This creates a backup file before patch changes the file.
To apply the patch created previously to the original version of Counter.pm, I 
can use this command:
$ patch < newcount.patch
patching file  Counter.pm 
The second line is output from patch the name of the file to patch was correctly 
deduced from the patch file header.
There are many reasons that patches can fail to apply cleanly, from file cor 
ruption to changes made in the target file that conflict with the patch. When patch
can't apply a patch file, it will issue an error message and create a reject file con 
taining the pieces of the patch, known as hunks, that could not be applied. For 
more information about how patch deals with failure, see the patch manual page.
Creating Multifile Patches
It's common to need to change more than one file to bring about a single change. 
For example, you might need to add a new test to a module's test script to accompany 
a change in the module code. Although it is possible to use the technique introduced 
earlier and simply include multiple diff files, this will quickly become unmanageable 
both for the sender and the receiver. Instead, you'll probably want to use diff's 
support for creating diffs between two directories, as I'll demonstrate here.
For example, since I changed the way Data::Counter's count() routine is called, 
I need to change the test suite accordingly. Simply, I must modify the t/02basic.t
file to call count() as a class method rather than a simple function. Since this will 
now be a multifile patch, I prepare by copying the entire Counter directory to 
Counter.orig (in contrast to simply copying the Counter.pm file to Counter.pm.orig
as shown earlier):
cp  rp Counter/ Counter.orig/
Now I'll make the change to the two files and generate the diff with this 
command:
diff  ur Counter.orig Counter > newcount.patch
14
147
7






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting perl

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved