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
EVIL Gibson
Mar 23, 2001

Internet of Things is just someone else's computer that people can't help attaching cameras and door locks to!
:vapes:
Switchblade Switcharoo

SpeedFrog posted:

http://returnvalues.useperl.at/

42 seems to be another commonly used one.

Really, any number not 0 is true.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
Aside, the string "0 but true" does what it says, and doesn't throw a warning when you use it as a number.


$ perl -we "0+'0 foo'"
Argument "0 foo" isn't numeric in addition (+) at -e line 1.
$ perl -we "0+'0 but true'"
$

EVIL Gibson
Mar 23, 2001

Internet of Things is just someone else's computer that people can't help attaching cameras and door locks to!
:vapes:
Switchblade Switcharoo

tef posted:

Aside, the string "0 but true" does what it says, and doesn't throw a warning when you use it as a number.


$ perl -we "0+'0 foo'"
Argument "0 foo" isn't numeric in addition (+) at -e line 1.
$ perl -we "0+'0 but true'"
$


Any string would be true except for "" and "0"

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

EVIR Gibson posted:

Any string would be true except for "" and "0"

Yes, but not every string can be used as a numerical zero without throwing a warning. That's what makes "0 but true" magic.

Slightly irritatingly, you still get a warning from constructs like "1 but true" in a numeric context, so if you want a function that returns either false or a number which may or may not be zero, you have to jump through an extra hoop. Arguably, this may just be a crazy thing to want, but I've had it come up when trying to add features in the least painful way to old code.

tef
May 30, 2004

-> some l-system crap ->
You can also use "0e0" as a true value without raising warnings.

EVIL Gibson
Mar 23, 2001

Internet of Things is just someone else's computer that people can't help attaching cameras and door locks to!
:vapes:
Switchblade Switcharoo
What does the following mean. I knew it had to do something with a key->value or perhaps a method but the second line I am not getting.

code:
$a->b;
$->{b};
sorry I meant,

code:
$a->{b};

EVIL Gibson fucked around with this message at 04:37 on Nov 21, 2008

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
There's probably a syntax error on the second line. The first one means look up method "b" off of the object $a (etc regarding Perl's oop implementation). The second one written as $a->{b} means look up the value of key "b" in the hash that is referenced by $a (barring any discussion on bareword interpretation).

heeen
May 14, 2005

CAT NEVER STOPS
code:
my %foo; #hash
$foo{name}="the dude";
my $ref=\%foo; #get a reference ("pointer") to %foo
print $ref->{name}; #the dude

my %bar;
$bar{name}="the girl";
$foo{girlfriend}=\%bar;

print $ref->{girlfriend}->{name}; #the girl
print $ref->{girlfriend}{name}; #only first arrow required

fansipans
Nov 20, 2005

Internets. Serious Business.

EVIR Gibson posted:

What does the following mean. I knew it had to do something with a key->value or perhaps a method but the second line I am not getting.
code:
$a->b;
$a->{b};

The first one is a method call on a blessed object. The method called is "b", and the package this looked up under is the package that the object $a was blessed with. See the Method Invocation section of perlobj.

The second one is accessing the key "b" from the hash reference $a.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
code:
my $a;
say scalar @item_offsets;

timethese( 5000000, {
        'scalar' => sub {
            $a = @item_offsets-1;
        },
        'subscript' => sub {
            $a = $#item_offsets;
        },
    }
);

__END__

39139
Benchmark: timing 5000000 iterations of scalar, subscript...
    scalar: 0.592491 wallclock secs ( 0.58 usr +  0.00 sys =  0.58 CPU) @ 8650519.03/s (n=5000000)
 subscript: 1.14776  wallclock secs ( 1.14 usr +  0.00 sys =  1.14 CPU) @ 4382120.95/s (n=5000000)
Huh. I would've thought it was the other way around. Anyone got any idea why this is as it is or whether i overlooked something?

