SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Perl                      beta

   use
ab




         *{quot;Abuse Perlquot;} = sub {
            quot;by Casey Westnquot;
         };

         print quot;Abuse Perlquot;->();
Perl                                    beta

   use
ab


         *{'
         '} = sub {
            print quot;Abuse Perl by Casey Westnquot;
         };

         <<_->()

         _
Perl                        beta

   use
ab

         *{'
         '} = sub { print shift };

         <<_->(<<_)

         _
         Abuse Perl by Casey West
         _

         # via Abigail
Perl                                    beta

   use
ab



         *{'
         '} = sub {
            print quot;Abuse Perl by Casey Westnquot;
         };

         '
         '->();
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;
         }
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
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
Perl                             beta

   use
ab


         INIT {
           *Employee::as_string = sub {
              my $self = shift;
              sprintf quot;%s is a %snquot;,
                $self->name,
                $self->title;
           };
         }
Perl                               beta

   use
ab


         INIT {
           *Employee::as_string_orig
             = *Employee::as_string;

             *Employee::as_string = sub {
                uc shift->as_string_orig;
             };
         }
Perl                               beta

   use
ab


         INIT {
           *Employee::as_string_orig
             = &Employee::as_string;

             *Employee::as_string = sub {
                uc shift->as_string_orig;
             };
         }
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(@_);
         }
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>
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(@_);
        }
    }
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__
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.
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
       # ...
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
         #
         #   ########
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
Perl                                        beta

         package Lab;                use Data::Dumper;
   use
ab
         $PKG    =   'SocialCalc::Sheet';
         $FUNC   =   'parse_sheet_save';
         $SYM    =   quot;$PKG::$FUNCquot;;
         $ORIG   =   quot;$SYM_origquot;;

         eval quot;require $PKG;quot;;       *$ORIG = &{$SYM};

         *$SYM = sub{
            print(Dumper(quot;INPUTquot;, [@_]));
            my @res = $ORIG->(@_);
            print(Dumper(quot;OUTPUTquot;, [@res]));
            return @res;
         };
Perl                             beta

   use
ab



         require App::SocialCalc;
         use Lab;
         do shift;

         # perl -I $HOME -I lib
         #   ~/lab.pl bin/socialcalc.pl
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'
              ];
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
         #
         #   ########
Perl                                beta

   use
ab



         *$SYM = sub{
           my @res = $ORIG->(@_);

           print Dumper $_[1]; # sheetdata

           return @res;
         };
Perl                          beta

         $VAR1 = {
   use
ab         'sheetattribs' => {
              'lastcol' => '8',
              'lastrow' => '14'
           },
           'fonthash' => {
              '* x-small *' => 2,
              'normal bold * *' => 1
           },
           'cellattribs' => {
              'A1' => {
                'color' => '3',
                'colspan' => '8',
                'coord' => 'A1',
                'font' => '2'
Perl                                    beta

   use
ab




         use Net::SMTP;

         $smtp = Net::SMTP->new('iminuremail.com');

         # ...
Perl   beta

   use
ab
Perl                      beta

   use
ab

         use Net::SMTP;

         $smtp = Net::SMTP->new(
            'iminuremail.com',
            SSL => 1,
            Port => 465,
         );

         # ...
Perl                           beta

   use
ab



         use Net::SMTP::SSL;

         $smtp = Net::SMTP::SSL->new(
            'iminuremail.com'
         );

         # ...
Perl                                    beta

   use
ab

         package Net::SMTP;

         @ISA = qw[Net::Cmd IO::Socket::INET];

         sub new {
           my $self = shift;
           # ...
           return $self->SUPER::new(@_);
         }
Perl                                      beta

   use
ab




         package Net::SMTP::SSL;

         use base qw[IO::Socket::SSL Net::SMTP];
Perl                                      beta

   use
ab




         package Net::SMTP::SSL;

         use base qw[Net::SMTP IO::Socket::SSL];
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;
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;};
         }
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' }
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
Perl                        beta

   use
ab


         $me =   quot;Casey Westquot;->();
         print   $me->length;
         print   $me->exclaim;
         print   $me;

         # 10
         # CASEY WEST!!1
         # Casey West
Perl                             beta

   use
ab




         new $me quot;Casey West Srquot;;
         print quot;$me is quot; . $me->length;

         # Casey West Sr is 13
Perl                        beta

   use
ab




         sub new {
             ref($_[0])
           ? ${$_[0]} = $_[1]
           : bless $_[1], $_[0] ;
         }
Perl                                    beta

   use
ab


         print
           &Thanks, &for, &coming, &to, &my, &talk,
           quot;nquot;;

         sub AUTOLOAD {
           ($w) = ($::AUTOLOAD =~ /.*::(.+)/);
           quot;$w quot;;
         }

Weitere ähnliche Inhalte

Was ist angesagt?

Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
Lin Yo-An
 
Mod Perl Quick Reference Card
Mod Perl Quick Reference CardMod Perl Quick Reference Card
Mod Perl Quick Reference Card
Faryne Hsieh
 
Introduction to Perl - Day 2
Introduction to Perl - Day 2Introduction to Perl - Day 2
Introduction to Perl - Day 2
Dave Cross
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
Ben James
 

Was ist angesagt? (20)

Php Basic
Php BasicPhp Basic
Php Basic
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Mastering Grammars with PetitParser
Mastering Grammars with PetitParserMastering Grammars with PetitParser
Mastering Grammars with PetitParser
 
PHP7. Game Changer.
PHP7. Game Changer. PHP7. Game Changer.
PHP7. Game Changer.
 
Dealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter ScottDealing with Legacy Perl Code - Peter Scott
Dealing with Legacy Perl Code - Peter Scott
 
Ruby 2.0
Ruby 2.0Ruby 2.0
Ruby 2.0
 
Perl 5.10 for People Who Aren't Totally Insane
Perl 5.10 for People Who Aren't Totally InsanePerl 5.10 for People Who Aren't Totally Insane
Perl 5.10 for People Who Aren't Totally Insane
 
Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)
 
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner) Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
 
