Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
more falafel please
Feb 26, 2005

forums poster

Triple Tech posted:

Uhh, what? That sounds way too confusing.

The HTTP request would just be a touch and go on the server to start the process. Subsequent HTTP requests via Ajax would hit a process that's in charge of monitoring the status of the first, longer running process. And... that's it. There's no forking anywhere in this design.

Or, if you don't want to have to learn about Ajax, the first HTTP request can just kick it off and send you to a page that monitors the status of the job, with auto-refreshes every so often.

Adbot
ADBOT LOVES YOU

more falafel please
Feb 26, 2005

forums poster

Triple Tech posted:

I vaguely remember reading this in Perl Hacks or some such, but would it be good to focus on coding a type of Perl that didn't generate as many ops as say another method?

code:
my $a = "something";

# method 1, assignment
my $b = $a;

# method 2, stringify, assignment (more ops)
my $b = "$a";
Are less ops always faster than more?

Well, I wouldn't exactly call myself a Perl expert, but if the operations required to do A are a subset of the operations required to do B, then A is going to be faster. In this case, you have string scalar assignment versus string scalar interpolation (basically a strcpy()) and then string scalar assignment. Otherwise, it depends on the operations themselves.

In regards to the value of teaching one way or another... it depends. In your example I find method 2 to be less indicative of what's going on, so I certainly wouldn't suggest it. But just because one method isn't as fast as another doesn't mean you shouldn't use it -- unless it's causing you noticeable performance problems, I would stick with the way that makes your code the clearest. I've found this especially important in Perl, where it's easy to get yourself into the habit of writing executable line noise.

more falafel please
Feb 26, 2005

forums poster

Triple Tech posted:

I guess I could make up a couple reasons. Well, it's shorter. Perl people love their terse. It's ... traditional, sort of. Also, it's not really an assignment. I'm not saying that the auto flush concept is "incrementable" but it doesn't really support arbitrary assignment, so the equals sign may be implying too much. Whatever, they're both equally bad, but one is less bad than the other.

Edit: Reviewing some posts in Perl Monks, I see that both are written, one not any less right than the other. But I would put my money on the ++ version being used more.

I noticed this too, and my first thought was that, if any nonzero value of $| means autoflush, then maybe $|++ and $|-- are preferred to give stack semantics:
code:
$| = 1;
print_some_crap();
someone_elses_code();
print_some_crap();
$| = 0;

sub someone_elses_code
{
    $| = 1;
    print_some_crap();
    $| = 0;  # oh shi
}

more falafel please
Feb 26, 2005

forums poster

Sartak posted:

Nope. $| is deeply magical. $|++ is equivalent to $| = 1. $|-- is equivalent to $| = 1 - $|.

Ok, then I have no idea, other than terseness. What's the reasoning for that semantic?

more falafel please
Feb 26, 2005

forums poster

Triple Tech posted:

Oh good, good you can tell me about how Catalyst works then. When I access a URL of a website that's running on Catalyst, what is the server actually hitting? Do all the URLs get submitted as an argument to a dispatcher, or are there individual .cgi files laying around?

I'd like to move my company's site to a framework but I'm not sure how this fancy stuff works.

All I know about Catalyst is that I went to school with the author of this book and he's the crazy shut-in nerd type who's so much smarter than you or any of his professors that he doesn't need to do his work because it's below him, which is why going to school is dumb and they SHOULD just kick him out for failing all his classes.

more falafel please
Feb 26, 2005

forums poster

Cock Democracy posted:

Not quite sure what's going on here... after I make the initial connection, it looks like the printer is trying to open a new connection with me every second or so.

Maybe the printer isn't trying to use your socket, but instead connect back? This may require you to keep a listening socket open to accept connections from the printer after the command has been sent.

edit: ok, I'll be honest, I didn't actually look at the screenshot, so ignore that.

more falafel please fucked around with this message at 16:43 on May 20, 2008

more falafel please
Feb 26, 2005

forums poster

Ninja Rope posted:

Add use warnings; right before use strict; or you're fired. Out of a cannon. Into the sun.

I thought the generally accepted canon was
code:
#!/usr/bin/perl -w
use strict;
Or is use warnings; preferred now?

more falafel please
Feb 26, 2005

forums poster

SpeedFrog posted:

perl -w enables warnings globally, which you might not want. use warnings is lexical, and only affects the current file/sub/block.

Ah, good point.

Adbot
ADBOT LOVES YOU

more falafel please
Feb 26, 2005

forums poster

I've never been much of a Perl expert, but what's the philosophical reason behind Perl flattening lists?

  • Locked thread