Skip to content

Commit

Permalink
Tweaking for Dist::Zilla; still barebones.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubykat committed Jul 3, 2010
1 parent 7bdd1c8 commit 9f0b168
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ META.yml
Makefile.PL
_build/
blib

releases
WWW-FetchStory*
23 changes: 23 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
name = WWW-FetchStory
main_module = lib/WWW/FetchStory.pm
version = 0.01

author = Kathryn Andersen <perlkat@katspace.org>
license = Perl_5
copyright_holder = Kathryn Andersen
copyright_year = 2010

[GatherDir]
[PruneCruft]
[ManifestSkip]

[AutoPrereq]
[PkgVersion]
[PodVersion]
[MetaYAML]
[License]
[Readme]

[PodCoverageTests]
[PodSyntaxTests]
[ExtraTests]

[ModuleBuild]
[Manifest]
[TestRelease]

[ArchiveRelease]
114 changes: 113 additions & 1 deletion lib/WWW/FetchStory.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,117 @@
use strict;
use warnings;
package WWW::FetchStory;
=head1 NAME
1;
WWW::FetchStory - Fetch a story from a fiction website
=head1 SYNOPSIS
use WWW::FetchStory qw(:all);
my %story_info = fetch_story(
url=>$url,
basename=>$basename);
=head1 DESCRIPTION
This will fetch a story from a fiction website, intelligently
dealing with the formats from various different fiction websites
such as fanfiction.net; it deals with multi-file stories,
and strips all the extras from the HTML (such as navbars and javascript)
so that all you get is the story text and its formatting.
=cut

use HTML::SimpleParse;
use File::Temp qw(tempdir);
use File::Find::Rule;

require Exporter;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration
# use Text::ParseStory ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = (
'all' => [
qw(
get_story_info
)
]
);

our @EXPORT_OK = (@{$EXPORT_TAGS{'all'}});

our @EXPORT = qw(
);

=head1 FUNCTIONS
=head2 fetch_story
my %story_info = fetch_story(
url=>$url,
basename=>$basename);
=cut
sub fetch_story (%) {
my %args = (
file=>'',
columns=>undef,
url=>'',
verbose=>0,
@_
);

my %story_info = ();
foreach my $col (@{$args{columns}})
{
$story_info{$col} = '';
}
if ($args{file} =~ /.txt$/)
{
extract_info_from_text(vals=>\%story_info, %args);
}
elsif ($args{file} =~ /.zip$/)
{
extract_info_from_zip(vals=>\%story_info, %args);
}
else
{
extract_info_from_html(vals=>\%story_info, %args);
}
return %story_info;
} # fetch_story

=head1 Private Functions
=head2 fetch_from_ffn
Fetch a story from fanfiction.net.
=cut
sub fetch_from_ffn (%) {
my %args = (
url=>'',
basename=>undef,
@_
);

} # fetch_from_ffn

=head1 BUGS
Please report any bugs or feature requests to the author.
=cut

1; # End of Text::ParseStory
__END__
7 changes: 7 additions & 0 deletions t/01_load.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use Test::More tests => 1;

BEGIN {
use_ok( 'Text::ParseStory' );
}

diag( "Testing Text::ParseStory ${Text::ParseStory::VERSION}" );

0 comments on commit 9f0b168

Please sign in to comment.