Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Abuse Perl
1. Perl beta
use
ab
*{quot;Abuse Perlquot;} = sub {
quot;by Casey Westnquot;
};
print quot;Abuse Perlquot;->();
2. Perl beta
use
ab
*{'
'} = sub {
print quot;Abuse Perl by Casey Westnquot;
};
<<_->()
_
3. Perl beta
use
ab
*{'
'} = sub { print shift };
<<_->(<<_)
_
Abuse Perl by Casey West
_
# via Abigail
4. Perl beta
use
ab
*{'
'} = sub {
print quot;Abuse Perl by Casey Westnquot;
};
'
'->();
5. Perl beta
use
ab
package Employee;
use base 'Class::Accessor::Fast';
Employee->mk_accessors qw[name title];
sub as_string {
my $self = shift;
sprintf quot;%s: %snquot;,
$self->title,
$self->name;
}
6. Perl beta
use
ab
$casey = Employee->new({
name => quot;Casey Westquot;,
title => quot;Member of Technical Staffquot;,
});
print $casey->as_string;
#Member of Technical Staff: Casey West
7. Perl beta
use
ab
*Employee::as_string = sub {
my $self = shift;
sprintf quot;%s is a %snquot;,
$self->name,
$self->title;
};
print $casey->as_string;
#Casey West is a Member of Technical Staff
8. Perl beta
use
ab
INIT {
*Employee::as_string = sub {
my $self = shift;
sprintf quot;%s is a %snquot;,
$self->name,
$self->title;
};
}
9. Perl beta
use
ab
INIT {
*Employee::as_string_orig
= *Employee::as_string;
*Employee::as_string = sub {
uc shift->as_string_orig;
};
}
10. Perl beta
use
ab
INIT {
*Employee::as_string_orig
= &Employee::as_string;
*Employee::as_string = sub {
uc shift->as_string_orig;
};
}
11. Perl beta
use
ab
package FollowVar;
use Tie::Scalar;
@ISA = ('Tie::StdScalar');
sub FETCH {
warn quot;>>> Called at quot;
. join(':', caller)
. quot;nquot;;
return shift->SUPER::FETCH(@_);
}
12. Perl beta
use
ab tie $name, 'FollowVar';
$name = quot;Casey Westquot;;
print Email::Address->new(
$name,
'casey@geeknest.com',
''
), quot;nquot;;
# >>> Called at Email::Address:
# /Library/Perl/5.8.6/Email/Address.pm:
# 216
# Casey West <casey@geeknest.com>
13. Perl beta
package FollowHash;
use
ab use Tie::Hash; @ISA = ('Tie::StdHash');
for my $sub (qw[FETCH STORE DELETE CLEAR
FIRSTKEY NEXTKEY]) {
*{$sub} = sub {
$self = shift;
$call = join':', (caller)[0,2];
$args = join',', map{$_ || 'undef'}@_;
warn quot;>>> $sub($args) by [$call]nquot;;
$sup = quot;SUPER::$subquot;;
$self->$sup(@_);
}
}
14. Perl beta
use
ab
use Template;
tie %vars, 'FollowHash';
%vars = (name => quot;Casey Westquot;);
Template->new->process(<<__TT__, %vars);
Hello, my name is [% name %].
__TT__
15. Perl beta
use CLEAR() by [main:23]
ab
STORE(name,Casey West) by [main:23]
STORE(template,
Template::Document=HASH(0x1866920))
by [Template::Service:79]
FETCH(import) by [Template::Stash:448]
FIRSTKEY() by [Template::Stash:456]
NEXTKEY(template) by [Template::Stash:456]
NEXTKEY(name) by [Template::Stash:456]
FETCH(template) by [Template::Stash:456]
FETCH(name) by [Template::Stash:456]
DELETE(template)
by [Template::Service:128]
Hello, my name is Casey West.
16. Perl beta
use sub parse_sheet_save {
ab
my ($rest, $linetype, $coord, $type,
$value, $valuetype, $formula, $style,
$namename, $namedesc, $fontnum,
$layoutnum, $colornum, $check, $maxrow,
$maxcol, $row, $col);
my ($lines, $sheetdata) = @_;
my $errortext;
# Initialize sheetdata structure
# ...
17. Perl beta
use
ab
# ########
#
# $ok = parse_sheet_save(@lines, %sheetdata)
#
# Sheet input routine. Fills %sheetdata given lines of text @lines.
#
# Currently always returns nothing.
#
# Sheet save format:
#
# linetype:param1:param2:...
#
# Linetypes are:
#
# version:versionname - version of this format. Currently 1.3.
#
# cell:coord:type:value...:type:value... - Types are as follows:
#
# v:value - straight numeric value
# t:value - straight text/wiki-text in cell, encoded to handle , :, newlines
# vt:fulltype:value - value with value type/subtype
# vtf:fulltype:value:formulatext - formula resulting in value with value type/subtype, value and text encoded
# vtc:fulltype:value:valuetext - formatted text constant resulting in value with value type/subtype, value and text encoded
# vf:fvalue:formulatext - formula resulting in value, value and text encoded (obsolete: only pre format version 1.1)
# fvalue - first char is quot;Nquot; for numeric value, quot;Tquot; for text value, quot;Hquot; for HTML value, rest is the value
# e:errortext - Error text. Non-blank means formula parsing/calculation results in error.
# b:topborder#:rightborder#:bottomborder#:leftborder# - border# in sheet border list or blank if none
# l:layout# - number in cell layout list
# f:font# - number in sheet fonts list
# c:color# - sheet color list index for text
# bg:color# - sheet color list index for background color
# cf:format# - sheet cell format number for explicit format (align:left, etc.)
# cvf:valueformat# - sheet cell value format number (obsolete: only pre format v1.2)
# tvf:valueformat# - sheet cell text value format number
# ntvf:valueformat# - sheet cell non-text value format number
# colspan:numcols - number of columns spanned in merged cell
# rowspan:numrows - number of rows spanned in merged cell
# cssc:classname - name of CSS class to be used for cell when published instead of one calculated here
# csss:styletext - explicit CSS style information, encoded to handle :, etc.
# mod:allow - if quot;yquot; allow modification of cell for live quot;viewquot; recalc
#
# col:
# w:widthval - number, quot;autoquot; (no width in <col> tag), number%, or blank (use default)
# hide: - yes/no, no is assumed if missing
# row:
# hide - yes/no, no is assumed if missing
#
# sheet:
# c:lastcol - number
# r:lastrow - number
# w:defaultcolwidth - number, quot;autoquot;, number%, or blank (default->80)
# h:defaultrowheight - not used
# tf:format# - cell format number for sheet default for text values
# ntf:format# - cell format number for sheet default for non-text values (i.e., numbers)
# layout:layout# - default cell layout number in cell layout list
# font:font# - default font number in sheet font list
# vf:valueformat# - default number value format number in sheet valueformat list (obsolete: only pre format version 1.2)
# ntvf:valueformat# - default non-text (number) value format number in sheet valueformat list
# tvf:valueformat# - default text value format number in sheet valueformat list
# color:color# - default number for text color in sheet color list
# bgcolor:color# - default number for background color in sheet color list
# circularreferencecell:coord - cell coord with a circular reference
# recalc:value - on/off (on is default). If quot;onquot;, appropriate changes to the sheet cause a recalc
# needsrecalc:value - yes/no (no is default). If quot;yesquot;, formula values are not up to date
#
# name:name:description:value - name definition, name in uppercase, with value being quot;B5quot;, quot;A1:B7quot;, or quot;=formulaquot;
# font:fontnum:value - text of font definition (style weight size family) for font fontnum
# quot;*quot; for quot;style weightquot;, size, or family, means use default (first look to sheet, then builtin)
# color:colornum:rgbvalue - text of color definition (e.g., rgb(255,255,255)) for color colornum
# border:bordernum:value - text of border definition (thickness style color) for border bordernum
# layout:layoutnum:value - text of vertical alignment and padding style for cell layout layoutnum:
# vertical-alignment:vavalue;padding topval rightval bottomval leftval;
# cellformat:cformatnum:value - text of cell alignment (left/center/right) for cellformat cformatnum
# valueformat:vformatnum:value - text of number format (see format_value_for_display) for valueformat vformatnum (changed in v1.2)
# clipboardrange:upperleftcoord:bottomrightcoord - origin of clipboard data. Not present if clipboard empty.
# There must be a clipboardrange before any clipboard lines
# clipboard:coord:type:value:... - clipboard data, in same format as cell data
#
# The resulting $sheetdata data structure is as follows:
#
# $sheetdata{version} - version of save file read in
# $sheetdata{datatypes}->{$coord} - Origin of {datavalues} value:
# v - typed in numeric value of some sort, constant, no formula
# t - typed in text, constant, no formula
# f - result of formula calculation ({formulas} has formula to calculate)
# c - constant of some sort with typed in text in {formulas} and value in {datavalues}
# $sheetdata{formulas}->{$coord} - Text of formula if {datatypes} is quot;fquot;, no leading quot;=quot;, or text of constant if quot;cquot;
# $sheetdata{datavalues}->{$coord} - a text or numeric value ready to be formatted for display or used in calculation
# $sheetdata{valuetypes}->{$coord} - the value type of the datavalue as 1 or more characters
# First char is quot;nquot; for numeric or quot;tquot; for text
# Second chars, if present, are sub-type, like quot;lquot; for logical (0=false, 1=true)
# $sheetdata{cellerrors}->{$coord} - If non-blank, error text for error in formula calculation
# $sheetdata{cellattribs}->{$coord}->
# {coord} - coord of cell - existence means non-blank cell
# {bt}, {br}, {bb}, {bl} - border number or null if no border
# {layout} - cell layout number or blank for default
# {font} - font number or blank for default
# {color} - color number for text or blank for default
# {bgcolor} - color number for the cell background or blank for default
# {cellformat} - cell format number if not default - controls horizontal alignment
# {textvalueformat} - value format number if not default - controls how the cell's text values are formatted into text for display
# {nontextvalueformat} - value format number if not default - controls how the cell's non-text values are turned into text for display
# {colspan}, {rowspan} - column span and row span for merged cells or blank for 1
# {cssc}, {csss} - explicit CSS class and CSS style for cell
# {mod} - if quot;yquot; allow modification in live view
# $sheetdata{colattribs}->{$colcoord}->
# {width} - column width if not default
# {hide} - hide column if yes
# $sheetdata{rowattribs}->{$rowcoord}->
# {height} - ignored
# {hide} - hide row if yes
# $sheetdata{sheetattribs}->{$attrib}->
# {lastcol} - number of columns in sheet
# {lastrow} - number of rows in sheet (more may be displayed when editing)
# {defaultcolwidth} - number, quot;autoquot;, number%, or blank (default->80)
# {defaultrowheight} - not used
# {defaulttextformat} - cell format number for sheet default for text values
# {defaultnontextformat} - cell format number for sheet default for non-text values (i.e., numbers)
# {defaultlayout} - default cell layout number in sheet cell layout list
# {defaultfont} - default font number in sheet font list
# {defaulttextvalueformat} - default text value format number in sheet valueformat list
# {defaultnontextvalueformat} - default number value format number in sheet valueformat list
# {defaultcolor} - default number for text color in sheet color list
# {defaultbgcolor} - default number for background color in sheet color list
# {circularreferencecell} - cell coord with a circular reference
# {recalc} - on/off (on is default). If quot;onquot;, appropriate changes to the sheet cause a recalc
# {needsrecalc} - yes/no (no is default). If quot;yesquot;, formula values are not up to date
# $sheetdata{names}->{$name}-> - name is uppercase
# {desc} - description (optional)
# {definiton} - in the form of B5, A1:B7, or =formula
# $sheetdata{fonts}->[$index] - font specifications addressable by array position
# $sheetdata{fonthash}->{$value} - hash with font specification as keys and {fonts}->[] index position as values
# $sheetdata{colors}->[$index] - color specifications addressable by array position
# $sheetdata{colorhash}->{$value} - hash with color specification as keys and {colors}->[] index position as values
# $sheetdata{borderstyles}->[$index] - border style specifications addressable by array position
# $sheetdata{borderstylehash}->{$value} - hash with border style specification as keys and {borderstyles}->[] index position as values
# $sheetdata{layoutstyles}->[$index] - cell layout specifications addressable by array position
# $sheetdata{layoutstylehash}->{$value} - hash with cell layout specification as keys and {layoutstyle}->[] index position as values
# $sheetdata{cellformats}->[$index] - cell format specifications addressable by array position
# $sheetdata{cellformathash}->{$value} - hash with cell format specification as keys and {cellformats}->[] index position as values
# $sheetdata{valueformats}->[$index] - value format specifications addressable by array position
# $sheetdata{valueformathash}->{$value} - hash with value format specification as keys and {valueformats}->[] index position as values
# $sheetdata{clipboard}-> - the sheet's clipboard
# {range} - coord:coord range of where the clipboard contents came from or null if empty
# {datavalues} - like $sheetdata{datavalues} but for clipboard copy of cells
# {datatypes} - like $sheetdata{datatypes} but for clipboard copy of cells
# {valuetypes} - like $sheetdata{valuetypes} but for clipboard copy of cells
# {formulas} - like $sheetdata{formulas} but for clipboard copy of cells
# {cellerrors} - like $sheetdata{cellerrors} but for clipboard copy of cells
# {cellattribs} - like $sheetdata{cellattribs} but for clipboard copy of cells
# $sheetdata{loaderror} - if non-blank, there was an error loading this sheet and this is the text of that error
#
# ########
18. Perl beta
use
ab
# $sheetdata{sheetattribs}->{$attrib}->
# {lastcol} - number of columns in sheet
# {lastrow} - number of rows in sheet
# (more may be displayed when editing)
# {defaultcolwidth} - number, quot;autoquot;,
# number%, or blank (default->80)
# {defaultrowheight} - not used
# {defaulttextformat} - cell format
# number for sheet default for text
# values
20. Perl beta
use
ab
require App::SocialCalc;
use Lab;
do shift;
# perl -I $HOME -I lib
# ~/lab.pl bin/socialcalc.pl
21. Perl beta
use $VAR1 = 'INPUT';
ab
$VAR2 = [
[
'version:1.3
',
'cell:A1:t:= A page to try
some of wikiCalc's features =nnYou
can use this page to ...'
]
];
$VAR1 = 'OUTPUT';
$VAR2 = [
'14'
];
22. Perl beta
use
ab
# ########
#
# $ok = parse_sheet_save(@lines, %sheetdata)
#
# Sheet input routine. Fills %sheetdata given lines of text @lines.
#
# Currently always returns nothing.
#
# Sheet save format:
#
# linetype:param1:param2:...
#
# Linetypes are:
#
# version:versionname - version of this format. Currently 1.3.
#
# cell:coord:type:value...:type:value... - Types are as follows:
#
# v:value - straight numeric value
# t:value - straight text/wiki-text in cell, encoded to handle , :, newlines
# vt:fulltype:value - value with value type/subtype
# vtf:fulltype:value:formulatext - formula resulting in value with value type/subtype, value and text encoded
# vtc:fulltype:value:valuetext - formatted text constant resulting in value with value type/subtype, value and text encoded
# vf:fvalue:formulatext - formula resulting in value, value and text encoded (obsolete: only pre format version 1.1)
# fvalue - first char is quot;Nquot; for numeric value, quot;Tquot; for text value, quot;Hquot; for HTML value, rest is the value
# e:errortext - Error text. Non-blank means formula parsing/calculation results in error.
# b:topborder#:rightborder#:bottomborder#:leftborder# - border# in sheet border list or blank if none
# l:layout# - number in cell layout list
# f:font# - number in sheet fonts list
# c:color# - sheet color list index for text
# bg:color# - sheet color list index for background color
# cf:format# - sheet cell format number for explicit format (align:left, etc.)
# cvf:valueformat# - sheet cell value format number (obsolete: only pre format v1.2)
# tvf:valueformat# - sheet cell text value format number
# ntvf:valueformat# - sheet cell non-text value format number
# colspan:numcols - number of columns spanned in merged cell
# rowspan:numrows - number of rows spanned in merged cell
# cssc:classname - name of CSS class to be used for cell when published instead of one calculated here
# csss:styletext - explicit CSS style information, encoded to handle :, etc.
# mod:allow - if quot;yquot; allow modification of cell for live quot;viewquot; recalc
#
# col:
# w:widthval - number, quot;autoquot; (no width in <col> tag), number%, or blank (use default)
# hide: - yes/no, no is assumed if missing
# row:
# hide - yes/no, no is assumed if missing
#
# sheet:
# c:lastcol - number
# r:lastrow - number
# w:defaultcolwidth - number, quot;autoquot;, number%, or blank (default->80)
# h:defaultrowheight - not used
# tf:format# - cell format number for sheet default for text values
# ntf:format# - cell format number for sheet default for non-text values (i.e., numbers)
# layout:layout# - default cell layout number in cell layout list
# font:font# - default font number in sheet font list
# vf:valueformat# - default number value format number in sheet valueformat list (obsolete: only pre format version 1.2)
# ntvf:valueformat# - default non-text (number) value format number in sheet valueformat list
# tvf:valueformat# - default text value format number in sheet valueformat list
# color:color# - default number for text color in sheet color list
# bgcolor:color# - default number for background color in sheet color list
# circularreferencecell:coord - cell coord with a circular reference
# recalc:value - on/off (on is default). If quot;onquot;, appropriate changes to the sheet cause a recalc
# needsrecalc:value - yes/no (no is default). If quot;yesquot;, formula values are not up to date
#
# name:name:description:value - name definition, name in uppercase, with value being quot;B5quot;, quot;A1:B7quot;, or quot;=formulaquot;
# font:fontnum:value - text of font definition (style weight size family) for font fontnum
# quot;*quot; for quot;style weightquot;, size, or family, means use default (first look to sheet, then builtin)
# color:colornum:rgbvalue - text of color definition (e.g., rgb(255,255,255)) for color colornum
# border:bordernum:value - text of border definition (thickness style color) for border bordernum
# layout:layoutnum:value - text of vertical alignment and padding style for cell layout layoutnum:
# vertical-alignment:vavalue;padding topval rightval bottomval leftval;
# cellformat:cformatnum:value - text of cell alignment (left/center/right) for cellformat cformatnum
# valueformat:vformatnum:value - text of number format (see format_value_for_display) for valueformat vformatnum (changed in v1.2)
# clipboardrange:upperleftcoord:bottomrightcoord - origin of clipboard data. Not present if clipboard empty.
# There must be a clipboardrange before any clipboard lines
# clipboard:coord:type:value:... - clipboard data, in same format as cell data
#
# The resulting $sheetdata data structure is as follows:
#
# $sheetdata{version} - version of save file read in
# $sheetdata{datatypes}->{$coord} - Origin of {datavalues} value:
# v - typed in numeric value of some sort, constant, no formula
# t - typed in text, constant, no formula
# f - result of formula calculation ({formulas} has formula to calculate)
# c - constant of some sort with typed in text in {formulas} and value in {datavalues}
# $sheetdata{formulas}->{$coord} - Text of formula if {datatypes} is quot;fquot;, no leading quot;=quot;, or text of constant if quot;cquot;
# $sheetdata{datavalues}->{$coord} - a text or numeric value ready to be formatted for display or used in calculation
# $sheetdata{valuetypes}->{$coord} - the value type of the datavalue as 1 or more characters
# First char is quot;nquot; for numeric or quot;tquot; for text
# Second chars, if present, are sub-type, like quot;lquot; for logical (0=false, 1=true)
# $sheetdata{cellerrors}->{$coord} - If non-blank, error text for error in formula calculation
# $sheetdata{cellattribs}->{$coord}->
# {coord} - coord of cell - existence means non-blank cell
# {bt}, {br}, {bb}, {bl} - border number or null if no border
# {layout} - cell layout number or blank for default
# {font} - font number or blank for default
# {color} - color number for text or blank for default
# {bgcolor} - color number for the cell background or blank for default
# {cellformat} - cell format number if not default - controls horizontal alignment
# {textvalueformat} - value format number if not default - controls how the cell's text values are formatted into text for display
# {nontextvalueformat} - value format number if not default - controls how the cell's non-text values are turned into text for display
# {colspan}, {rowspan} - column span and row span for merged cells or blank for 1
# {cssc}, {csss} - explicit CSS class and CSS style for cell
# {mod} - if quot;yquot; allow modification in live view
# $sheetdata{colattribs}->{$colcoord}->
# {width} - column width if not default
# {hide} - hide column if yes
# $sheetdata{rowattribs}->{$rowcoord}->
# {height} - ignored
# {hide} - hide row if yes
# $sheetdata{sheetattribs}->{$attrib}->
# {lastcol} - number of columns in sheet
# {lastrow} - number of rows in sheet (more may be displayed when editing)
# {defaultcolwidth} - number, quot;autoquot;, number%, or blank (default->80)
# {defaultrowheight} - not used
# {defaulttextformat} - cell format number for sheet default for text values
# {defaultnontextformat} - cell format number for sheet default for non-text values (i.e., numbers)
# {defaultlayout} - default cell layout number in sheet cell layout list
# {defaultfont} - default font number in sheet font list
# {defaulttextvalueformat} - default text value format number in sheet valueformat list
# {defaultnontextvalueformat} - default number value format number in sheet valueformat list
# {defaultcolor} - default number for text color in sheet color list
# {defaultbgcolor} - default number for background color in sheet color list
# {circularreferencecell} - cell coord with a circular reference
# {recalc} - on/off (on is default). If quot;onquot;, appropriate changes to the sheet cause a recalc
# {needsrecalc} - yes/no (no is default). If quot;yesquot;, formula values are not up to date
# $sheetdata{names}->{$name}-> - name is uppercase
# {desc} - description (optional)
# {definiton} - in the form of B5, A1:B7, or =formula
# $sheetdata{fonts}->[$index] - font specifications addressable by array position
# $sheetdata{fonthash}->{$value} - hash with font specification as keys and {fonts}->[] index position as values
# $sheetdata{colors}->[$index] - color specifications addressable by array position
# $sheetdata{colorhash}->{$value} - hash with color specification as keys and {colors}->[] index position as values
# $sheetdata{borderstyles}->[$index] - border style specifications addressable by array position
# $sheetdata{borderstylehash}->{$value} - hash with border style specification as keys and {borderstyles}->[] index position as values
# $sheetdata{layoutstyles}->[$index] - cell layout specifications addressable by array position
# $sheetdata{layoutstylehash}->{$value} - hash with cell layout specification as keys and {layoutstyle}->[] index position as values
# $sheetdata{cellformats}->[$index] - cell format specifications addressable by array position
# $sheetdata{cellformathash}->{$value} - hash with cell format specification as keys and {cellformats}->[] index position as values
# $sheetdata{valueformats}->[$index] - value format specifications addressable by array position
# $sheetdata{valueformathash}->{$value} - hash with value format specification as keys and {valueformats}->[] index position as values
# $sheetdata{clipboard}-> - the sheet's clipboard
# {range} - coord:coord range of where the clipboard contents came from or null if empty
# {datavalues} - like $sheetdata{datavalues} but for clipboard copy of cells
# {datatypes} - like $sheetdata{datatypes} but for clipboard copy of cells
# {valuetypes} - like $sheetdata{valuetypes} but for clipboard copy of cells
# {formulas} - like $sheetdata{formulas} but for clipboard copy of cells
# {cellerrors} - like $sheetdata{cellerrors} but for clipboard copy of cells
# {cellattribs} - like $sheetdata{cellattribs} but for clipboard copy of cells
# $sheetdata{loaderror} - if non-blank, there was an error loading this sheet and this is the text of that error
#
# ########
23. Perl beta
use
ab
*$SYM = sub{
my @res = $ORIG->(@_);
print Dumper $_[1]; # sheetdata
return @res;
};
27. Perl beta
use
ab
use Net::SMTP;
$smtp = Net::SMTP->new(
'iminuremail.com',
SSL => 1,
Port => 465,
);
# ...
28. Perl beta
use
ab
use Net::SMTP::SSL;
$smtp = Net::SMTP::SSL->new(
'iminuremail.com'
);
# ...
29. Perl beta
use
ab
package Net::SMTP;
@ISA = qw[Net::Cmd IO::Socket::INET];
sub new {
my $self = shift;
# ...
return $self->SUPER::new(@_);
}
30. Perl beta
use
ab
package Net::SMTP::SSL;
use base qw[IO::Socket::SSL Net::SMTP];
31. Perl beta
use
ab
package Net::SMTP::SSL;
use base qw[Net::SMTP IO::Socket::SSL];
32. Perl beta
use
ab
package Net::SMTP::SSL;
use base 'Net::SMTP';
@Net::SMTP::ISA = map {
$_ eq 'IO::Socket::INET'
? 'IO::Socket::SSL'
: $_
} @Net::SMTP::ISA;
33. Perl beta
use
ab package Net::SMTP::SSL;
use IO::Socket::SSL;
use Net::SMTP;
@ISA = ( 'IO::Socket::SSL',
grep { $_ ne 'IO::Socket::INET' }
@Net::SMTP::ISA );
for ( keys %Net::SMTP:: ) {
next unless
defined *{$Net::SMTP::{$_}}{CODE};
*{$_} = &{quot;Net::SMTP::$_quot;};
}
34. Perl beta
use
ab
package String;
use overload
'quot;quot;' => sub { ${+shift} };
sub new { bless $_[1], $_[0] }
sub length { length(${+shift}) }
sub exclaim { uc(${+shift}) . '!!1' }
35. Perl beta
use
ab
print quot;Casey Westquot;->()->length;
print
quot;never touch them togetherquot;->()->exclaim;
sub AUTOLOAD {
($m) = ($::AUTOLOAD =~ /.+::(.+)/);
String->new($m);
}
# 10
# NEVER TOUCH THEM TOGETHER!!1
36. Perl beta
use
ab
$me = quot;Casey Westquot;->();
print $me->length;
print $me->exclaim;
print $me;
# 10
# CASEY WEST!!1
# Casey West
37. Perl beta
use
ab
new $me quot;Casey West Srquot;;
print quot;$me is quot; . $me->length;
# Casey West Sr is 13
38. Perl beta
use
ab
sub new {
ref($_[0])
? ${$_[0]} = $_[1]
: bless $_[1], $_[0] ;
}
39. Perl beta
use
ab
print
&Thanks, &for, &coming, &to, &my, &talk,
quot;nquot;;
sub AUTOLOAD {
($w) = ($::AUTOLOAD =~ /.*::(.+)/);
quot;$w quot;;
}