(And in case anyone's wondering why i'm benchmarking this: This operation occurs 120000+ times in a loop that i'd optimally would like to crunch into 0.1 seconds.)

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
I bet it's because Perl has to keep track of the value of $[, which controls the first index of an array. Then again, the perlvar doc says $[ has a compile-time effect. I'd still bet on it though.

$#array is defined as the index of the last element of array @array, so must respect $[. scalar @array is defined as the number of elements in @array and can ignore $[.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
Never knew about that. Your explanation makes sense though, as perldoc only says it's *treated* as compile-time in respect to whether it affects other files or not.

NeoHentaiMaster
Jul 13, 2004
More well adjusted then you'd think.
I want to state right off the bat that I'm not that experienced at perl scripting and I am sorry if I'm missing something obvious or trying to something that is actually dumb.

So I'm writing a setuid script in perl that has input piped to it from another script. It needs to be setuid because the script that is piping input to it is going to be called by a variety of users. The setuid script then writes to log file that I don't want to be writable by everyone calling the first script. Since its setuid security and validation is a big concern. I've already got some pretty good regex to validate the content of the input, but I was wondering if I could take it a step further and validate the source of <STDIN>. Is there a way for a perl script to see whats piping input to it? Basically I want it to work so only a specific script is allowed to pipe input to the setuid script. Is this even possible?

Erasmus Darwin
Mar 6, 2001

NeoHentaiMaster posted:

Is there a way for a perl script to see whats piping input to it?

If it's Linux, there's always searching /proc. /proc/$PID/fd/0 will be linked to a pipe -- use readlink to get the value. Find the other fd linked to that pipe in /proc, and you know what's feeding you input. There might be an easier and more portable way to do that, but I wouldn't know where to begin looking.

You can also change it so the first thing sent by the calling script is a password of sorts. In order to pull that off, you'd need to make the calling script setuid, as well. For security, I'd recommend having the calling script disable core dumps, read the password out of a file readable only by the user it's setuid as, and then drop privileges. For disabling core dumps, you can use the BSD::Resource module or a wrapper for your script.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Erasmus Darwin posted:

If it's Linux, there's always searching /proc. /proc/$PID/fd/0 will be linked to a pipe -- use readlink to get the value. Find the other fd linked to that pipe in /proc, and you know what's feeding you input.

Well, then you know the PID of what's feeding you input. Verifying the code that's feeding you input is significantly harder. Note that the process could be a completely legitimate program and memory space, but being straced by the user and fed malicious instructions to execute one-at-a-time, for example.

Erasmus Darwin posted:

You can also change it so the first thing sent by the calling script is a password of sorts. In order to pull that off, you'd need to make the calling script setuid, as well.

Making the calling script setuid/setgid is the correct thing to do, but at that point simple permissions can be used to ensure that only it can access your backend. The way this would normally be setup is to have the logger program setuid root:loggergroup and only executeable by the loggergroup group, and the calling programs setgid root:loggergroup. That way the calling programs don't wind up running as root, and users can't interfere because permissions don't let them.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Jeez, you guys try way too hard. I was going to post "barring any crazy workarounds, no, there's no easy or built-in way to determine where STDIN is coming from". But lo and behold, here are the technical workarounds.

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
For those of you going to Frozen Perl (Triple Tech, you are, right?), I'm going to be giving two talks. My Devel::REPL/Carp::REPL talk was accepted, and now I'm also giving the Intro to Moose talk.

It's going to be held in Minneapolis on Saturday, February 7th. If anything on the schedule piques your interest, come by and learn something!

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Thanks for the reminder. I'm scheduling YAPC NA and Frozen Perl on my calendar and I'll talk to my boss about it tomorrow.

And I can't believe that dumb gently caress Steven Lembark is presenting. He unironically revels in being an awkward gently caress. He can't stay at one job because he's a terrible employee and his Perl sucks. I hope someone kills you with your Model M you goony waste of life.

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
Lembark may be a dork but his Signal::StackTrace is handy. :shobon:

edit: I use it to find where my code is infinitely looping. A life saver every couple of months.

Filburt Shellbach fucked around with this message at 04:44 on Nov 25, 2008

ashgromnies
Jun 19, 2004
So I am backticking a command and it isn't working. It doesn't die or return a null value, it just hangs and waits for a response - incredibly messed, especially since I can run the exact same command from the command line and it works.

The method with the backticked command lives inside of a package. I recently moved the package from being in the .pl file my script utilizing the package is in into its own .pm file because it got large and I had other packages.

The backticked command worked before, I'm not sure why it wouldn't now. It works if I copy and paste it to the command line and I'm really confused.

Here's the offensive method(pardon the copious ugly logging, it's for debugging right now):
code:
sub _get_revision_info {
    my ($self) = @_;
    
    $self->{debug} && $self->log_activity("getting revision info");
    $self->{debug} && $self->log_activity("$self->{svn} info --non-interactive $self->{checkout_path}");
    [b]my $current_rev_info = `$self->{svn} info --non-interactive $self->{checkout_path}`;[/b]
    $self->{debug} && $self->log_activity($current_rev_info);
    $self->{debug} && $self->log_activity("$self->{svn} info --non-interactive $self->{source}");
    [b]my $remote_svn_info = `$self->{svn} info --non-interactive $self->{source}`;[/b]
    $self->{debug} && $self->log_activity($remote_svn_info);
    
    $current_rev_info =~ m/Revision: ([0-9]*)/;
    $self->{current_rev} = $1;
    
    $remote_svn_info =~ m/Last Changed Rev: ([0-9]*)/;
    $self->{latest_rev} = $1;
    
    $remote_svn_info =~ m/Revision: ([0-9]*)/;
    $self->{newest_rev} = $1;
    
    $self->{debug} && $self->log_activity("current_rev: $self->{current_rev}\nlatest_rev: $self->{latest_rev}\nnewest_rev: $self->{newest_rev}");
}   
Results in:

code:
[2008-11-25 17:35:25-0500] getting revision info
[2008-11-25 17:35:25-0500] /usr/bin/svn info --non-interactive /Users/me/blabla/rolldest
[2008-11-25 17:35:25-0500] Path: /Users/me/blabla/rolldest
URL: [url]https://mysvn.com/svn/some/path[/url]
Repository Root: [url]https://mysvn.com/svn/some[/url]
Repository UUID: 73252f4f-e7c9-4a5b-831e-b5ca1aed9ccc
Revision: 229
Node Kind: directory
Schedule: normal
Last Changed Author: me
Last Changed Rev: 229
Last Changed Date: 2008-11-19 14:49:46 -0500 (Wed, 19 Nov 2008)


[2008-11-25 17:35:25-0500] /usr/bin/svn info --non-interactive [url]https://mysvn.com/svn/some/path[/url]
and then it hangs.

If I execute that `/usr/bin/svn info --non-interactive https://mysvn.com/svn/some/path` on the command line, I get my expected output:

code:
Path: rc
URL: [url]https://mysvn.com/svn/some/path[/url]
Repository Root: [url]https://mysvn.com/svn/some[/url]
Repository UUID: 73252f4f-e7c9-4a5b-831e-b5ca1aed9ccc
Revision: 229
Node Kind: directory
Last Changed Author: me
Last Changed Rev: 229
Last Changed Date: 2008-11-19 14:49:46 -0500 (Wed, 19 Nov 2008)

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
This probably isn't related (but it couldn't hurt), try putting your debug flag into the log activity subroutine. Also, stick to simple scalars ($just $like $this) for interpolation. And then try again.

ashgromnies
Jun 19, 2004

Triple Tech posted:

This probably isn't related (but it couldn't hurt), try putting your debug flag into the log activity subroutine. Also, stick to simple scalars ($just $like $this) for interpolation. And then try again.

Nah, I have logs that should always occur regardless of if I'm in debug mode or not. A $self->log_debug method or similar would be appropriate, though. I'm pretty sure it's not the interpolation of the scalars because the first backticked command runs fine and I get its output in my log.

edit: this what you mean?(logging truncated)