Mod Perl Quick Reference Card
Mod Perl Quick Reference CardMod Perl Quick Reference Card
Mod Perl Quick Reference Card
 
LPW: Beginners Perl
LPW: Beginners PerlLPW: Beginners Perl
LPW: Beginners Perl
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager Needs
 
Programming in perl style
Programming in perl styleProgramming in perl style
Programming in perl style
 
Introduction to Perl - Day 2
Introduction to Perl - Day 2Introduction to Perl - Day 2
Introduction to Perl - Day 2
 
Scalar data types
Scalar data typesScalar data types
Scalar data types
 
Subroutines
SubroutinesSubroutines
Subroutines
 
Perl6 in-production
Perl6 in-productionPerl6 in-production
Perl6 in-production
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
 

Andere mochten auch

Camille Walker Email Copywriting Samples Portfolio
Camille Walker Email Copywriting Samples PortfolioCamille Walker Email Copywriting Samples Portfolio
Camille Walker Email Copywriting Samples Portfolio
Camille A. Walker, MS, MBA
 
Viamente GPS & Driver Behavior
Viamente GPS & Driver Behavior Viamente GPS & Driver Behavior
Viamente GPS & Driver Behavior
Michelle Tarantino
 
Contact agosto
Contact agostoContact agosto
Contact agosto
Leutherio
 
RAMEZ BORAIE PROJECT MANAGEMENTS
RAMEZ BORAIE PROJECT MANAGEMENTSRAMEZ BORAIE PROJECT MANAGEMENTS
RAMEZ BORAIE PROJECT MANAGEMENTS
Ramez Boraie
 
Ppoooer Avellaner Correcte
Ppoooer Avellaner CorrectePpoooer Avellaner Correcte
Ppoooer Avellaner Correcte
guest441812
 
Aaren D.F. Brown nuc
Aaren D.F. Brown nucAaren D.F. Brown nuc
Aaren D.F. Brown nuc
Aaren Brown
 
Bailloux gueit dossier patient
Bailloux gueit dossier patientBailloux gueit dossier patient
Bailloux gueit dossier patient
AssociationAF
 
Bella Hung ría
Bella Hung ríaBella Hung ría
Bella Hung ría
LilianaB2008
 

Andere mochten auch (20)

Camille Walker Email Copywriting Samples Portfolio
Camille Walker Email Copywriting Samples PortfolioCamille Walker Email Copywriting Samples Portfolio
Camille Walker Email Copywriting Samples Portfolio
 
Viamente GPS & Driver Behavior
Viamente GPS & Driver Behavior Viamente GPS & Driver Behavior
Viamente GPS & Driver Behavior
 
Contact agosto
Contact agostoContact agosto
Contact agosto
 
RAMEZ BORAIE PROJECT MANAGEMENTS
RAMEZ BORAIE PROJECT MANAGEMENTSRAMEZ BORAIE PROJECT MANAGEMENTS
RAMEZ BORAIE PROJECT MANAGEMENTS
 
