{"id":17109597,"url":"https://github.com/monken/p5-catalystx-controller-extjs-rest-simpleexcel","last_synced_at":"2025-03-23T21:41:34.959Z","repository":{"id":1365986,"uuid":"1315928","full_name":"monken/p5-catalystx-controller-extjs-rest-simpleexcel","owner":"monken","description":"Serialize to Excel spreadsheets","archived":false,"fork":false,"pushed_at":"2011-02-01T12:10:40.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T05:13:39.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monken.png","metadata":{"files":{"readme":"README.pod","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-01T12:01:41.000Z","updated_at":"2014-09-08T21:51:03.000Z","dependencies_parsed_at":"2022-07-07T05:34:30.877Z","dependency_job_id":null,"html_url":"https://github.com/monken/p5-catalystx-controller-extjs-rest-simpleexcel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monken%2Fp5-catalystx-controller-extjs-rest-simpleexcel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monken%2Fp5-catalystx-controller-extjs-rest-simpleexcel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monken%2Fp5-catalystx-controller-extjs-rest-simpleexcel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monken%2Fp5-catalystx-controller-extjs-rest-simpleexcel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monken","download_url":"https://codeload.github.com/monken/p5-catalystx-controller-extjs-rest-simpleexcel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245175323,"owners_count":20572781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T16:23:43.272Z","updated_at":"2025-03-23T21:41:34.923Z","avatar_url":"https://github.com/monken.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"package # hide from pause\n    CatalystX::Controller::ExtJS::REST::SimpleExcel::ApplicationToClass;\nuse Moose;\nextends 'Moose::Meta::Role::Application::ToClass';\n\nafter apply =\u003e sub {\n    my ($self, $role, $class) = @_;\n    $class-\u003ename-\u003econfig-\u003e{map}{'application/vnd.ms-excel'} = 'SimpleExcel';\n};\n\npackage # hide from pause\n    CatalystX::Controller::ExtJS::REST::SimpleExcel::Trait;\nuse Moose::Role;\n\nsub application_to_class_class {\n    'CatalystX::Controller::ExtJS::REST::SimpleExcel::ApplicationToClass';\n}\n\npackage CatalystX::Controller::ExtJS::REST::SimpleExcel;\n# ABSTRACT: Serialize to Excel spreadsheets\nuse Moose::Role -traits =\u003e 'CatalystX::Controller::ExtJS::REST::SimpleExcel::Trait';\nuse JSON::XS ();\n\nafter list =\u003e sub {\n    my ($self, $c) = @_;\n    return unless($c-\u003erequest-\u003eaccepts('application/vnd.ms-excel'));\n    my $data = $c-\u003estash-\u003e{$self-\u003econfig-\u003e{stash_key}};\n    my @header = map { $_-\u003e{mapping} } @{$data-\u003e{metaData}-\u003e{fields}};\n    my @rows;\n    foreach my $row(@{$data-\u003e{$self-\u003eroot_property}}) {\n        my @row;\n        foreach my $head(@header) {\n            my $rcopy = $row;\n            my $hcopy = $head;\n            while($hcopy =~ s/^(\\w+)\\.//) {\n                $rcopy = $rcopy-\u003e{$1};\n            }\n            push(@row, ref $rcopy-\u003e{$hcopy} ? JSON::XS::encode_json($rcopy-\u003e{$hcopy}) : $rcopy-\u003e{$hcopy} );\n        }\n        push(@rows, \\@row);\n    }\n    $c-\u003estash-\u003e{$self-\u003econfig-\u003e{stash_key}} = {\n        sheets =\u003e [{\n            name =\u003e $self-\u003edefault_resultset,\n            header =\u003e \\@header,\n            rows =\u003e \\@rows\n        }]\n    };\n};\n\n1;\n\n__END__\n\n=head1 SYNOPSIS\n\n package MyApp::Controller::User;\n use Moose;\n extends 'CatalystX::Controller::ExtJS::REST';\n with    'CatalystX::Controller::ExtJS::REST::SimpleExcel';\n \n 1;\n \nAccess C\u003c\u003c /users?content-type=application%2Fvnd.ms-excel \u003e\u003e to get the excel file.\n\n=head1 DESCRIPTION\n\nThis role loads L\u003cCatalyst::Action::Serialize::SimpleExcel\u003e and adds \nC\u003c\u003c application/vnd.ms-excel \u003e\u003e to the type map. When requesting a list of\nobjects, this role converts the output to satisfy L\u003cCatalyst::Action::Serialize::SimpleExcel\u003e.\n\n=head1 SEE ALSO\n\nL\u003cCatalystX::Controller::ExtJS::REST\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonken%2Fp5-catalystx-controller-extjs-rest-simpleexcel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonken%2Fp5-catalystx-controller-extjs-rest-simpleexcel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonken%2Fp5-catalystx-controller-extjs-rest-simpleexcel/lists"}