code:
sub _get_revision_info {
    my ($self) = @_;
    
    my $svn = $self->{svn};
    my $checkout_path = $self->{checkout_path};
    my $source = $self->{source};

    my $current_rev_info = `$svn info --non-interactive $checkout_path`;
    my $remote_svn_info = `$svn info --non-interactive $source`;
    
    $current_rev_info =~ m/Revision: ([0-9]*)/;
    $self->{current_rev} = $1;
    
    $remote_svn_info =~ m/Last Changed Rev: ([0-9]*)/;
    $self->{latest_rev} = $1;
    
    $remote_svn_info =~ m/Revision: ([0-9]*)/;
    $self->{newest_rev} = $1;
}   
hung on the second backticked expression as well :(

ashgromnies fucked around with this message at 00:05 on Nov 26, 2008

s139252
Jan 1, 1970
test

ashgromnies posted:

Nah, I have logs that should always occur regardless of if I'm in debug mode or not. A $self->log_debug method or similar would be appropriate, though. I'm pretty sure it's not the interpolation of the scalars because the first backticked command runs fine and I get its output in my log.

edit: this what you mean?(logging truncated)

code:
sub _get_revision_info {
    my ($self) = @_;
    
    my $svn = $self->{svn};
    my $checkout_path = $self->{checkout_path};
    my $source = $self->{source};

    my $current_rev_info = `$svn info --non-interactive $checkout_path`;
    my $remote_svn_info = `$svn info --non-interactive $source`;
    
    $current_rev_info =~ m/Revision: ([0-9]*)/;
    $self->{current_rev} = $1;
    
    $remote_svn_info =~ m/Last Changed Rev: ([0-9]*)/;
    $self->{latest_rev} = $1;
    
    $remote_svn_info =~ m/Revision: ([0-9]*)/;
    $self->{newest_rev} = $1;
}   
hung on the second backticked expression as well :(

What is the value of $svn and $checkout_path? Check that the user perl is running as can resolve and execute the command. If svn is really hanging, try attaching strace to the pid and see what is holding it up.

Also, there are many subversion-related CPAN modules available. ;)

Voltaire
Sep 20, 2003
The lunatic is in my head...
how do i get my program not to process -1 in my sort lists (ex. it always says -1 is the smallest number when -1 is the escape number) and print "No numbers to process if -1 is entered as the first entry only and not go through the sort lists?

code:
print "Please enter a number, -1 to end:";
chomp ($n = <>);
push @numbers, $n;

if ($n eq -1)
{
        print "No numbers to process\.n";
}

until ($n ne -1)
{
        print "Please enter a number, -1 to end:";
        chomp ($n = <>);
        push @numbers, $n;
}

$" = " , ";

print "Here are the numbers you entered:
        @numbers\n ";

my @sorted_numbers = sort {$a <=> $b} @numbers;
print "Here are the numbers you entered, sorted in ascending order:
                @sorted_numbers\n";

@sorted_numbers = sort {$b<=> $a} @numbers;
print "Here are the numbers you entered, sorted in descending order:
                @sorted_numbers\n";

my ($low,$high) = (sort{$a <=> $b} @numbers)[0,-1];
print "Largest and smallest values are: $high : $low\n";


Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
Double negatives kick rear end

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
:sigh: Consider a do while to avoid code duplication. Also, better whitespacing.

Voltaire
Sep 20, 2003
The lunatic is in my head...

Triple Tech posted:

:sigh: Consider a do while to avoid code duplication. Also, better whitespacing.

code:
use warnings;
use strict;
use diagnostics;
my (@numbers, $n, $max, $min);
shift @numbers;

print "Please enter a number, -1 to end:";
chomp ($n = <>);
push @numbers, $n;

do{

print "Please enter a number, -1 to end:";
        chomp ($n = <>);
        push @numbers, $n;


} while ($n >=0);
{

$" = " , ";

print "Here are the numbers you entered:
        @numbers\n ";

my @sorted_numbers = sort {$a <=> $b} @numbers;
print "Here are the numbers you entered, sorted in ascending order:
                @sorted_numbers\n";

@sorted_numbers = sort {$b<=> $a} @numbers;
print "Here are the numbers you entered, sorted in descending order:
                @sorted_numbers\n";

my ($low,$high) = (sort{$a <=> $b} @numbers)[0,-1];
print "Largest and smallest values are: $high : $low\n";
}
it still processes the -1

Voltaire fucked around with this message at 04:56 on Nov 26, 2008

s139252
Jan 1, 1970
test

Voltaire posted:

how do i get my program not to process -1 in my sort lists (ex. it always says -1 is the smallest number when -1 is the escape number) and print "No numbers to process if -1 is entered as the first entry only and not go through the sort lists?

code:
print "Please enter a number, -1 to end:";
chomp ($n = <>);
push @numbers, $n;

if ($n eq -1)
{
        print "No numbers to process\.n";
}

until ($n ne -1)
{
        print "Please enter a number, -1 to end:";
        chomp ($n = <>);
        push @numbers, $n;
}

$" = " , ";

print "Here are the numbers you entered:
        @numbers\n ";

my @sorted_numbers = sort {$a <=> $b} @numbers;
print "Here are the numbers you entered, sorted in ascending order:
                @sorted_numbers\n";

@sorted_numbers = sort {$b<=> $a} @numbers;
print "Here are the numbers you entered, sorted in descending order:
                @sorted_numbers\n";

my ($low,$high) = (sort{$a <=> $b} @numbers)[0,-1];
print "Largest and smallest values are: $high : $low\n";



code:
print "Please enter a number, -1 to end: ";
my @numbers;

while(<>) {
  chomp;
  last unless $_ >= 0;
  push @numbers, $_;
}

# etc...

Voltaire
Sep 20, 2003
The lunatic is in my head...

satest4 posted:

code:
print "Please enter a number, -1 to end: ";
my @numbers;

while(<>) {
  chomp;
  last unless $_ >= 0;
  push @numbers, $_;
}

# etc...

i got that to work sweet. now if the first entry is -1, the output should be No numbers to process. where should i insert this if statement?

code:
use warnings;
use strict;
use diagnostics;
my (@numbers, $n, $max, $min);

print "Please enter a number, -1 to end:";
chomp ($n = <>);
push @numbers, $n;


while ($n >= 0)
{
print "Please enter a number, -1 to end:";
        chomp ($n = <>);
        last unless $n >=0;
        push @numbers, $n;
}

$" = " , ";

print "Here are the numbers you entered:
        @numbers\n ";

my@sorted_numbers = sort {$a <=> $b} @numbers;
print "Here are the numbers you entered, sorted in ascending order:
                @sorted_numbers\n";

@sorted_numbers = sort {$b<=> $a} @numbers;
print "Here are the numbers you entered, sorted in descending order:
                @sorted_numbers\n";

my ($low,$high) = (sort{$a <=> $b} @numbers)[0,-1];
print "Largest and smallest values are: $high : $low\n";

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
Are you loving kidding me?

Go take a programming course, go read a book, anything.

You're wasting our time with retard questions.

ashgromnies
Jun 19, 2004

satest4 posted:

What is the value of $svn and $checkout_path? Check that the user perl is running as can resolve and execute the command. If svn is really hanging, try attaching strace to the pid and see what is holding it up.

Also, there are many subversion-related CPAN modules available. ;)