What's new in Doctrine
What's new in DoctrineWhat's new in Doctrine
What's new in Doctrine
 
HTML
HTMLHTML
HTML
 
Andrejs Vasiljevs (Tilde) at the Industry Leaders Forum 2015
Andrejs Vasiljevs (Tilde) at the Industry Leaders Forum 2015Andrejs Vasiljevs (Tilde) at the Industry Leaders Forum 2015
Andrejs Vasiljevs (Tilde) at the Industry Leaders Forum 2015
 
Turbó fokozat
Turbó fokozatTurbó fokozat
Turbó fokozat
 
Ppoooer Avellaner Correcte
Ppoooer Avellaner CorrectePpoooer Avellaner Correcte
Ppoooer Avellaner Correcte
 
Aaren D.F. Brown nuc
Aaren D.F. Brown nucAaren D.F. Brown nuc
Aaren D.F. Brown nuc
 
Doubters
DoubtersDoubters
Doubters
 
Rolniczy
RolniczyRolniczy
Rolniczy
 
Mario Benedetti
Mario BenedettiMario Benedetti
Mario Benedetti
 
Bailloux gueit dossier patient
Bailloux gueit dossier patientBailloux gueit dossier patient
Bailloux gueit dossier patient
 
iPhone Dev Camp Keynote
iPhone Dev Camp  KeynoteiPhone Dev Camp  Keynote
iPhone Dev Camp Keynote
 
Aula sobre email
Aula sobre emailAula sobre email
Aula sobre email
 
Baheya hospital - Lasheenstst
Baheya hospital - LasheenststBaheya hospital - Lasheenstst
Baheya hospital - Lasheenstst
 
Bella Hung ría
Bella Hung ríaBella Hung ría
Bella Hung ría
 
What is Your Library Doing about Emerging Technologies?
What is Your Library Doing about Emerging Technologies?What is Your Library Doing about Emerging Technologies?
What is Your Library Doing about Emerging Technologies?
 
Open Data e Open Data Sicilia
Open Data e Open Data SiciliaOpen Data e Open Data Sicilia
Open Data e Open Data Sicilia
 

Ähnlich wie Abuse Perl

20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
Tatsuhiko Miyagawa
 
Power Theming
Power ThemingPower Theming
Power Theming
drkdn
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
Mohammed Farrag
 

Ähnlich wie Abuse Perl (20)

Perl Presentation
Perl PresentationPerl Presentation
Perl Presentation
 
Cleancode
CleancodeCleancode
Cleancode
 
Php2
Php2Php2
Php2
 
Antlr V3
Antlr V3Antlr V3
Antlr V3
 
Beginning Perl
Beginning PerlBeginning Perl
Beginning Perl
 
Sorting techniques in Perl
Sorting techniques in PerlSorting techniques in Perl
Sorting techniques in Perl
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
 
Prototype js
Prototype jsPrototype js
Prototype js
 
Introduction to Modern Perl
Introduction to Modern PerlIntroduction to Modern Perl
Introduction to Modern Perl
 
Bioinformatica 10-11-2011-p6-bioperl
Bioinformatica 10-11-2011-p6-bioperlBioinformatica 10-11-2011-p6-bioperl
Bioinformatica 10-11-2011-p6-bioperl
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
PHP
PHP PHP
PHP
 
Power Theming
Power ThemingPower Theming
Power Theming
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
 
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 

Kürzlich hochgeladen

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
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
  • 19. Perl beta package Lab; use Data::Dumper; use ab $PKG = 'SocialCalc::Sheet'; $FUNC = 'parse_sheet_save'; $SYM = quot;$PKG::$FUNCquot;; $ORIG = quot;$SYM_origquot;; eval quot;require $PKG;quot;; *$ORIG = &{$SYM}; *$SYM = sub{ print(Dumper(quot;INPUTquot;, [@_])); my @res = $ORIG->(@_); print(Dumper(quot;OUTPUTquot;, [@res])); return @res; };
  • 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; };
  • 24. Perl beta $VAR1 = { use ab 'sheetattribs' => { 'lastcol' => '8', 'lastrow' => '14' }, 'fonthash' => { '* x-small *' => 2, 'normal bold * *' => 1 }, 'cellattribs' => { 'A1' => { 'color' => '3', 'colspan' => '8', 'coord' => 'A1', 'font' => '2'
  • 25. Perl beta use ab use Net::SMTP; $smtp = Net::SMTP->new('iminuremail.com'); # ...
  • 26. Perl beta use ab
  • 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;; }