Page Index Toggle Pages: 1
There are no actions to perform.
Hot Topic (More than 10 Replies) Does anyone running this place know Perl? (Read 6,949 times)
The Dodger
YaBB Newcomer
*
Offline



Posts: 3

YaBB 2.5
Does anyone running this place know Perl?
Aug 28th, 2012 at 11:22pm
There are no actions to perform.
No, seriously.

I'm reading through the sourcecode.

So, like... do any of you know Perl?

Because I don't know what this crap is.
  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,866
Location: Earth

YaBB 2.6.1
Re: Does anyone running this place know Perl?
Reply #1 - Aug 28th, 2012 at 11:28pm
There are no actions to perform.
Yeah - some of us do write Perl pretty well - but you're also looking at 12+ years of legacy code that hasn't been updated unless it broke.
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
The Dodger
YaBB Newcomer
*
Offline



Posts: 3

YaBB 2.5
Re: Does anyone running this place know Perl?
Reply #2 - Aug 28th, 2012 at 11:48pm
There are no actions to perform.
You say:

sub undupe {
    @in  = @_;
    @out = ();
    foreach $check (@in) {
        $duped = 0;
        foreach $checkout (@out) {
            if ($checkout eq $check) { $duped = 1; }
        }
        if ($duped == 0) {
            push(@out, $check);
        }
    }
    return @out;
}

I say:

sub undupe {
    my $seen;
    return map {$seen->{$_} = 1; $_}
                    grep !$seen->{$_}
                           @_;
}
  
Back to top
 
IP Logged
 
The Dodger
YaBB Newcomer
*
Offline



Posts: 3

YaBB 2.5
Re: Does anyone running this place know Perl?
Reply #3 - Aug 28th, 2012 at 11:49pm
There are no actions to perform.
Even 12 years ago this should have used strict. That was 2000. MySQL was ubiquitous by then. This is like an Extropia script!
  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,866
Location: Earth

YaBB 2.6.1
Re: Does anyone running this place know Perl?
Reply #4 - Aug 29th, 2012 at 2:14am
There are no actions to perform.
Are you volunteering for code review for 2.6?
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
xnoddyx
Support Team
Documentation Team
YaBB Moderators
YaBB Next Team
Beta Testers
****
Offline



Posts: 1,596
Location: UK:Scotland/livingston

None
Re: Does anyone running this place know Perl?
Reply #5 - Aug 29th, 2012 at 11:13am
There are no actions to perform.
Dandello wrote on Aug 29th, 2012 at 2:14am:
Are you volunteering for code review for 2.6?

yer he / she can see here http://www.yabbforum.com/community/YaBB.pl?num=1284302958
Wink
  

YaBB install help video
1. what yabb forum are you running and the url
2. describe in as much detail as you can what happens and also post screenshots if you can
3. please be patient we live in different time zones and have other commitments but we will help you
as bill and ted say (Be excellent to each other)
Back to top
IP Logged
 
Zoo
YaBB Legends (Inactive)
*
Offline



Posts: 400

YaBB 2.1
Re: Does anyone running this place know Perl?
Reply #6 - Oct 1st, 2012 at 5:07pm
There are no actions to perform.
The Dodger wrote on Aug 28th, 2012 at 11:48pm:
Code
Select All
sub undupe {
 á ámy $seen;
 á áreturn map {$seen->{$_} = 1; $_}
 á áá áá áá áá áá á grep !$seen->{$_}
 á áá áá áá áá áá áá áá áá @_;
} 


I do not understand. This is known to work?


But all the same, because this is clean and fast:

Code
Select All
sub undupe {
    my %seen;
    grep { !$seen{$_}++ } @_
} 


Almost a FAQ.
  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,866
Location: Earth

YaBB 2.6.1
Re: Does anyone running this place know Perl?
Reply #7 - Oct 1st, 2012 at 7:43pm
There are no actions to perform.
Haven't tested either of them but I assume the first one works as it isn't part of a reported bug. The second one is a lot neater. (And neither would make PerlCritic happy. - no final return on the sub.)  Cheesy

The biggest issue with Perl - to some people - is that it really does allow lots of different ways to do the same thing - some of them neat and tidy, some of them not so neat and tidy. And which one is best for a particular need depends on the skill-level of the coder, testing, and benchmarking.

  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
malmklang2
Full Member
Language Team
***
Offline



Posts: 257
Location: Norway

None
Re: Does anyone running this place know Perl?
Reply #8 - Oct 2nd, 2012 at 1:16am
There are no actions to perform.
Must've been a new record of how to enter a forum in the most insulting way, that there. But yeah, takes all kinds to make the world go around.