I printed the log above that shows that the backticked commands it tried executing were correct. I am running the script as the same user as I ran them from the command line with.

code:
[2008-11-25 17:35:25-0500] /usr/bin/svn info --non-interactive /Users/me/blabla/rolldest
[2008-11-25 17:35:25-0500] Path: /Users/me/blabla/rolldest 
URL: [url]https://mysvn.com/svn/some/path[/url] 
Repository Root: [url]https://mysvn.com/svn/some[/url] 
Repository UUID: 73252f4f-e7c9-4a5b-831e-b5ca1aed9ccc 
Revision: 229 
Node Kind: directory 
Schedule: normal 
Last Changed Author: me 
Last Changed Rev: 229 
Last Changed Date: 2008-11-19 14:49:46 -0500 (Wed, 19 Nov 2008)
[2008-11-25 17:35:25-0500] /usr/bin/svn info --non-interactive [url]https://mysvn.com/svn/some/path[/url]
Those are the results of the last three log_activity calls that you see and is how I found it's hanging on `/usr/bin/svn info --non-interactive https://mysvn.com/svn/some/path` which should work - if I run that on the command line as the same user, it works just fine and the first backticked expression works and gets the expected output... very confusing.

We have SVN::Client, I was recommended not to use it but I haven't looked into it. Is there anything you've used?

I don't have strace on my Mac, I'll try running this on Linux tomorrow.

ashgromnies fucked around with this message at 05:51 on Nov 26, 2008

Voltaire
Sep 20, 2003
The lunatic is in my head...

Sartak posted:

Are you loving kidding me?

Go take a programming course, go read a book, anything.

You're wasting our time with retard questions.

code:
use warnings;
use strict;
my (@numbers, $n, $max, $min);

print "Please enter a number, -1 to end:";
chomp ($n = <>);
push @numbers, $n;
if ($n == -1)
{
        print "No numbers to process\n.";
}

else
{
while ($n >= 0)
{
print "Please enter a number, -1 to end:";
        chomp ($n = <>);
        last unless $n >=0;
        push @numbers, $n;
}

$" = " , ";

print "Here are the numbers you entered:
        @numbers\n ";

my@sorted_numbers = sort {$a <=> $b} @numbers;

print "Here are the numbers you entered, sorted in ascending order:
                @sorted_numbers\n";

@sorted_numbers = sort {$b<=> $a} @numbers;

print "Here are the numbers you entered, sorted in descending order:
                @sorted_numbers\n";

my ($low,$high) = (sort{$a <=> $b} @numbers)[0,-1];

print "Largest and smallest values are: $high : $low\n";

}

