diff options
author | mattn <mattn.jp@gmail.com> | 2011-10-28 09:42:05 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2011-10-28 09:42:05 +0900 |
commit | 50270c6dd21fb071fdb19e37f8dc95f4d6dff616 (patch) | |
tree | 72bd93193a30943fa6db98cd94f9be54c160a0b8 /template/perl | |
parent | 6bf642f27e160a9218fc839c22627e4c515efa15 (diff) | |
download | vim-sonictemplate-50270c6dd21fb071fdb19e37f8dc95f4d6dff616.tar.gz vim-sonictemplate-50270c6dd21fb071fdb19e37f8dc95f4d6dff616.tar.bz2 vim-sonictemplate-50270c6dd21fb071fdb19e37f8dc95f4d6dff616.zip |
BIG CHANGE: changed directory structure.
Diffstat (limited to 'template/perl')
-rw-r--r-- | template/perl/base-package.pl | 9 | ||||
-rw-r--r-- | template/perl/base-scraping.pl | 16 | ||||
-rw-r--r-- | template/perl/base-script.pl | 5 | ||||
-rw-r--r-- | template/perl/base-test.pl | 6 | ||||
-rw-r--r-- | template/perl/snip-dbi-connect-sqlite.pl | 2 | ||||
-rw-r--r-- | template/perl/snip-dbi-prepare.pl | 5 | ||||
-rw-r--r-- | template/perl/snip-file-read.pl | 2 | ||||
-rw-r--r-- | template/perl/snip-pit.pl | 7 | ||||
-rw-r--r-- | template/perl/snip-sub.pl | 5 |
9 files changed, 57 insertions, 0 deletions
diff --git a/template/perl/base-package.pl b/template/perl/base-package.pl new file mode 100644 index 0000000..b4fa22c --- /dev/null +++ b/template/perl/base-package.pl @@ -0,0 +1,9 @@ +package {{_expr_:substitute(substitute(substitute(expand('%'), '.*lib[\\/]', '', 'g'), '[\\/]', '::', 'g'), '\.pm$', '', 'g')}}; + +use strict; +use warnings; +use utf8; + +{{_cursor_}} + +1 diff --git a/template/perl/base-scraping.pl b/template/perl/base-scraping.pl new file mode 100644 index 0000000..ffb696d --- /dev/null +++ b/template/perl/base-scraping.pl @@ -0,0 +1,16 @@ +use strict; +use warnings; +use utf8; +use Web::Scraper; +use URI; + +my $scraper = scraper { + process '{{_cursor_}}', 'data' => 'TEXT'; + result 'data'; +}; +$scraper->user_agent->env_proxy; + +use YAML::Syck; +for (@{$scraper->scrape( URI->new('') )}) { + print $_->{data}, "\n"; +} diff --git a/template/perl/base-script.pl b/template/perl/base-script.pl new file mode 100644 index 0000000..01e3ce9 --- /dev/null +++ b/template/perl/base-script.pl @@ -0,0 +1,5 @@ +use strict; +use warnings; +use utf8; + +{{_cursor_}} diff --git a/template/perl/base-test.pl b/template/perl/base-test.pl new file mode 100644 index 0000000..3971050 --- /dev/null +++ b/template/perl/base-test.pl @@ -0,0 +1,6 @@ +use strict; +use warnings; +use utf8; +use Test::More; + +{{_cursor_}} diff --git a/template/perl/snip-dbi-connect-sqlite.pl b/template/perl/snip-dbi-connect-sqlite.pl new file mode 100644 index 0000000..9366290 --- /dev/null +++ b/template/perl/snip-dbi-connect-sqlite.pl @@ -0,0 +1,2 @@ +my $dbh = DBI->connect("dbi:SQLite:dbname={{_cursor_}}"); +$dbh->disconnect; diff --git a/template/perl/snip-dbi-prepare.pl b/template/perl/snip-dbi-prepare.pl new file mode 100644 index 0000000..5424219 --- /dev/null +++ b/template/perl/snip-dbi-prepare.pl @@ -0,0 +1,5 @@ +my $sth = $dbh->prepare("{{_cursor_}}"); +$sth->execute; +while (my @row = $sth->fetchrow_array) { + #print join(', ', @row), "\n"; +} diff --git a/template/perl/snip-file-read.pl b/template/perl/snip-file-read.pl new file mode 100644 index 0000000..53138a4 --- /dev/null +++ b/template/perl/snip-file-read.pl @@ -0,0 +1,2 @@ +open my $fh, '<', '{{_cursor}}' or die "failed to open: $!"; +my $content = do { local $/; <$fh> }; diff --git a/template/perl/snip-pit.pl b/template/perl/snip-pit.pl new file mode 100644 index 0000000..710aa50 --- /dev/null +++ b/template/perl/snip-pit.pl @@ -0,0 +1,7 @@ +use Config::Pit; + +my $config = pit_get("{{_input_:domain}}", require => { + "username" => "username of {{_input_:domain}}", + "password" => "password of {{_input_:domain}}", +}); +{{_cursor_}} diff --git a/template/perl/snip-sub.pl b/template/perl/snip-sub.pl new file mode 100644 index 0000000..32f0e6d --- /dev/null +++ b/template/perl/snip-sub.pl @@ -0,0 +1,5 @@ +sub {{_input_:function name}} { + my ($self{{_input_:arguments}}) = @_; + {{_cursor_}} +} + |