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
dagard
Mar 31, 2005

Kidane posted:

Stupid question...

Is there a way to print to stdout without updating the cursor? For example if I wanted to display a percentage done indicator, or even just a spinning | to show that the program is thinking, is there a way to do this? My intuition tells me that it's not but I figured I might as well ask (Google was no help).

This looks like what you want:
http://outflux.net/software/shorts/perl/Idle

Adbot
ADBOT LOVES YOU

dagard
Mar 31, 2005
I've honestly almost always just used Time::HiRes for things like that. Something like:
code:
use Time::HiRes qw(tv_interval gettimeofday);

my $start_time = [gettimeofday];
#
# things go here
#
my $end_time = [gettimeofday];
print "It took " . tv_interval($start_time, $end_time) . "\n";
will generally give me a decent amount of accuracy for how long (things) took.

dagard
Mar 31, 2005

syphon^2 posted:

I've got a stupid question...

From http://search.cpan.org/~jhi/Time-HiRes-1.9715/HiRes.pm
Uhhh, what are "floating seconds"? Ironically, a google search just refers you back to that Time::HiRes doc, which doesn't explain it. I'm able to tell that querying this server took my app "0.315718" floating seconds... but I have no idea how long that is in relevant time.

That just means it's .315718 seconds. The stock perl sleep and time functions are only accurate to the nearest second, so they're integers, whereas the functions in Time::HiRes use floats, since they can sleep < 1 second (or measure more accurately than 1 second).

dagard
Mar 31, 2005

syphon^2 posted:

Does anyone have any advice for making Perl talk to Active Directory?
(snip)
Any advice would be greatly appreciated.

It's been a while, but I seem to recall that, by default, you can't anonymously bind to the AD server, so you have to have a user even to do that. But otherwise, we use an AD server with a few unix hosts here (LDAP), and I know for a fact that TVA does too.

Edit: http://pastebin.com/m40d7df9c

Yes, it's ugly, but it's basically what I used when working with our AD administrators to make sure connectivity was working.

dagard fucked around with this message at 01:49 on Oct 13, 2008

dagard
Mar 31, 2005
I've been using Catalyst lately for an internal project (inventory tracking for my group of system administrators), and while I love it, I seem to be google-blind on one thing. Query caching.

Example: You're looking at an audit page, where you see the last 30 changes. Each row of the audit log is generating another hit against the 'users' table to pull out username, display name, email address, etc.

Ideally, I'd like something that, either in Catalyst or TT2, I can go 'ok, for this page, this render, cache everything'

Would I have to roll my own? (doable), or is there something I'm just too blind to see?

  • Locked thread