<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>


                    ??????? Perl???????????

                    ????????
                    ????Perl?е???
                    ??????????
                    ?????????
                  1. ???????

                  2. ?塢????
                    ?????????????
                    ????????????
                    ???????
                    ???????????
                    ??????
                    ??????????????
                    ?????Perl????????Щ???

                        ?????????????Perl???????????(OOP)???????ι???????????????С???????????????????????
                    ????????
                        ???(module)????Perl??(pachage)??Perl?е?????????????????????á??????ü???x?????????
                    ???http://www.metronet.com??perlmod??perlobj??
                        ??????????????????????????????????????????????????????????????????ж????????????????????????????????????????????????????????????????????????????????????????????????????Perl??????????????????????Perl5?У??????б??????淶??????????á?
                        ???????????????????????????Perl????ι????????????
                        .???????Perl???????к?????????????
                        .?????????Perl???????????????????????
                        .?????????????????????á?
                    ????Perl?е???
                        ???????£????Perl???????????????????????Perl???????????????????????????????????Perl5???????????????????????C++?????????????????????????Perl4?????????????e??(::)??????????????????????
                        ?????????????????????С?Perl?е??????????????????????????????????????з???????????????????????????????С?
                        ???????????????????????????????????估?????????????????饗?????x?1??????飩???????????????????????????????????????????y??????????????(')??????????λ???е?????????г?????λ????磺$class'$member????Perl5?У??????e??????????????????????磺$class'$member??$class::$member?????
                    ??????????
                        ???????????????????????衣???????????????????????Cocoa????????書??????????????Java???????????????????????????????????Java??????????????????Java???????????????????????䶮
                        ???????????????Cocoa.pm??????(?????pm?????????????????Perl Module)???????????????????????????????????????????????????1;????????У??????????????????????????1;????????С?????Perl?????????????????e??????Perl????????????????????????
                    package Cocoa;

                    #
                    # Put "require" statements in for all required,imported packages
                    #

                    #
                    # Just add code here
                    #

                    1; # terminate the package with the required 1;
                        ??????????????????????????????????????????????????new()????????????????????????new()?????????????????
                    ?????????
                        ??????????????????????????????????????á?????????????????????????????????????????y?????????bless()?????????
                        bless YeReference [,classname]
                        YeReference??????????????????????classname?????????????????????????????????????????
                        ????????????????????????????????????????????????磺
                    sub new {
                      my $this = {}; # Create an anonymous hash, and #self points to it.
                      bless $this; # Connect the hash to the package Cocoa.
                      return $this; # Return the reference to the hash.
                    }

                    1;
                        {}??????????????/??????????????????飩?????????????????????????$this??????bless()??????????????????????????Cocoa???????????á???????????????????????????????
                        ??new()?????????$this???????????????ú??????????ù?????????????ù??????????????????????Perl??????б???ù?????????????????μ????
                        $cup = new Cocoa;
                        ???????????e???????????????
                    1 #!/usr/bin/perl
                    2 push (@INC,'pwd');
                    3 use Cocoa;
                    4 $cup = new Cocoa;
                        ????????Perl????????λ?????????У???????????·??????б?@INC?й????????á?????????????????д????????鰱????t???·???????磬?????/home/test/scripts/????????????о???????£?
                        push (@INC , "/home/test/scripts");
                        ????????У????????Cocoa.pm????????????蹦???use??????Perl??@INC·????????Cocoa.pm???????????????????????С?use????????????????????е???new????????????????Perl???????????????????????????????????????????????ж????????????д??
                        $cup = cocoa->new();
                        ???????C??????????????e????????Cocoa???е?new()???????磺
                        $cup = Cocoa::new();
                        ????????????м??????????????Cocoa.pm?У??????????????????????????????????????ù????????????????????????????
                    ???
                    1??????????????г??????????
                    2????????my??????????д?????????
                    3??????????????????local?????????????????????????????
                    4????????????????????????????
                        ??????????Cocoa?????????£?
                    sub new {
                      my $this = {};
                      print "\n /* \n ** Created by Cocoa.pm \n ** Use at own risk";
                      print "\n ** Did this code even get pass the javac compiler? ";
                      print "\n **/ \n";
                      bless $this;
                      return $this;
                    }
                        ??????????e????????????????????????????????????磺
                    sub new {
                      my $this = {}
                      bless $this;
                      $this->doInitialization();
                      return $this;
                    }
                        ???????????????????????У??????????????????????????????new?????????new????????????????
                    sub new {
                      my $class = shift; # Get the request class name
                      my $this = {};
                      bless $this, $class # Use class name to bless() reference
                      $this->doInitialization(); return $this;
                    }
                        ??????????????????????????????е????
                  3. Cocoa::new()
                  4. Cocoa->new()
                  5. new Cocoa
                  6.     ??????bless????????????????μ????bless??????????????bless????????????C??Pascal??????????????????????????????????棬???????????????????????????????檔????????Perl?????????????????????
                        ?????????????????????????Perl????bless??????????????????????????bless??????????????????????????????????????????????????????κ???

                  7. ???????


                  8.     ???????????new()?????????????????????????????????????????????????????????????????new()????????????????????????
                        ???????????????????????????????????????
                        ?ù???????????£?
                    sub new {
                    my $type = shift;
                    my %parm = @_;
                    my $this = {};
                    $this->{'Name'} = $parm{'Name'};
                    $this->{'x'} = $parm{'x'};
                    $this->{'y'} = $parm{'y'};
                    bless $this, $type;
                    }
                        ?????鱣?????????£?
                    sub new {
                    my $type = shift;
                    my %parm = @_;
                    my $this = [];
                    $this->[0] = $parm{'Name'};
                    $this->[1] = $parm{'x'};
                    $this->[2] = $parm{'y'};
                    bless $this, $type;
                    }
                        ?????????????????′????????
                        $mug = Cocoa::new( 'Name' => 'top','x' => 10,'y' => 20 );
                        ??????=>????????????????????=>?????á???????????£?
                        print "Name=$mug->{'Name'}\n";
                        print "x=$mug->{'x'}\n";
                        print "y=$mug->{'y'}\n";
                    ?塢????
                        Perl????????????????Perl????????????????????????????Perl????????岻???κ????????????漲??????????????????????????????Perl?????????????????????鷽????
                        ????????????????????????鷽????????????????????á??????????????????????????????????????????????????????????????????????????????????????????????????????????????鷽??????????????????shift??????self??this?У????????????????????á??磺
                    1. sub nameLister {
                    2.     my $this = shift;
                    3.     my ($keys ,$value );
                    4.     while (($key, $value) = each (%$this)) {
                    5.         print "\t$key is $value.\n";
                    6.     }
                    7. }
                    ?????????????
                        ???????????????Cocoa.pm??????????????????δ????????????????Cocoa.pm?????????????????????????Exporter??飬?????????????????????У?
                        require Exporter;
                        @ISA = qw (Exporter);
                        ?????а?????Exporter.pm??飬????Exporter????????@ISA???????????????????????????????????@EXPORT?????о????????????????????closeMain??declareMain????????£?
                        @EXPORT = qw (declareMain , closeMain);
                        Perl??????????@ISA?????????@ISA???鯔??????κ???ж??壬???????????????壬Perl??????????????????????顣????@INC?????????@INC?????????????·????@ISA???麬????(??)?????????????????????δ???????@ISA?е???????@ISA?л????е?????е????????
                        ???е???????з??????????????????@ISA???鶨??????????????????@ISA??????δ?????Perl???AUTOLOAD()??????????????????????????????????sub???塣?????AUTOLOAD???????????use Autoload;??????autoload.pm????AUTOLOAD??????????????Perl???????????????????AUTOLOAD???????Perl???UNIVERSAL?????????γ?????????????Perl??????????????????????????
                    ????????????
                        ????????????????????????????????????????????鷽????????????????????????????????????÷????????????????????Cocoa???????Щ?????????????£?
                    package Cocoa;
                    require Exporter;
                    @ISA = qw(Exporter);
                    @EXPORT = qw(setImports, declareMain, closeMain);
                    #
                    # This routine creates the references for imports in Java functions
                    #
                    sub setImports{
                      my $class = shift @_;
                      my @names = @_;
                      foreach (@names) {
                        print "import " . $_ . ";\n";
                      }
                    }
                    #
                    # This routine declares the main function in a Java script
                    #
                    sub declareMain{
                      my $class = shift @_;
                      my ( $name, $extends, $implements) = @_;
                      print "\n public class $name";
                      if ($extends) {
                        print " extends " . $extends;
                      }
                      if ($implements) {
                        print " implements " . $implements;
                      }
                      print " { \n";
                    }
                    #
                    # This routine declares the main function in a Java script
                    #
                    sub closeMain{
                      print "} \n";
                    }
                    #
                    # This subroutine creates the header for the file.
                    #
                    sub new {
                      my $this = {};
                      print "\n /* \n ** Created by Cocoa.pm \n ** Use at own risk \n */ \n";
                      bless $this;
                      return $this;
                    }

                    1;
                        ?????????д???????Perl?????????????????????????????Java applet??????????????
                    #!/usr/bin/perl
                    use Cocoa;
                    $cup = new Cocoa;
                    $cup->setImports( 'java.io.InputStream', 'java.net.*');
                    $cup->declareMain( "Msg" , "java.applet.Applet", "Runnable");
                    $cup->closeMain();
                        ??ν???????????????Msg??Java applet???????(extend)??java.applet.AppletС??ó???????????(runnable)??????????????????д?????£?
                    Cocoa::setImports($cup, 'java.io.InputStream', 'java.net.*');
                    Cocoa::declareMain($cup, "Msg" , "java.applet.Applet", "Runnable");
                    Cocoa::closeMain($cup);
                        ?????н?????£?
                    /*
                    ** Created by Cocoa.pm
                    ** Use at own risk
                    */
                    import java.io.InputStream;
                    import java.net.*;

                    public class Msg extends java.applet.Applet implements Runnable {
                    }
                        ????????->?????????÷???????м???????????????????????????????磺$cup->setImports( 'java.io.InputStream', 'java.net.*');???e??????磺Cocoa::setImports($cup, 'java.io.InputStream', 'java.net.*');??????????д???Cocoa::setImports $cup, 'java.io.InputStream', 'java.net.*' ;
                    ???????
                        ????????????????????????????????????????????????????????Espresso??Qava???????????grind????????::????????????Qava???????
                        $mess = Qava::grind("whole","lotta","bags");
                        Qava::grind($mess, "whole","lotta","bags");
                        ???????????????????????????????????????????????÷??????????????????
                        $method = $local ? "Qava::" : "Espresso::";
                        $cup->{$method}grind(@args);
                    ???????????
                        Perl????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????д??????????
                        ??????????????????????????????????DESTROY()??????DESTROY()?????????????????????????Щ?????????DESTROY()?????????????????DESTROY()??????Perl???????????????????????????????????bless??DESTROY()??????????????????DESTROY()???????????????????????????????ж???????????????????
                        ?????????????????DESTROY()??????????????????????£?
                    sub DESTROY {
                    #
                    # Add code here.
                    #
                    }
                        ???????????Perl???????????????????????????????κζ??????????????????????????????????????????????????Perl???????????????????????????????????????е???б????????????UNIX??????У???????????????????????????????????????????
                    ??????
                        ???????@ISA?????У????????б???????趨????????????????Bean.pm??Coffee.pm??????Coffee.pm???Bean.pm???Щ??????????????δ?????????????????????????????????????????????????????????????????С?
                        Bean.pm???????£?
                    package Bean;
                    require Exporter;
                    @ISA = qw(Exporter);
                    @EXPORT = qw(setBeanType);

                    sub new {
                      my $type = shift;
                      my $this = {};
                      $this->{'Bean'} = 'Colombian';
                      bless $this, $type;
                      return $this;
                    }

                    #
                    # This subroutine sets the class name
                    sub setBeanType{
                      my ($class, $name) = @_;
                      $class->{'Bean'} = $name;
                      print "Set bean to $name \n";
                    }
                    1;
                        ?????У???$this???????????????????????'Bean'???????'Colombian'??????setBeanType()??????'Bean'??????????$class???????????????????
                        Coffee.pm???????£?
                    1  #
                    2  # The Coffee.pm file to illustrate inheritance.
                    3  #
                    4  package Coffee;
                    5  require Exporter;
                    6  require Bean;
                    7  @ISA = qw(Exporter, Bean);
                    8  @EXPORT = qw(setImports, declareMain, closeMain);
                    9  #
                    10 # set item
                    11 #
                    12 sub setCoffeeType{
                    13   my ($class,$name) = @_;
                    14   $class->{'Coffee'} = $name;
                    15   print "Set coffee type to $name \n";
                    16   }
                    17 #
                    18 # constructor
                    19 #
                    20 sub new {
                    21   my $type = shift;
                    22   my $this = Bean->new(); ##### <- LOOK HERE!!! ####
                    23   $this->{'Coffee'} = 'Instant'; # unless told otherwise
                    24   bless $this, $type;
                    25   return $this;
                    26   }
                    27 1;
                        ??6?е?require Bean;????????Bean.pm?????????????????????setCoffeeType()???????t??????$class->{'Coffee'}????????????new()?У?$this???Bean.pm????????????????????????????????????????????????????????????????????Bean.pm??????????????????????????е??????
                        my $this = {}; #????
                        my $this = $theSuperClass->new(); #???
                        ????????????ε??ü?е??????
                    1  #!/usr/bin/perl
                    2  push (@INC,'pwd');
                    3  use Coffee;
                    4  $cup = new Coffee;
                    5  print "\n -------------------- Initial values ------------ \n";
                    6  print "Coffee: $cup->{'Coffee'} \n";
                    7  print "Bean: $cup->{'Bean'} \n";
                    8  print "\n -------------------- Change Bean Type ---------- \n";
                    9  $cup->setBeanType('Mixed');
                    10 print "Bean Type is now $cup->{'Bean'} \n";
                    11 print "\n ------------------ Change Coffee Type ---------- \n";
                    12 $cup->setCoffeeType('Instant');
                    13 print "Type of coffee: $cup->{'Coffee'} \n";
                        ??????????????£?
                    -------------------- Initial values ------------
                    Coffee: Instant
                    Bean: Colombian
                    -------------------- Change Bean Type ----------
                    Set bean to Mixed
                    Bean Type is now Mixed
                    ------------------ Change Coffee Type ----------
                    Set coffee type to Instant
                    Type of coffee: Instant
                        ?????????У?????????????????????????'Bean'??'Coffee'????????????????????????????????
                        ?????????ж??????????????Coffee.pm??????????makeCup()?????????£?
                    sub makeCup {
                      my ($class, $cream, $sugar, $dope) = @_;
                      print "\n================================== \n";
                      print "Making a cup \n";
                      print "Add cream \n" if ($cream);
                      print "Add $sugar sugar cubes\n" if ($sugar);
                      print "Making some really addictive coffee ;-) \n" if ($dope);
                      print "================================== \n";
                    }
                        ?????????????????????????????????????????????????磺
                    1  #!/usr/bin/perl
                    2  push (@INC,'pwd');
                    3  use Coffee;
                    4  $cup = new Coffee;
                    5  #
                    6  # With no parameters
                    7  #
                    8  print "\n Calling with no parameters: \n";
                    9  $cup->makeCup;
                    10 #
                    11 # With one parameter
                    12 #
                    13 print "\n Calling with one parameter: \n";
                    14 $cup->makeCup('1');
                    15 #
                    16 # With two parameters
                    17 #
                    18 print "\n Calling with two parameters: \n";
                    19 $cup->makeCup(1,'2');
                    20 #
                    21 # With all three parameters
                    22 #
                    23 print "\n Calling with three parameters: \n";
                    24 $cup->makeCup('1',3,'1');
                        ??????????£?
                    Calling with no parameters:
                    ==================================
                    Making a cup
                    ==================================
                    Calling with one parameter:
                    ==================================
                    Making a cup
                    Add cream
                    ==================================
                    Calling with two parameters:
                    ==================================
                    Making a cup
                    Add cream
                    Add 2 sugar cubes
                    ==================================
                    Calling with three parameters:
                    ==================================
                    Making a cup
                    Add cream
                    Add 3 sugar cubes
                    Making some really addictive coffee ;-)
                    ==================================
                        ??????У?????makeCup()????????????????????????????????????????????????????????????????????????????????У???????????????????????????????????????????費??????
                    ????????????????
                        ??е?????????????????????????????????????????????????????????????????????????Bean.pm???м?????printType()?????????£?
                    sub printType {
                      my $class = shift @_;
                      print "The type of Bean is $class->{'Bean'} \n";
                    }
                        ????????@EXPORT???????????
                        @EXPORT = qw ( setBeanType , printType );
                        ?????????ú???printType()??????????÷?????
                    $cup->Coffee::printType();
                    $cup->printType();
                    $cup->Bean::printType();
                        ?????????£?
                    The type of Bean is Mixed
                    The type of Bean is Mixed
                    The type of Bean is Mixed
                        ????????????????????????ж??庯??printType()????????????????????е?????????????????????????printType()????????????Coffee.pm???м?????壺
                    #
                    # This routine prints the type of $class->{'Coffee'}
                    #
                    sub printType {
                      my $class = shift @_;
                      print "The type of Coffee is $class->{'Coffee'} \n";
                    }
                        ????????@EXPORT???飺
                        @EXPORT = qw(setImports, declareMain, closeMain, printType);
                        ????????????????
                    The type of Coffee is Instant
                    The type of Coffee is Instant
                    The type of Bean is Mixed
                        ??????е???????Bean::???????????????????????????????????
                        ?????????????????????ε????????????????????α??????SUPER::????????????????磺$this->SUPER::function(...argument list...); ????????@ISA?б????????????????SUPER::?滻Bean::????д?$cup->SUPER::printType(); ?????????????????
                    The type of Bean is Mixed
                    ?????Perl????????Щ???
                        OOP?????????????????á?OOP???????????????Щ????????Perl???????????my?????????????????????Perl????????????????????????????????????????????????????????????????????????????????????????????
                    ???
                    1??????????????????????????
                    2????????????????????????????
                        ????д????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????local()?????壬??????????????????????????????????????????????????????????????????????????μ?????????????????????????????????????????????????????????
                        ????????????·?????????????
                        use coffee::Bean;
                        ???????????????@INC????????????Coffee?????????Bean.pm?????????Bean.pm???./Coffee???????????????????use????????????????????????????????????????磬????????
                        use Another::Sub::Menu;
                        ??ζ??????????????
                        ./Another/Sub/Menu.pm

                    ????? ????? ??


                    paper | appdir | ssv

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频