Skip to content

mashup6

gaou edited this page Nov 2, 2020 · 4 revisions

めざせ100万円!Mashup Awards 6th

Mashup用リング

Bookmark this

担当

サンプルプラグイン by cory

#!/usr/bin/perl
use strict;
use warnings;

package test;

sub test {
    my $state = shift;
    my $query = shift;
    my $ret_obj;

# first ring
    if ( $state eq 'all' ) {
	my @result = _search1($query);

	for ( 0 .. $#result ) {
	    my $item = $result[$_];
	    my $next_state = $item;
	    $ret_obj->[$_]->{title} = "Category_".$item;                     # title
	    $ret_obj->[$_]->{image} = "http://www.g-language.org/hoge.png";  # icon (ring itme)
	    $ret_obj->[$_]->{url}   = "reload:test:".$next_state.":".$query; # next query
	}
# second ring
    } else {
	my @result = _search2($state, $query);

	for ( 0 .. $#result ) {
	    my $item = $result[$_];
	    $ret_obj->[$_]->{title} = $item;                                   # title
	    $ret_obj->[$_]->{image} = "http://www.g-language.org/hoge.png";    # icon (ring itme)
	    $ret_obj->[$_]->{url}   = "http://hogehogehoge.org/hoge?".$item;   # next query
	}
    }

    return $ret_obj;
}

sub _search1 {
    my $query = shift;
    return qw/ 0 1 2 3 4 5 6 7 /;
}

sub _search2 {
    my $staet = shift;
    my $query = shift;
    return qw/ a b c d e f g /;
}

1;

Clone this wiki locally