Ignore:
Timestamp:
Mar 26, 2007, 9:04:54 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4c2ec6c
Parents:
18a99d2
git-author:
Nelson Elhage <nelhage@mit.edu> (03/26/07 21:04:37)
git-committer:
Nelson Elhage <nelhage@mit.edu> (03/26/07 21:04:54)
Message:
Getting rid of indirect object syntax new calls. Quoting perlobj:

> But what if there are no arguments? In that case, Perl must guess what
> you want. Even worse, it must make that guess *at compile time*. Usually
> Perl gets it right, but when it doesn't you get a function call compiled
> as a method, or vice versa. This can introduce subtle bugs that are hard
> to detect.
> 
> For example, a call to a method "new" in indirect notation -- as C++
> programmers are wont to make -- can be miscompiled into a subroutine
> call if there's already a "new" function in scope. You'd end up calling
> the current package's "new" as a subroutine, rather than the desired
> class's method. The compiler tries to cheat by remembering bareword
> "require"s, but the grief when it messes up just isn't worth the years
> of debugging it will take you to track down such subtle bugs.
    
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/Net/Jabber/Server.pm

    r0ff8d110 rcb54527  
    5454    use Net::Jabber qw(Server);
    5555
    56     $Server = new Net::Jabber::Server();
     56    $Server = Net::Jabber::Server->new();
    5757
    5858    $Server->Start();
     
    155155    bless($self, $proto);
    156156
    157     $self->{KEY} = new Net::Jabber::Key();
     157    $self->{KEY} = Net::Jabber::Key->new();
    158158
    159159    $self->{DEBUG} =
    160         new Net::Jabber::Debug(level=>exists($args{debuglevel}) ? $args{debuglevel} : -1,
    161                                file=>exists($args{debugfile}) ? $args{debugfile} : "stdout",
    162                                time=>exists($args{debugtime}) ? $args{debugtime} : 0,
    163                                setdefault=>1,
    164                                header=>"NJ::Server"
    165                               );
     160        Net::Jabber::Debug->new(level=>exists($args{debuglevel}) ? $args{debuglevel} : -1,
     161                                file=>exists($args{debugfile}) ? $args{debugfile} : "stdout",
     162                                time=>exists($args{debugtime}) ? $args{debugtime} : 0,
     163                                setdefault=>1,
     164                                header=>"NJ::Server"
     165                               );
    166166
    167167    $self->{SERVER} = { hostname => "localhost",
     
    329329    $self->{DEBUG}->Log2("dbresultHandler: dbresult(",$dbresult->GetXML(),")");
    330330
    331     my $dbverify = new Net::Jabber::Dialback::Verify();
     331    my $dbverify = Net::Jabber::Dialback::Verify->new();
    332332    $dbverify->SetVerify(to=>$dbresult->GetFrom(),
    333333                         from=>$dbresult->GetTo(),
Note: See TracChangeset for help on using the changeset viewer.