Name : perl-overload-substr
| |
Version : 0.03
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 7.97
| Date : 2024-08-28 21:48:06
|
Group : Development/Libraries/Perl
| Source RPM : perl-overload-substr-0.03-7.97.src.rpm
|
Size : 0.04 MB
| |
Packager : (none)
| |
Summary : overload Perl\'s C< substr()> function
|
Description :
This module allows an object class to overload the \'substr\' core function, which Perl\'s \'overload\' pragma does not allow by itself.
It is invoked similarly to the \'overload\' pragma, being passed a single named argument which should be a code reference or method name to implement the \'substr\' function.
use overload::substr substr => \\&SUBSTR;
use overload::substr substr => \"SUBSTR\";
The referred method will be invoked as per core\'s \'substr\'; namely, it will take the string to be operated on (which will be an object in this case), an offset, optionally a length, and optionally a replacement.
$str->SUBSTR( $offset ); $str->SUBSTR( $offset, $length ); $str->SUBSTR( $offset, $length, $replacement );
In each case, whatever it returns will be the return value of the \'substr\' function that invoked it.
If the \'substr\' argument is not provided, it defaults to a method called \'_substr\'.
It is not required that the return value be a plain string; any Perl value may be returned unmodified from the \'substr\' method, or passed in as the value of the replacement. This allows objects to behave in whatever way is deemed most appropriate.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-O/openSUSE_Tumbleweed/x86_64 |