Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

For me, updating the manifest is pretty much standard procedure whenever i add or remove files from one of my projects. As for updating version numbers and stuff, i also have scripts for that.

setversion.pl:

#!/usr/bin/env perl #---AUTOPRAGMASTART--- use 5.020; use strict; use warnings; use diagnostics; use mro 'c3'; use English; use Carp; our $VERSION = 18; use autodie qw( close ); use Array::Contains; use utf8; use Encode qw(is_utf8 encode_utf8 decode_utf8); #---AUTOPRAGMAEND--- # PAGECAMEL (C) 2008-2020 Rene Schickbauer # Developed under Artistic license my $newversion = shift @ARGV || "???"; if($newversion eq "???") { print "Usage: perl devscripts/setversion.pl 9.87\n"; exit(0); } print "Searching files...\n"; my @files = (find_pm('lib'), find_pm('devscripts'), find_pm('example') +); print "Changing files:\n"; foreach my $file (@files) { print "Editing $file...\n"; my @lines; open(my $ifh, "<", $file) or die($ERRNO); @lines = <$ifh>; close $ifh; open(my $ofh, ">", $file) or die($ERRNO); foreach my $line (@lines) { $line =~ s/VERSION = [\d\.]+/VERSION = $newversion/g; print $ofh $line; } close $ofh; } print "Done.\n"; exit(0); sub find_pm { my ($workDir) = @_; my @files; opendir(my $dfh, $workDir) or die($ERRNO); while((my $fname = readdir($dfh))) { next if($fname eq "." || $fname eq ".." || $fname eq ".hg"); $fname = $workDir . "/" . $fname; if(-d $fname) { push @files, find_pm($fname); } elsif($fname =~ /\.p[lm]$/i && -f $fname) { push @files, $fname; } } closedir($dfh); return @files; }

It's probably not the most efficient of scripts, but it does the job for me in a lot of open source and closed source projects. This one is taken directly from my Net::Clacks repository. The script is in the "devscripts" directory, which also holds such gems as "fixpragmas.pl" that allows me to change the standard pragmas for all *.pm files in a project all in one go.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

In reply to Re^4: Trying to build a module for upload to CPAN by cavac
in thread Trying to build a module for upload to CPAN by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2022-08-17 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?