Module Maintenance
chapters. I'll change the count() routine in Counter.pm to work as a class method 
rather than as a simple function. First, I copy Counter.pm to Counter.pm.orig:
$ cp Counter.pm Counter.pm.orig
Next I edit Counter.pm, changing the definition of count() from
sub count { return scalar @_ }
to this:
sub count {
  my $pkg = shift;
  return scalar @_;
}
Now I can produce a patch file by running the diff command on the files and 
redirecting the output to a file called newcount.patch. The order of the arguments is 
important always put the old file first and then the new file:
diff Counter.pm.orig Counter.pm > newcount.patch
The diff program describes the differences in terms of what parts of the file would 
have to change to get from one version to a different version. Since you want to be 
able to see how to get from the original version to the new version, the original 
version goes first. Reversing the filenames would tell you exactly how to get from 
the new version back to the old version.
After this command, newcount.patch contains the following:
32c32,35
< sub count { return scalar @_ }
   
> sub count {
>   my $pkg = shift;
>   return scalar @_;
> }
Lines that begin with < are the lines that have been removed from the old file, and 
the lines beginning with > are the lines that have been added in the new file.
The diff program can represent differences between files in a number of dif 
ferent formats. The patch program can be used with the diff format shown previously, 
but it's not the preferred format. To produce a better patch, use the  u option:
diff  u Counter.pm.orig Counter.pm > newcount.patch
14
145
5






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