From 9d23548481d4e88e9a8a7f5a2e1b3e939fdc42dc Mon Sep 17 00:00:00 2001 From: shelling Date: Thu, 9 Apr 2009 22:30:58 +0800 Subject: [PATCH] rewrite module infomation --- .gitignore | 11 +++++++ MANIFEST.SKIP | 24 ++++++++++---- README.markdown | 40 ++++++++---------------- lib/CPAN/MirrorStatus.pm | 67 +++++++++------------------------------- t/00-load.t | 17 ++-------- 5 files changed, 60 insertions(+), 99 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a0a348 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*~ +*.swp +META.yml +Makefile +Makefile.PL +Makefile.old +inc/ +blib/ +.build +CPAN-MirrorStatus-*/ +CPAN-MirrorStatus-*.tar.gz diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index dc03ab0..54db12f 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -1,6 +1,18 @@ -Changes -Makefile.PL -MANIFEST -README -t/CPAN-MirrorStatus.t -lib/CPAN/MirrorStatus.pm +README.markdown +^dist.ini$ +^\.gitignore$ +\.cvsignore +\.svn/ +\.git/ +\bRCS\b +\bCVS\b +%MANIFEST\. +^Makefile$ +~$ +^# +\.old$ +^blib/ +^pm_to_blib +^MakeMaker-\d +\.gz$ +^tools/ diff --git a/README.markdown b/README.markdown index ad60234..59ecb2d 100644 --- a/README.markdown +++ b/README.markdown @@ -1,40 +1,26 @@ -CPAN-MirrorStatus version 0.01 -============================== +# CPAN-MirrorStatus -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. +query mirror sites status from mirrors.cpan.org -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION +### INSTALLATION To install this module type the following: - perl Makefile.PL - make - make test - make install - -DEPENDENCIES + perl Makefile.PL + make + make test + make install -This module requires these other modules and libraries: +### DEPENDENCIES - blah blah blah + Rubyish::Attribute + self -COPYRIGHT AND LICENCE +### COPYRIGHT AND LICENCE -Put the correct copyright and licence information here. +Copyright (C) 2008 by shelling -Copyright (C) 2008 by 許 家瑋 +MIT(X11) Lincence -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. diff --git a/lib/CPAN/MirrorStatus.pm b/lib/CPAN/MirrorStatus.pm index 88960d7..9953cca 100644 --- a/lib/CPAN/MirrorStatus.pm +++ b/lib/CPAN/MirrorStatus.pm @@ -1,14 +1,13 @@ package CPAN::MirrorStatus; +# ABSTRACT: query mirrors status from mirrors.cpan.org -use 5.008008; +use 5.010; use strict; use warnings; -our $VERSION = '0.01'; - use LWP::Simple; use Rubyish::Attribute; -use selfvars; +use self; # configurable attributions # each attribution would be setted in constructor @@ -32,74 +31,38 @@ sub new { } sub query { - my () = @args; - + } sub render { my ($format) = @args; - give ($format) { - when ($format eq "widget") { } - when ($format eq "json") { } - default { } + given ($format) { + when ("widget") { render_widget() } + when ("json") { render_json() } } } +sub render_json { -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! +} + +sub render_widget -=head1 NAME -CPAN::MirrorStatus - querying mirrors status from mirrors.cpan.org +1; =head1 SYNOPSIS use CPAN::MirrorStatus; $q = CPAN::MirrorStatus->new; - $q->target("cpan.nctu.edu.tw"); #=> set query target as cpan.nctu.edu.tw + $q->st_of("cpan.nctu.edu.tw"); #=> which mirror status do you want to know $q->query; $q->render("json"); #=> output json - $q->render("widget"); #=> output javascript + $q->render("widget"); #=> output javascript widget =head1 DESCRIPTION -Stub documentation for CPAN::MirrorStatus, created by h2xs. It looks like the -author of the extension was negligent enough to leave the stub -unedited. - -Blah blah blah. - -=head2 EXPORT - -None by default. - - - -=head1 SEE ALSO - -Mention other useful documentation such as the documentation of -related modules or operating system documentation (such as man pages -in UNIX), or any relevant external documentation such as RFCs or -standards. - -If you have a mailing list set up for your module, mention it here. - -If you have a web site set up for your module, mention it here. - -=head1 AUTHOR - -許 家瑋, Eshelling@apple.comE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by 許 家瑋 - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. - =cut + diff --git a/t/00-load.t b/t/00-load.t index 4a36966..5b87deb 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -1,15 +1,4 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl CPAN-MirrorStatus.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test::More tests => 1; +use lib qw(lib t/lib); +use Test::More tests => 2; BEGIN { use_ok('CPAN::MirrorStatus') }; - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - +require_ok("CPAN::MirrorStatus");