thanks for the input sartak, pun intended. i figured it out

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
I hope you get the job buddy :waycool:

Voltaire
Sep 20, 2003
The lunatic is in my head...

Sartak posted:

I hope you get the job buddy :waycool:

I already got the job buddy! :rock:

These are just practice exercises i'm going through

Voltaire fucked around with this message at 05:58 on Nov 26, 2008

Beardless Woman
May 5, 2004

M for Mysterious

Voltaire posted:

I already got the job buddy! :rock:

These are just practice exercises i'm going through

I haven't tested this but it should work and looks more like perl.

code:
#!/usr/bin/perl

use strict;
use warnings;

my @numbers;

print "Please enter a number, -1 to end: ";

while (<STDIN>) {
    chomp;
    last if ($_ == -1);
    push @numbers, $_;
}

unless (scalar @numbers) {
    print "Hope you get fired!\n";
    exit;
}

print "Here are the numbers you entered: " . join(", ", @numbers) . "\n";

@numbers = sort @numbers;

print "Ascending: " . join(", ", @numbers) . "\n";
print "Descending: " . join(", ", reverse @numbers) . "\n";
print "Smallest and Largest: " . $numbers[0] . ", " . $numbers[-1] . "\n";
Stupid [ code ] is putting spaces where there aren't any.

Beardless Woman fucked around with this message at 06:36 on Nov 26, 2008

s139252
Jan 1, 1970
test

ashgromnies posted:

We have SVN::Client, I was recommended not to use it but I haven't looked into it. Is there anything you've used?

When we used subversion, we'd get information directly from the repo (ie, on the filesystem), because it proved more reliable than using a client (and I avoid CPAN like the plague despite me suggesting it to you :) ).

We switched to Git earlier this year. I like it a lot more than subversion.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Voltaire posted:

code:
:barf:

For the love of christ. If you have the gall to ask people on the internet to solve your homework which the company (what company is it anyhow?) which gave you a Perl job despite you quite obviously just plain now knowing perl, then at the loving least run your poo poo through perltidy before posting it. It hurts my eyes just to look at it. [ http://search.cpan.org/~shancock/Perl-Tidy-20071205/bin/perltidy ]

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
I'm glad you guys are taking a stand. Majority wins. Lrn2Perl.

ashgromnies
Jun 19, 2004

satest4 posted:

When we used subversion, we'd get information directly from the repo (ie, on the filesystem), because it proved more reliable than using a client (and I avoid CPAN like the plague despite me suggesting it to you :) ).

We switched to Git earlier this year. I like it a lot more than subversion.

Yeah, we use Mercurial for actual development, Subversion is used only as a backend for a specific deployment management application(what I'm working on). Once we feature-freeze a release, we import it into Subversion and then have the ability to use the deployment management software to put it on any of our servers/environments.


edit: hrm, ran it on Linux, same issue with the backtick exists, strace reveals a bunch of spam saying this:

code:
stat("//someconfig.yml", 0x9659140)         = -1 ENOENT (No such file or directory)
stat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
Hrm. Not sure why it would be trying to stat that file.


editx2: So I'm pretty sure it has nothing to do with the backticked expression, it looks like an issue because I wasn't disabling buffering on my logfile so I thought it was halting somewhere that it wasn't... oops.

ashgromnies fucked around with this message at 17:36 on Nov 26, 2008

Adbot
ADBOT LOVES YOU

NeoHentaiMaster
Jul 13, 2004
More well adjusted then you'd think.
Got another noob question. Once again I'm sorry if what I'm trying to do is just too advanced/complicated or not possible.

Basically the situation is this. I have program1, script 1 and script 2. Program one calls script 1 and script 1 has the following code:

open (HANDLE, "| /bin/script2");
print HANDLE stuff;
close (HANDLE);

Now, script2 takes the piped input and compares it to data in another log file to generate its output. The problem is that the log file data script2 needs is not available until script1 exits. Is there a way to make script1 just pipe information to script 2 and then continue on and exit while script2 continues to run? (basically have script2 wait for script 1 to exit so it can check the log file for new data) The way I have it now it seems script 1 always needs to wait for script 2 to exit before it exits.

Any help or hints on what I need to at least look into as far as Perl goes will be greatly appreciated.

  • Locked thread