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
Zombywuf
Mar 29, 2008

TiMBuS posted:

URL rewriting has nothing to do with separating 'run modes' into multiple files.

Troll elsewhere, I came here for advice from people who knew what they were talking about (thanks, genericadmin). I didn't post here to get replies I could have just gotten from 7chan.

FFS, who pissed in your cornflakes?

You seemed to be asking how to get a restfull interface out of a single cgi app without throwing files all over the place, if that's not what you were after then I was answering the wrong question.

However if it were, url rewriting would be one way to do it.

The wrong way.

Allow me to quote from the mod_rewrite docs

mod_rewrite docs posted:

The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.''
-- Brian Behlendorf

I hope this puts things into perspective.

Adbot
ADBOT LOVES YOU

TiMBuS
Sep 25, 2007

LOL WUT?

Zombywuf posted:

FFS, who pissed in your cornflakes?

You seemed to be asking how to get a restfull interface out of a single cgi app without throwing files all over the place
Yes, and you suggested a framework that I tried and threw away, for perfectly legitimate reasons that you didn't seem to comprehend so therefore they weren't good enough for you.
So you sir. You pissed in my cornflakes.

Zombywuf posted:

..Url rewriting would be one way to do it.

The wrong way.

Allow me to quote from the mod_rewrite docs


I hope this puts things into perspective.
URL Rewriting is used so that I can pipe user requests through the index.fcgi transparently (which is required since index.fcgi is the static fcgi app). Basically it masks the "http://mysite/index.fcgi?rm=blah" that cgi-app throws around, and makes it look like "http://mysite/blah". It has nothing to do with the layout of my files nor does it actually redirect people around my site.

It's clean, it's useful, a bunch of frameworks like ruby on rails and applications like wordpress use it, and I like it. Furthermore it's only a 4-line addition to the .htaccess:
code:
RewriteEngine on
RewriteBase /
RewriteRule ^static/(.*)$ static/$1 [L]
RewriteRule ^(\w+)(/.*)?$ index.fcgi?rm=$1 [QSA,NC,L]
I hope this puts things into perspective.


PS: Even with all that to back me up, I'm not even using rewrite any more. I found it sufficient to just parse the PATH_INFO environment variable for almost the same look, which makes it more portable.

syphon^2
Sep 22, 2004
This is getting a bit outside the scope of Perl... but hope you guys will still help me. :)

TiMBuS posted:

mod_rewrite stuff
This has really gotten me to want to use mod_rewrite with my CGI apps, but the actual documentation is a little hefty to wrap my head around. Is there any way someone can provide the lines I'd add to httpd.conf to accomplish this?

I want to access this URL: http://hostname/appname/app.cgi?param=foo
Via this URL: http://hostname/appname/foo

Looking at the example you provided, it seemed like it would be pretty straightforward, but I'm obviously screwing something up, as it's not working. This is what i added...
code:
RewriteEngine on
RewriteBase /
RewriteRule ^appname/app.cgi?param=(.*)$ $1 [L]
RewriteRule ^appname/(\w+)(/.*)?$ appname/app.cgi?param=$1 [NC,L]
EDIT: It seems to work, but whenever I use the form to manually change what param should be, the URL stays the same. I guess it's just not quite behaving quite as I'd expect.

syphon^2 fucked around with this message at 18:40 on Apr 14, 2008

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Any recommendations/experience with ORM packages? I'm hopefully going to be involved in a project soon and I would like to introduce people to business level objects and what not... So I need an ORM layer. But I don't know of any. I've used one before, so I know what to expect, but it was shop-specific/proprietary.

Class::DBI?

Mario Incandenza
Aug 24, 2000

Tell me, small fry, have you ever heard of the golden Triumph Forks?
I've found CDBI to be the slowest of the three major ORM packages (Class::DBI, DBIx::Class, Rose::DB::Object), and this benchmark seems to support that. RDBO may be the fastest but in the end I decided to stick with DBIC since it's the one most often used in conjunction with Catalyst and all the documentation reflects that, plus it was closer in usage to CDBI which I had previous experience with.

Mario Incandenza fucked around with this message at 00:03 on Apr 17, 2008

fansipans
Nov 20, 2005

