{"id":22045221,"url":"https://github.com/nigelhorne/data-text","last_synced_at":"2025-09-07T00:35:09.138Z","repository":{"id":48063620,"uuid":"405733130","full_name":"nigelhorne/Data-Text","owner":"nigelhorne","description":"Class to handle text in an OO way","archived":false,"fork":false,"pushed_at":"2025-08-04T19:43:13.000Z","size":163,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-04T22:21:13.373Z","etag":null,"topics":["cpan","perl","perl5"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Data::Text","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nigelhorne.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"nigelhorne","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-09-12T19:21:24.000Z","updated_at":"2025-08-04T19:43:16.000Z","dependencies_parsed_at":"2024-03-08T03:32:03.296Z","dependency_job_id":"8686570d-529a-4262-a328-119db95e3a08","html_url":"https://github.com/nigelhorne/Data-Text","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nigelhorne/Data-Text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nigelhorne%2FData-Text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nigelhorne%2FData-Text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nigelhorne%2FData-Text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nigelhorne%2FData-Text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nigelhorne","download_url":"https://codeload.github.com/nigelhorne/Data-Text/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nigelhorne%2FData-Text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273983049,"owners_count":25202092,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cpan","perl","perl5"],"created_at":"2024-11-30T13:12:18.841Z","updated_at":"2025-09-07T00:35:09.098Z","avatar_url":"https://github.com/nigelhorne.png","language":"Perl","readme":"# NAME\n\nData::Text - Class to handle text in an OO way\n\n# VERSION\n\nVersion 0.18\n\n# DESCRIPTION\n\n`Data::Text` provides an object-oriented interface for managing and manipulating text content in Perl.\nIt wraps string operations in a class-based structure,\nenabling clean chaining of methods like appending, trimming, replacing words, and joining text with conjunctions.\nIt supports flexible input types,\nincluding strings, arrays, and other `Data::Text` objects,\nand overloads common operators to allow intuitive comparisons and stringification.\n\n# SYNOPSIS\n\n    use Data::Text;\n\n    my $d = Data::Text-\u003enew(\"Hello, World!\\n\");\n\n    print $d-\u003eas_string();\n\n# SUBROUTINES/METHODS\n\n## new\n\nCreates a Data::Text object.\n\nThe optional parameter contains a string, or object, to initialise the object with.\n\n## set\n\nSets the object to contain the given text.\n\nThe argument can be a reference to an array of strings, or an object.\nIf called with an object, the message as\\_string() is sent to it for its contents.\n\n    $d-\u003eset({ text =\u003e \"Hello, World!\\n\" });\n    $d-\u003eset(text =\u003e [ 'Hello, ', 'World!', \"\\n\" ]);\n\n## append\n\nAdds data given in \"text\" to the end of the object.\nContains a simple sanity test for consecutive punctuation.\nI expect I'll improve that.\n\nSuccessive calls to append() can be daisy chained.\n\n    $d-\u003eset('Hello ')-\u003eappend(\"World!\\n\");\n\nThe argument can be a reference to an array of strings, or an object.\nIf called with an object, the message as\\_string() is sent to it for its contents.\n\n## uppercase\n\nConverts the text to uppercase.\n\n    $d-\u003euppercase();\n\n## lowercase\n\nConverts the text to lowercase.\n\n    $d-\u003elowercase();\n\n## clear\n\nClears the text and resets internal state.\n\n    $d-\u003eclear();\n\n## equal\n\nAre two texts the same?\n\n    my $t1 = Data::Text-\u003enew('word');\n    my $t2 = Data::Text-\u003enew('word');\n    print ($t1 == $t2), \"\\n\";   # Prints 1\n\n## not\\_equal\n\nAre two texts different?\n\n    my $t1 = Data::Text-\u003enew('xyzzy');\n    my $t2 = Data::Text-\u003enew('plugh');\n    print ($t1 != $t2), \"\\n\";   # Prints 1\n\n## as\\_string\n\nReturns the text as a string.\n\n## length\n\nReturns the length of the text.\n\nThis is actually the number of characters, not the number of bytes.\n\n## trim\n\nRemoves leading and trailing spaces from the text.\n\n## rtrim\n\nRemoves trailing spaces from the text.\n\n## replace\n\nReplaces multiple words in the text.\n\n    $d-\u003eappend('Hello World');\n    $d-\u003ereplace({ 'Hello' =\u003e 'Goodbye', 'World' =\u003e 'Universe' });\n    print $d-\u003eas_string(), \"\\n\";        # Outputs \"Goodbye Universe\"\n\n## appendconjunction\n\nAdd a list as a conjunction.  See [Lingua::Conjunction](https://metacpan.org/pod/Lingua%3A%3AConjunction)\nBecause of the way Data::Text works with quoting,\nthis code works\n\n    my $d1 = Data::Text-\u003enew();\n    my $d2 = Data::Text-\u003enew('a');\n    my $d3 = Data::Text-\u003enew('b');\n\n    # Prints \"a and b\\n\"\n    print $d1-\u003eappendconjunction($d2, $d3)-\u003eappend(\"\\n\");\n\n# AUTHOR\n\nNigel Horne, `\u003cnjh at bandsman.co.uk\u003e`\n\n# BUGS\n\nThere is no Unicode or UTF-8 support.\n\n# SEE ALSO\n\n[String::Util](https://metacpan.org/pod/String%3A%3AUtil), [Lingua::String](https://metacpan.org/pod/Lingua%3A%3AString)\n\n# SUPPORT\n\nThis module is provided as-is without any warranty.\n\nYou can find documentation for this module with the perldoc command.\n\n    perldoc Data::Text\n\nYou can also look for information at:\n\n- MetaCPAN\n\n    [https://metacpan.org/release/Data-Text](https://metacpan.org/release/Data-Text)\n\n- RT: CPAN's request tracker\n\n    [https://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Text](https://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Text)\n\n- CPAN Testers' Matrix\n\n    [http://matrix.cpantesters.org/?dist=Data-Text](http://matrix.cpantesters.org/?dist=Data-Text)\n\n- CPAN Testers Dependencies\n\n    [http://deps.cpantesters.org/?module=Data::Text](http://deps.cpantesters.org/?module=Data::Text)\n\n# LICENSE AND COPYRIGHT\n\nCopyright 2021-2025 Nigel Horne.\n\nThis program is released under the following licence: GPL2\n","funding_links":["https://github.com/sponsors/nigelhorne"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnigelhorne%2Fdata-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnigelhorne%2Fdata-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnigelhorne%2Fdata-text/lists"}