And it sounded so bad at first too... like there wasn't a single decent line of perl code in the entire set of source files.... and all it boiled down to was a tiny little sub... Oh well!
« Last Edit: Oct 2nd, 2012 at 1:20am by malmklang2 »  

if ($human) {die("Sorry, you lot have destroyed too much already")}
Back to top
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,866
Location: Earth

YaBB 2.6.1
Re: Does anyone running this place know Perl?
Reply #9 - Oct 2nd, 2012 at 2:12am
There are no actions to perform.
Oh, I've had days I've felt the same way - scratching my head and saying to myself "What the frack were they smoking when they wrote this!#!@"

And I've had guys over at PerlMonks say it about some of my code. (I had one guy swear up and down that the absolutely only way to solve one particular problem was with mapping - and that was the first thing that went out the window on the refactoring.)

There are, admittedly, a lot of old-fashioned naming conventions inside the YaBB code and some code that can be refactored and optimized  (the language has evolved over the past 12 years) - but we've only had a couple of things actually break due to age.  Wink
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
malmklang2
Full Member
Language Team
***
Offline



Posts: 257
Location: Norway

None
Re: Does anyone running this place know Perl?
Reply #10 - Oct 2nd, 2012 at 8:17am
There are no actions to perform.
Yeah, I do get that, about code not being up to date everywhere, and code not looking, or being as perfect as it could be... I'm not a Perl expert at all, though I know enough to get by in most situations... áHowever, I am a moderator at a big Norwegian web development board, and if I yelled at every person coming to us with table based layouts and no clue as to why a certain element won't conform to his or her intentions, I'd be out-yelled ages ago, and, I would've scared so many good people away, that just needed a little advice, not yelling.. people that have stayed around and evolved way beyond and above my skills.
Sometimes RTFM or Google it, stupid, just isn't the way to handle certain things, just like entering a forum, where the people have developed a free software for 12 years, a great software, and widely used too, and look down at them through their noses isn't the way to point out that some things might need improvement.

As to your thoughts, as you described them, sure, I can relate to that too, about html and css and what not, but thoughts are thoughts, saying them out loud is a different thing altoghether Tongue

Perl monks, huh? Well, they sure do know their Perl, don't they, but sometimes, their social skills, well, there's a few lines of code missing there, or un-optimized at least, as there is with many experts in other fields of expertise. That's fine. But sometimes being too harsh can kill something that would've been great if only encouraged a little instead of yelled at, yelled at in a bad way, I mean... there's actually two types of yelling, a good way and a bad way, but that's for another day Tongue
« Last Edit: Oct 2nd, 2012 at 9:03am by malmklang2 »  

if ($human) {die("Sorry, you lot have destroyed too much already")}
Back to top
IP Logged
 
depablo
YaBB Moderators
YaBB Next Team
Beta Testers
***
Offline



Posts: 577
Location: UK

None
Re: Does anyone running this place know Perl?
Reply #11 - Oct 2nd, 2012 at 8:44am
There are no actions to perform.
Early pioneers in all walks of life should be shown respect, without their input and vision life as we know it would be very different.

That said people attempting to keep something their passionate about alive also deserve respect, I think we should all take a deep breath for the sake of the software.
  

Taking a peek behind the mask Wink
Back to top
 
IP Logged
 
malmklang2
Full Member
Language Team
***
Offline



Posts: 257
Location: Norway

None
Re: Does anyone running this place know Perl?
Reply #12 - Oct 2nd, 2012 at 8:54am
There are no actions to perform.
yeah, no I dind't mean certain parts as disrespectful as it came across, so, sorry about that.

Breathing's good, it's essential Wink
« Last Edit: Oct 2nd, 2012 at 8:55am by malmklang2 »  

if ($human) {die("Sorry, you lot have destroyed too much already")}
Back to top
IP Logged
 
depablo
YaBB Moderators
YaBB Next Team
Beta Testers
***
Offline



Posts: 577
Location: UK

None
Re: Does anyone running this place know Perl?
Reply #13 - Oct 2nd, 2012 at 10:32am
There are no actions to perform.
malmklang2 wrote on Oct 2nd, 2012 at 8:54am:
Breathing's good, it's essential Wink

That's why it's automatic 
Grin
  

Taking a peek behind the mask Wink
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,866
Location: Earth

YaBB 2.6.1
Re: Does anyone running this place know Perl?
Reply #14 - Oct 2nd, 2012 at 2:15pm
There are no actions to perform.
I have learned an awful lot about Perl from looking at the YaBB code, swearing under my breath and then figuring out what that piece of code is supposed to be doing. And there's some code that is just 'perfect' the way it is.

Twelve years and still going - that has to be a record.
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
There are no actions to perform.