Internets. Serious Business.
I'll second SpeedFrog's recommendation of DBIx::Class. I started with Class:: DBI but got frustrated with the lack of features / extensibility / plugins available. I've heard Rose:: DB is a screamer, but haven't gotten around to taking a look at it.

DBIx::Class has many hooks and a great selection of third party plugins for profiling & debugging & adding new features. It's also got great support for the basics of database / object relationships (belongs_to, may have, has_one, has_many, many_to_many).

TiMBuS
Sep 25, 2007

LOL WUT?

syphon^2 posted:

This is getting a bit outside the scope of Perl... but hope you guys will still help me. :)
This has really gotten me to want to use mod_rewrite with my CGI apps, but the actual documentation is a little hefty to wrap my head around. Is there any way someone can provide the lines I'd add to httpd.conf to accomplish this?

I want to access this URL: http://hostname/appname/app.cgi?param=foo
Via this URL: http://hostname/appname/foo

Looking at the example you provided, it seemed like it would be pretty straightforward, but I'm obviously screwing something up, as it's not working. This is what i added...
code:
RewriteEngine on
RewriteBase /
RewriteRule ^appname/app.cgi?param=(.*)$ $1 [L]
RewriteRule ^appname/(\w+)(/.*)?$ appname/app.cgi?param=$1 [NC,L]
EDIT: It seems to work, but whenever I use the form to manually change what param should be, the URL stays the same. I guess it's just not quite behaving quite as I'd expect.

I'm pretty sure this is your problem:
code:
RewriteRule ^appname/app.cgi?param=(.*)$ $1 [L]
This rewrite will take the specified param value, and then send the actual param value to the server as a request. So http://yoursite/appname/app.cgi?param=blah will translate to http://yoursite/blah. Then because of the [L] switch it will stop rewriting at this point. Are you sure that's something you want? I would imagine this isn't the case.
If you want a conditional rewrite, then you should use RewriteCond. (I didn't use RewriteCond for /static because I didn't know how when I wrote the htaccess file a year and a half ago. I should fix it.)

Turn your first rewrite into this:
code:
RewriteCond !^appname/app.cgi?
OR if you just want a nulled rewrite like what I used, change your line into
code:
RewriteRule ^appname/app.cgi?param=(.*)$ appname/app.cgi?param=$1 [L]
Which should hopefully fix the problem.

I also really suggest you add [QSA] to your last line, which will allow you to do stuff like http://hostname/appname/foo/?otherparam=morefoo which will conveniently translate out to http://hostname/appname/app.cgi?param=foo&otherparam=otherfoo

LightI3ulb
Oct 28, 2006

Standard pleasure model.
I'm having a hell of a time trying to figure out why when I try to open a file, it sets the filehandle to the name of the file and not the lines inside of the file.

code:
#!/usr/bin/perl
use Data::Dumper;

my $time_stamp = "";
my $email = "";
my $phone = "";
my @lines;
my @matches;
opendir(DIRENT, "/var/local/translog/do_not_market");
my @entries = readdir(DIRENT);
foreach $name (@entries){
	if (($name ne ".") && ($name ne "..")){
		open(LOG, '<', \$name);
		@lines = <LOG>;
		foreach $line (@lines){
# 			$line = '%customer_information = ("time_stamp" =>
"2008-03-04 16:39:56","email" => "test\@aol.com","phone" => "6663332222");"';
			$time_stamp = $line;
			$email = $line;
			$phone = $line;
			$time_stamp =~ s/\D*\=\>\s\"//;
			$time_stamp =~ s/\"\,\"\D*\d*\"\)\;\"//;
			$email =~ s/\D*\=\>\s\"$time_stamp\"\,//;
			$email =~ s/\"email\"\s\=\>\s\"//;
			$email =~  s/\"\,\"\D*\d*\"\)\;\"//;
			$phone =~ s/\D*\=\>\s\"$time_stamp\"\,\"email\"\s\=\>\s\"//;
			$phone =~ s/\D*\"\,//;
			$phone =~ s/\"phone\"\s\=\>\s\"//;
			$phone =~ s/\"\)\;\"//;
			$email =~ s/\\//;

		}
	}
}
print $time_stamp . " " . $email . " " . $phone, "\n";

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

LightI3ulb posted:

I'm having a hell of a time trying to figure out why when I try to open a file, it sets the filehandle to the name of the file and not the lines inside of the file.

code:
opendir(DIRENT, "/var/local/translog/do_not_market");
my @entries = readdir(DIRENT);
foreach $name (@entries){
	if (($name ne ".") && ($name ne "..")){
		open(LOG, '<', \$name);

That looks wrong. You're passing in the name of the file by reference.. why? Also, readdir returns the filenames relative to the directory from which you're reading. So you have to prepend the directory's path to each file. You actually want something like:

code:
open(LOG, '<', "/var/local/translog/do_not_market/$name");

LightI3ulb
Oct 28, 2006

Standard pleasure model.
drat, that was it. Thanks.

As to the by reference thing, I have no idea. That's the only way I could get it to work. If I tried anything else, the file wouldn't open.

Ninja Rope
Oct 22, 2005

Wee.
It's also generally preferable to use real scalars for file handles (open($fh, '<', '/etc/password');) as opposed to the all-caps style handles (but that wouldn't make a difference for what you're doing).

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Are scalar file handles superior to traditional ones in every way? I started out using the traditional ones and only recently started to use the scalar version, but I'm wondering if there's any reason, at all, to be using the old way.

The scalar one has lexical scoping, which is nice, and I think the old way is globally (not?) scoped? The new one you could pass around like a scalar and the old one not at all?

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Triple Tech posted:

Are scalar file handles superior to traditional ones in every way?

I'd say so. Another big benefit is that they automatically close when the scalar is freed. Globals are freed (and thus, the filehandle automatically closed) only when the interpreter shuts down.

maskenfreiheit
Dec 30, 2004
...

maskenfreiheit fucked around with this message at 04:23 on Sep 29, 2010

npe
Oct 15, 2004
That program works fine for me:

code:
[~] $ cat test.pl
#!/usr/bin/perl

sub total{
        my $sum;
        foreach(@_){
                $sum += $_;
                   }
        $sum;
        }
my @fred = qw{ 1 3 5 7 9};
my $fred_total = &total(@fred);
print "The total of \@fred is $fred_total.\n";
print "Enter some numbers on seperate lines.";
my $user_total = &total(<STDIN>);
print "The total of those numbers is $user_total";
[~] $ perl test.pl
The total of @fred is 25.
Enter some numbers on seperate lines.1
2
3
The total of those numbers is 6

tef
May 30, 2004

-> some l-system crap ->

GregNorc posted:

Any ideas how to fix this? I even looked in the appendix for the answer, and still no luck.

For a start: turn on warnings and use strict; Avoid the use of $_, and be a little bit more explicit about what you're trying to do rather than relying on perl.


code:
#!/usr/bin/perl -w

use strict;

sub total {
        my $sum;
        foreach my $num (@_) {
                $sum += $num;
        }
        return $sum;
}

my @fred = qw{ 1 3 5 7 9};
my $fred_total = &total(@fred);

print "The total of \@fred is $fred_total.\n";

print "Enter some numbers on seperate lines: \n";

my $user_total = &total(<STDIN>);

print "The total of those numbers is $user_total.\n";
And like the poster above me I've had no problems running the code.

fansipans
Nov 20, 2005

Internets. Serious Business.

GregNorc posted:


code:
#!/usr/bin/perl

sub total{
        my $sum;
        foreach(@_){
                $sum += $_;
                   }
        $sum;
        }
my @fred = qw{ 1 3 5 7 9};
my $fred_total = &total(@fred);
print "The total of \@fred is $fred_total.\n";
print "Enter some numbers on seperate lines.";
my $user_total = &total(<STDIN>);
print "The total of those numbers is $user_total";

The code above works fine in OSX 10.4 for me.

Also there's no reason to prefix sub names with &.

fansipans fucked around with this message at 11:58 on Apr 28, 2008

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?

fansipans posted:

Also there's no reason to prefix sub names with &.

Actually, there is a difference... And it's a terrible one. And I never use it. But in this particular scenario and use, you are correct.

Mario Incandenza
Aug 24, 2000

Tell me, small fry, have you ever heard of the golden Triumph Forks?

Triple Tech posted:

Actually, there is a difference... And it's a terrible one. And I never use it. But in this particular scenario and use, you are correct.
code:
ABSTRACT: Balls considered harmful
Also, it's time to start using Vim macros so I can stop hand-typing:
code:
use 5.010;
use strict;
use warnings;

Mario Incandenza fucked around with this message at 15:33 on Apr 28, 2008

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Triple Tech posted:

Actually, there is a difference... And it's a terrible one. And I never use it. But in this particular scenario and use, you are correct.

In case anyone was curious: using & means the function call ignores the function's prototype, and passes in a plain list. As Triple Tech mentioned, it's pretty terrible.

Ninja Rope
Oct 22, 2005

Wee.
It's also useful when you want to make sure the parser knows you want to reference a function, like when using constants as hash keys:

code:
use constant FRY    => 'Captain Yesterday';
use constant BENDER => 'Super King';
use constant LEELA  => 'Clobberella';

my %themesong = (
 'Captain Yesterday' => 'is fast',
 'Super King' => 'is the best one of the three',
 'Clobberella', => 'beats you up',
);

# This won't do what you want
printf("%s %s!\n", FRY, $themesong{FRY});
# This works
printf("%s %s!\n", LEELA, $themesong{&LEELA});
# This does too
printf("%s %s!\n", BENDER, $themesong{BENDER()});
There are, of course, other ways.

Mario Incandenza
Aug 24, 2000

Tell me, small fry, have you ever heard of the golden Triumph Forks?

Sartak posted:

In case anyone was curious: using & means the function call ignores the function's prototype, and passes in a plain list. As Triple Tech mentioned, it's pretty terrible.

Don't forget goto &subname - a magic goto useful mostly in AUTOLOAD subs, so you can replace the top frame of the call stack and cover your tracks.

Ninja Rope posted:

It's also useful when you want to make sure the parser knows you want to reference a function, like when using constants as hash keys:

Don't really like constant.pm... the lack of (easy) interpolation and all the edge-cases requiring &s or ()s make the cure worse than the disease.

Instead, why not:
code:
# create $PI as an immutable scalar
*PI = \3.141592;

# or
use Readonly;
Readonly my $PI => 3.141592;

Mario Incandenza fucked around with this message at 09:56 on Apr 29, 2008

<deleted user>

SpeedFrog posted:

Don't really like constant.pm... the lack of (easy) interpolation and all the edge-cases requiring &s or ()s make the cure worse than the disease.

Instead, why not:

Because that Readonly module is going to be really slow. The whole point of constant.pm is that the compiler will inline the data (because it is a sub) and creates no symbol table entry. It's more like a pre-processor constant the way C constants are. The syntax is retarded, I agree, but it's a very important module.

Mario Incandenza
Aug 24, 2000

Tell me, small fry, have you ever heard of the golden Triumph Forks?

genericadmin posted:

Because that Readonly module is going to be really slow. The whole point of constant.pm is that the compiler will inline the data (because it is a sub) and creates no symbol table entry. It's more like a pre-processor constant the way C constants are. The syntax is retarded, I agree, but it's a very important module.
Yeah, I'm not debating any of that - I'm saying that 95% of the time I've seen it in use, it has not been inside scripts that need that level of performance. constant.pm shouldn't be the first choice for everyday code, not when using regular variables, made read-only in whatever method you choose, makes for a code base that's easier to read and easier to maintain. I don't like the special treatment they require when they could Just Be A Variable.

leedo
Nov 28, 2000

I use constant.pm in most of my perl programs; though usually only to define TRUE and FALSE.

syphon^2
Sep 22, 2004
Can anyone give an example of a Perl script (using Win32::OLE) which enumerates all websites installed in IIS (preferably either version 5 or 6) and just dumps the data out in some consumable format?

I've found Win32::OLE and Win32::OLE::Enum, which seem like they'd do what I need. I'm not familiar with Win32::OLE or the IIS Metabase, so I don't even know how to parse the object for the data I need.

I can find a few examples, but nothing that really does what I need.

For example... this (scroll down a bit) manages to grab the default site, but then crashes my Perl interpreter! The code found here seems to work, but I have to provide it with a specific siteid to inspect (and I want to gather all sites, no matter their siteid).

Any advice?


EDIT: I'm muddling through it, but painfully slow. I guess what I'm asking for is a snippet of code or module or something that does what I need more gracefully. This code crashes Perl in certain scenarios (unknown yet) and I think won't work with IIS6.

This is what I have so far
code:
#!perl
use Win32::OLE;
use Win32::OLE::Enum;

$websvc = Win32::OLE->GetObject("IIS://localhost/W3SVC") 
	or print Win32::OLE->LastError;

$enumIIS = Win32::OLE::Enum->new($websvc); 

foreach $objSites ($enumIIS->All) { 
	print "$objSites->{ServerComment}\n" unless ($objSites->{Name} =~ /(Filters|Info|SSLKeys)/);
}
It prints out all sites found on the target server (just localhost in this case). I guess I can get what I need out of this, but there has to be a better way!

syphon^2 fucked around with this message at 17:51 on May 7, 2008

6174
Dec 4, 2004
I've got a very confusing problem.

code:
$sfrma = $IA*(2*$jp+1)*$aval/($QT*8*$pi*$C*$nu*$nu)*$rhs;
#$sfrma = $IA*(2*$jp+1)*$aval/($QT*8*$pi*$C*$nu*$nu)*$rhs;
This works, however if I remove the commented line, it fails with an error 75 lines later. If both lines are commented things work, but obviously this won't work in the long run because I need the calculation of sfrma. If it makes a difference $IA, $QT, $C, $T, and $C2 are all constants, and $pi and $rhs is calculated by

code:
$pi = atan2(1,1)*4;
$rhs = exp(-$C2*$lowerE/$T)*(1-exp(-$C2*$nu/$T));
$aval, $lowerE, $jp, and $nu are all captured as substrings from $_. (Roughly speaking this script reads in a plain text file in one format, and converts it to another format)

To further confuse matters, the calculation of $sfrma was copied from another script doing a slightly different task and things worked there without the extra commented line.

Does anyone have any ideas what could be going wrong?

edit:

If I remove "$QT*" from the denominator of $sfrma, the calculation works. The constants are all defined like:
code:
$IA = 0.997473;
$QT = 80.362;
$C = 2.99792458e10;
$T = 296.00;
$C2 = 1.4388;

6174 fucked around with this message at 18:33 on May 7, 2008

Zombywuf
Mar 29, 2008

Looks like you're confusing the Perl parser. Try adding some whitespace, if nothing else, just for readability's sake.

6174
Dec 4, 2004

Zombywuf posted:

Looks like you're confusing the Perl parser. Try adding some whitespace, if nothing else, just for readability's sake.

I just tried maybe a dozen variations of adding whitespace at various locations (including whitespace around every operator) and the same error occurred.

This being the source (the parser being confused) would also be confusing to me because the line worked just fine from the script I copied it from (which roughly takes the same input format and outputs yet another different format).

Also for the record, these scripts weren't things I wrote initially, I just need to change a formula here and there.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Try running your script through Deparse to see what's actually running. perl -MO=Deparse script.pl

Zombywuf
Mar 29, 2008

6174 posted:

I just tried maybe a dozen variations of adding whitespace at various locations (including whitespace around every operator) and the same error occurred.

This being the source (the parser being confused) would also be confusing to me because the line worked just fine from the script I copied it from (which roughly takes the same input format and outputs yet another different format).

Also for the record, these scripts weren't things I wrote initially, I just need to change a formula here and there.

The problem with the Perl parser is that certain parts of the syntax (regexes mostly) can sometimes only be interpreted by looking ahead in the code.

Generally its / that confuse it, does line 75 contain any /s? Also, what's the error you're getting?

6174
Dec 4, 2004

Triple Tech posted:

Try running your script through Deparse to see what's actually running. perl -MO=Deparse script.pl

I don't know what to make of the output of this:

code:
[6174@antelope mark.2008.04.15]$ perl -MO=Deparse ../convert
Number found where operator expected at ../convert line 144, near "case  2"
        (Do you need to predeclare case?)
Number found where operator expected at ../convert line 145, near "case  1"
        (Do you need to predeclare case?)
Number found where operator expected at ../convert line 146, near "case  0"
        (Do you need to predeclare case?)
syntax error at ../convert line 143, near ") {"
syntax error at ../convert line 145, near "case  1"
syntax error at ../convert line 146, near "case  0"
../convert had compilation errors.
use Switch;
sub by_wave {
    $a <=> $b;
}
[6174@antelope mark.2008.04.15]$ 
edit: The error given when the script is run is exactly as above less the lines "use Switch;" and onward.

The $sfrma calculation is on line 75 as posted above, and starting at 142 is:

code:
#Determine the first letter
switch ($np - $npp) {
    case  2  { $brpp = "S" }
    case  1  { $brpp = "R" }
    case  0  { $brpp = "Q" }
    case -1  { $brpp = "P" }
    case -2  { $brpp = "O" }
    else     { print "Invalid value of N' - N''\n"; exit}
}
Also line 3 is "use Switch;"

6174 fucked around with this message at 19:14 on May 7, 2008

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Maybe you have a runaway parsing error. Try insert an __END__ token at points where you feel all the code above the token is 100% correct. Then slowly slide the line downwards, including more and more lines. Use this, a combination of the syntax check (-c) and Deparse and you should be good.

Zombywuf
Mar 29, 2008

6174 posted:

Also line 3 is "use Switch;"

I suspect your problem lies there, Switch will be doing weird things to your syntax tree to add more syntax into Perl. It's a bit of a pain, but you're safer with elsif.

6174
Dec 4, 2004

Zombywuf posted:

I suspect your problem lies there, Switch will be doing weird things to your syntax tree to add more syntax into Perl. It's a bit of a pain, but you're safer with elsif.

I think this is it. I just converted the switch to a bunch of if/elsif and it now parses correctly and runs.

Thanks for the help Zombywuf and Triple Tech.

npe
Oct 15, 2004
Switch is evil, and the problems it has with /'s in your code are fairly well documented. Good riddance. :)

LightI3ulb
Oct 28, 2006

Standard pleasure model.
HELP!

What the hell is going on with this?
code:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @csva;
my @loga;
my $csvdir;
my $logdir;
my $csv_dir = "/home/jnooraga/csvdir/";
my $log_dir = "/home/jnooraga/csvdir/logs/";
my $out;
my $csv_fh;
my $log_fh;
my $csv;
my $log;
my $csvline;
my $logline;

opendir $csvdir, $csv_dir;
my @csvfiles = grep {!/^\./} readdir $csvdir;
closedir $csvdir;

opendir $logdir, $log_dir;
my @logfiles = grep {!/^\./} readdir $logdir;
closedir $logdir;

foreach (my $csvfile (@csvfiles)){
	next if (-d "$csv_dir$csvfile");
	open $out, ">", "$log_dir$csvfile";
	open $csv, "<", "$csv_dir$csvfile";
	$csvline = <$csv>;
	while ($csvline = <$csv>){
		chomp($csvline);
		@csva = split(',', $csvline);
		foreach (my $logfile (@logfiles)){
			next if (-d "$log_dir$logfile");
			open $log, "<", "$log_dir$logfile";
			my $logline = <$log>;
			while ($logline = <$log>) {
# 				$logline =~ s/\"*//g;
				@loga = split(',', $logline);
				if ($loga[0] eq $csva[2]){
					for (my $j=0;$j<scalar(@csva);$j++){
						print $out $csva[$j].",";
					}
					print $out "\"".$loga[13]."\"\n";
				}
			}
			close $log;
		}
	}
	close $csv;
	close $out;
}
Why is it giving me syntax errors?

LightI3ulb fucked around with this message at 13:58 on May 14, 2008

fansipans
Nov 20, 2005

Internets. Serious Business.

LightI3ulb posted:

HELP!

What the hell is going on with this?

Why is it giving me syntax errors?

Always, always, always include these two lines:

code:
use strict;
use warnings;
Including those two lines doubles the error messages your script outputs, and will probably help you quickly identify where the problem is.

LightI3ulb
Oct 28, 2006

Standard pleasure model.

fansipans posted:

Always, always, always include these two lines:

code:
use strict;
use warnings;
Including those two lines doubles the error messages your script outputs, and will probably help you quickly identify where the problem is.

Fixed. Still clueless.

Adbot
ADBOT LOVES YOU

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

LightI3ulb posted:

Fixed. Still clueless.

What errors are you getting?

  • Locked thread