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
Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
Perl rocks so much. I just used Bot::BasicBot and XML::Simple to get a bot announcing commits in a project's IRC channel.

Here's a complete and working (but less generalized) version of it.

code:
package Bot::BasicBot::Commit;
use strict;
use warnings;                                                                   
use XML::Simple;
use base 'Bot::BasicBot';

sub tick {
    my $self = shift;

    my $ever_checked = $self->{last_timestamp};

    my $xml = `darcs changes --repodir '$ENV{HOME}/www/code/TAEB' --xml --last 20`;
    my $changes = XMLin($xml, ForceArray => 1)->{patch};

    for my $change (reverse @$changes) {
        next if $change->{date} <= $self->{last_timestamp};
        $self->{last_timestamp} = $change->{date};

        # the first time around, we don't want to announce anything
        next if !$ever_checked;

        $self->say(channel => "#interhack", body =>
            sprintf '%s - %s',
                $change->{author},
                join ' ', @{ $change->{name} },
        );
    }

    return 20; # check again in 20 seconds
}

package main;
Bot::BasicBot::Commit->new(
    server => "irc.freenode.org",
    channels => ["#interhack"],
    nick => "NHBotCommit",
)->run;

Adbot
ADBOT LOVES YOU

syphon^2
Sep 22, 2004
Can anyone give me tips on using File::Find, or maybe point out a more appropriate module to use? (EDIT: I'd rather not use one that doesn't come with most default Perl distributions... ActivePerl 5.8 for Windows, in this case. I saw File::Find::Rule, but dismissed it because of that caveat)

Basically, all I need to do is traverse a directory tree (it's actually a UNC path on a remote Win32 server) looking for a specific filename, and then determine the full path to that file. This file is unique (there's only 1 file by that name), but it could be anywhere in the tree. All I need is to find out where that file lives.

The problem is, File::Find's 'wanted' function is just a callback, it's return value is ignored. I'm able to find the file I'm looking for, but I don't know how to get that info back to where I need it!

Here's my code:
code:
sub FunctionFullOfStuff {
    use File::Find;

    [...]

    my @dir = ('\\REMOTESERVER\Folder\Subfolder');
    find(\&wanted, @dir);

    [...]
}

sub wanted {
    print "$File::Find::name\n" if (lc($_) eq 'uniquefilename.xml');
}
This works great. When it finds 'uniquefilename.xml' anywhere in '\\REMOTESERVER\Folder\Subfolder' path, it prints out the full path, which is EXACTLY what I need.

Here's the problem. find() ignores whatever is returned by wanted(). I can print the filename out, but I can't pass it back to my FunctionFullOfStuff where I need it. The only solution I can think of is making some global variable and stuff the filename there if it finds it. However, that's a pretty terrible idea as this function is in a shared .pm file... I don't want to just create random globals that most people won't care about.

Any ideas?

syphon^2 fucked around with this message at 15:47 on Mar 18, 2008

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Couldn't you just declare your accumulator in the same scope as where the find function is called and just have wanted be an anonymous function?

code:
sub a {
  my @tmp;
  find(sub { push @tmp, $File::Find::name }, $DIR);
  print "@tmp";
} a();

syphon^2
Sep 22, 2004

Triple Tech posted:

Couldn't you just declare your accumulator in the same scope as where the find function is called and just have wanted be an anonymous function?
You are my hero. I hadn't considered an anonymous function.

Here's my final code:
code:
use File::Find;

my $file;
my @dirs = ("$server\\$path");

find( sub { $file = $File::Find::name if (lc($_) eq 'uniquefilename.xml') },  @dirs);
print "Now I have the file path ($file) stored in a variable!\n";
Many thanks!

syphon^2 fucked around with this message at 16:48 on Mar 18, 2008

Redbeard
May 12, 2005

by Fragmaster
Edit: tab + enter == :downs:

Redbeard fucked around with this message at 13:35 on Mar 19, 2008

npe
Oct 15, 2004
I've been doing some dangerous mucking around (too much reading source code to Damian Conway modules...). I actually got a module working which enables this syntax:

code:
    sub my_func :Arguments(String, OneOf(Int, String(xyz), Instance(File))) {
        print "yarr!\n";
    }


    my_func('foo', 'bar');
When run...

code:
 "bar" for argument 2 of main::my_func() is invalid, must be one of: a valid integer, a scalar string matching /xyz/, an instance of File() at ArgumentValidator.pm:665
  at main::my_func('foo', 'bar')  (args.pl:13)
It's only run-time checking, of course, but it's an interesting (ab)use of subroutine attributes.

The fact that perl lets me pull this off is sort of simultaneously entertaining and frightening.

ashgromnies
Jun 19, 2004

yaoi prophet posted:

I've been doing some dangerous mucking around (too much reading source code to Damian Conway modules...). I actually got a module working which enables this syntax:

code:
    sub my_func :Arguments(String, OneOf(Int, String(xyz), Instance(File))) {
        print "yarr!\n";
    }


    my_func('foo', 'bar');
When run...

code:
 "bar" for argument 2 of main::my_func() is invalid, must be one of: a valid integer, a scalar string matching /xyz/, an instance of File() at ArgumentValidator.pm:665
  at main::my_func('foo', 'bar')  (args.pl:13)
It's only run-time checking, of course, but it's an interesting (ab)use of subroutine attributes.

The fact that perl lets me pull this off is sort of simultaneously entertaining and frightening.

Perl is really cool. I'm a big fan of AUTOLOAD
http://64.233.167.104/search?q=cach...lient=firefox-a

<deleted user>

yaoi prophet posted:

It's only run-time checking, of course, but it's an interesting (ab)use of subroutine attributes.

Isn't it sad that there are so many modules like this on CPAN? There are tons and tons of attempts to add things to the language to make it seem modern and sane. I think it was a big mistake to set perl adrift to work on parrot and perl6.

There's some cool stuff out there, like Moose, but the fact that it needs to exist is a red flag. And the problem with all of this run-time compensation is that it really does take its toll on performance with heavy use (and I'm of the opinion that you either use it everywhere or not at all). Plus it adds to module dependency hell. For example, to install Catalyst you basically become a CPAN mirror... it's horrible.

Narpas
Mar 16, 2008
You hear the rumble of distant thunder... You feel that eating the little dog was a bad idea.
I'm trying to use PERL to get rid of duplicate files in a big, big ole directory with similar but different file names. I plan to use the file sizes to differentiate between the different files. For example,

awful 5343.jpg
awful 6064.jpg
something 252.jpg
something 1524.jpg
something 1814.jpg
something 2904.jpg
something 4252.jpg
something 5524.jpg
something 6814.jpg
something 7904.jpg

Where there are only three actually different "something" pictures, and the "awful" pictures are the same. I plan to replace the numbers after the files - those are totally arbitrary - with the file size, so that I get,

awful k10408k.jpg
something k13394.jpg
something k15304.jpg
something k18708.jpg

The loop that I intend to use.
code:
foreach $file (@files) {
	$size = -s "$file" ;                #Problem line - supposed to get the filesize.
	$file =~ /(.*?)\s\d/;               #Get just the name, not the number, of the file
	$filecrop = $1 . " " . $size;       #Put it all together.
	print $filecrop . ".jpg" . "\n";    #This is filler for the file manipulation.
}
The problem is that the line $size = -s "$file"; returns "" for $size. Is there a different way to get the file size, or should I just pass a function to bash?

Narpas fucked around with this message at 23:22 on Mar 22, 2008

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Narpas posted:

I'm trying to use PERL

Please call it Perl or perl. PERL reeks with everything wrong about the language.

Narpas posted:

The problem is that the line $size = -s "$file"; returns "" for $size. Is there a different way to get the file size, or should I just pass a function to bash?

-s $file returning the empty string means it couldn't find the file. Are you sure you're in the right directory and that $file is there?

If you're building up @files through readdir, they won't have the directory name prepended - you have to manually do that.

Kidane
Dec 15, 2004

DANGER TO MANIFOLD

Sartak posted:

Please call it Perl or perl. PERL reeks with everything wrong about the language.


-s $file returning the empty string means it couldn't find the file. Are you sure you're in the right directory and that $file is there?

If you're building up @files through readdir, they won't have the directory name prepended - you have to manually do that.
Also, why not use a hash to store the filename and size, rather than hacking the size onto the end of the name? Hashes are perfect for stuff like this. Then you could just do:

code:
foreach (keys %files) {

    my $file_name = $_;
    my $file_size = $files{$_};
    print "$file_name ($file_size)\n";

}

Kidane fucked around with this message at 00:18 on Mar 23, 2008

Narpas
Mar 16, 2008
You hear the rumble of distant thunder... You feel that eating the little dog was a bad idea.
Well, I knew, academically, about making a hash table, but I didn't realize they were implemented simply - I've always figured that they were needlessly complex for small scale tasks. Also, Sartak - I loved your LP Nethack, assuming that's, in fact, you.

Narpas fucked around with this message at 04:43 on Mar 23, 2008

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Narpas posted:

Well, I knew, academically, about making a hash table, but I didn't realize they were implemented simply - I've always figured that they were needlessly complex for small scale tasks.

Hash tables are very very useful for tasks small and large. Perl can probably be blamed for most modern languages having hash tables built into the language (or at least in a standard library).

Narpas posted:

Also, Sartak - I loved your LP Nethack, assuming that's, in fact, you.

Yeah, that's me :clint:

Lord Purple
Mar 7, 2006

Remove your eyes...
I am writing a quick perl script to find all instances of "size" in a file and then delete that line. The problem is my regular expression also catches other lines where it has "size" but inside another word. For example, I want it to get rid of the line "Size: 4234" but not "Install-Size: 34234".
Here is the code I have been working on:
code:
open(infile,"generic");
open(outfile,"<genericNew");
while(<infile>)
{
	if($_ !~ /(size)/i)
	{
		print outfile "$_";
	}
	
}
close(infile);
close(outfile);
Is there anyway I can catch one with a regular expression and not the other?

Subotai
Jan 24, 2004

scrabbleship posted:

I am writing a quick perl script to find all instances of "size" in a file and then delete that line. The problem is my regular expression also catches other lines where it has "size" but inside another word. For example, I want it to get rid of the line "Size: 4234" but not "Install-Size: 34234".
Here is the code I have been working on:
code:
open(infile,"generic");
open(outfile,"<genericNew");
while(<infile>)
{
	if($_ !~ /(size)/i)
	{
		print outfile "$_";
	}
	
}
close(infile);
close(outfile);
Is there anyway I can catch one with a regular expression and not the other?


Well this will help a little:
if(/(^|\s)size/i)

Just see if there is a space in front of size or if it is at the beginning of the line.

ashgromnies
Jun 19, 2004

Narpas posted:

Well, I knew, academically, about making a hash table, but I didn't realize they were implemented simply - I've always figured that they were needlessly complex for small scale tasks.

perl, along with most modern scripting languages, implements hash tables as a core data type.

Also, I would recommend that you take an md5 checksum of the file instead of checking its size to see if they're the same - it's possible that two files have the same filesize but different contents.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?

Subotai posted:

Well this will help a little:
if(/(^|\s)size/i)

Just see if there is a space in front of size or if it is at the beginning of the line.

Maybe you should try word boundaries.
code:
if ($text =~ /\bsize\b/) { do_it }

# also, file handle manipulation usually looks like this

open DATA, 'file.txt';
while (<DATA>) { do_it }
close DATA;

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Triple Tech posted:

Maybe you should try word boundaries.
code:
if ($text =~ /\bsize\b/) { do_it }

But that matches "Install-Size: 34234" which he doesn't want to be matched. I'd say a combination:
code:
if ($text =~ /(^|\s)size\b/i)

Lord Purple
Mar 7, 2006

Remove your eyes...

Sartak posted:

But that matches "Install-Size: 34234" which he doesn't want to be matched. I'd say a combination:
code:
if ($text =~ /(^|\s)size\b/i)

Thanks, that one seemed to do the trick.

Zombywuf
Mar 29, 2008

genericadmin posted:

... Plus it adds to module dependency hell. For example, to install Catalyst you basically become a CPAN mirror... it's horrible.

So install ACME::Everything. Problem solved :-)

Perl may have some weirdness, but are there any other languages in which this even possible?

poofactory
May 6, 2003

by T. Finn
I'm trying to set up a web site to take credit cards through authorizenet using the AIM system.

I'm slightly familiar with perl so I'm trying to implement their sample code.

http://developer.authorize.net/samplecode/

They've hard coded all of the values like cc number, name, address into the script and I am able to set the script up on my web site and it works fine so I know all my passwords and permission settings are ok.

The problem I have, and it is probably because I have to training at all in comp sci, is editing the script to accept the values from a form and pass those values to the gateway.

For example, one value in my form:

<input id="FormsEditField1" type="text" name="Amount" style="white-space:pre" value="50.00" size="10" maxlength="10">

I have the form set up to post this value to the perl script.

The original perl script says:

x_amount => "12.23",

So I changed that to

x_amount => "Amount",

x_amount being the value that the gateway recognizes as the total charge and Amount being the data from my form.

But I get an error that says no valid amount supplied.

Am I supposed to write some actual code to get it to process the form data or can I just change this or another section somehow?

tef posted:

You realise that "Amount" is a string and "$Amount" is the string containing the variable $Amount ?

I would suggest continuing this over in the perl thread here

Does that mean I need to define the "$Amount" variable somewhere in the perl script beyond

x_amount => "$Amount",

?

<deleted user>

poofactory posted:

x_amount => "12.23",
x_amount => "Amount",
x_amount => "$Amount",

The "12.23" is a string literal. So is "Amount". Your $Amount is a scalar variable, which is a thing that holds whatever value is assigned to it. Whenver you say $Amount, perl treats it as "the value stored in $Amount". When a scalar variable appears in a double-quoted string (like the last line above) it will be evaluated, meaning its value is replaced into the string at the position it occurs. You don't need the quotes in your above code ("$Amount" and $Amount are the same here).

Also, I'm not sure what's going on in the rest of your script, but something has to assign a value to $Amount before it will be useful to you. In your case, you want to assign it the data from the HTTP request form input. How you do that depends on what perl modules you are using to work with request data.

poofactory
May 6, 2003

by T. Finn

genericadmin posted:

In your case, you want to assign it the data from the HTTP request form input. How you do that depends on what perl modules you are using to work with request data.

Thank you. I understand that is my problem. I haven't added anything to the sample code other than my passwords/account numbers.

What do I add to the perl script to take care of this?

Do I simply add "use xyz module" or do I need to code something more complicated to parse the data pairs?

Thanks.

tef
May 30, 2004

-> some l-system crap ->

poofactory posted:

What do I add to the perl script to take care of this?

A developer.

You are handling credit card details, so if you don't know about CGI, form escaping or the difference between "$Amount" and "Amount" it is time to give up and find someone who can.

(Sorry for the turn about, I was willing to give you the benefit of the doubt in missing something obvious - but your later posts expose your inexperience fully)

Midelne
Jun 19, 2002

I shouldn't trust the phones. They're full of gas.

tef posted:

A developer.

You are handling credit card details, so if you don't know about CGI, form escaping or the difference between "$Amount" and "Amount" it is time to give up and find someone who can.

(Sorry for the turn about, I was willing to give you the benefit of the doubt in missing something obvious - but your later posts expose your inexperience fully)

Aye. When in doubt, look up "due diligence" and the legal ramifications of the lack thereof as it concerns credit card information. You don't want to be holding this bag.

poofactory
May 6, 2003

by T. Finn

tef posted:

A developer.

You are handling credit card details, so if you don't know about CGI, form escaping or the difference between "$Amount" and "Amount" it is time to give up and find someone who can.

(Sorry for the turn about, I was willing to give you the benefit of the doubt in missing something obvious - but your later posts expose your inexperience fully)

Well, I thought that if the sample code had everything set up and I just needed to configure a couple variables then I could do it. But if it is a lot more than that, I'll find a developer.

heeen
May 14, 2005

CAT NEVER STOPS
Someone posted a module that, when ncluded, would change all string literals to pirate speak or something like that, does someone remember the link?

npe
Oct 15, 2004

heeen posted:

Someone posted a module that, when ncluded, would change all string literals to pirate speak or something like that, does someone remember the link?

I wrote that and mentioned it in one of the earlier perl threads, but I don't think I ever posted it. Let me see if I can dig it up.

Edit: Found it. In Pirate.pm:

code:
    package Pirate;

    use overload;

    # stole this from some website, add or replace as ye see fit
    my %filter = (
        '\bhello\b'         => 'avast, ye',
        '\bit\'s\b'         => '\'tis',
        '\bthere\b'         => 'thar',
        '\bbetween\b'       => 'betwixt',
        '\bdied\b'          => 'snuffed it',
        'ing\b'             => 'in\'',
        'ings\b'            => 'in\'s',
        '\berror\b'         => 'scallywag',
        '\berrors\b'        => 'scallywags',
        '\bbad\b'           => 'vile',
        '\bwas\b'           => 'was bein\'',
        '\buser\b'          => 'landlubber',
        '\bpassword\b'      => 'secret word',
        '\binvalid\b'       => 'wretched',
        '\bfile\b'          => 'dead man\'s chest',
        '\blogfile\b'       => 'captain\'s log',
        '\byou\b'           => 'ye',
        '\byes\b'           => 'aye',
        '\bno\b'            => 'nay',
        '\bwrite\b'         => 'scribe',
        '\bis\b'            => 'be',
        '\bis not\b'        => 'ain\'t',
        '\bisn\'t\b'        => 'ain\'t',
        '\bserver\b'        => 'serving wench',
        '\bper\b'           => 'fer\' ev\'ry',
        '\bdocument\b'      => 'treasure map',
        '\bfiles\b'         => 'bucket \'o booty',
        '\binformation\b'   => 'loose talkin\'', 
        '\bdata\b'          => 'booty',
        '\band\b'           => '\'n', 
        'rs the\b'          => 'rin\' th\'',

    );

    sub import {
        overload::constant(
            q => sub {
                foreach my $word (keys %filter) {
                    my $target = $filter{$word};
                    $_[1] =~ s/$word/$target/gi;
                }

                return $_[1];
            },
        );
    }

    1;
In use:

code:
[~] $ cat test.pl

use Pirate;
print "hello\n";
[~] $ perl test.pl
avast, ye
Just so you know, it absolutely breaks the poo poo out of just about any real script. ALL string literals get filtered, so it makes a mess of all sorts of things (the first thing that broke when I tried it on some existing scripts as a joke was it broke the Getopt::Long specifications for arguments). Still a funny prank.

npe fucked around with this message at 19:01 on Apr 3, 2008

German Joey
Dec 18, 2004

yaoi prophet posted:

I wrote that and mentioned it in one of the earlier perl threads, but I don't think I ever posted it. Let me see if I can dig it up.

Edit: Found it. In Pirate.pm:

Just so you know, it absolutely breaks the poo poo out of just about any real script. ALL string literals get filtered, so it makes a mess of all sorts of things (the first thing that broke when I tried it on some existing scripts as a joke was it broke the Getopt::Long specifications for arguments). Still a funny prank.

you could fix that if you were so inclined. instead of doing a substitution in the overload method, you could instead return a tie::scalar'd variable (of, say, a new Tie::Pirate). the FETCH method of Tie:Pirate could then be overloaded to something like this:

code:
# untested but you get the idea
sub FETCH {
    my ($self) = @_;

    my $sub = (caller(1))[3];
    if ($sub eq 'print') { # or any output function
        my $string = $$self;

        # i think it might be more effective to join your list with |
        # and then feed that into the substitution, perl's regex engine
        # is optimized for poo poo like that
        foreach my $word (keys %filter) {
            my $target = $filter{$word};
            $string =~ s/$word/$target/gi; # by the way pirate talk is gay
         }
         return $string;
     }

     return $$self;
}
and so your substitutions only happen when the variable is output, and all of your other poo poo remains intact.

you can actually do some extremely goofy poo poo this way, as you can effectively modify any runtime behavior of perl you could possibly dream of. i wrote an example of some of this using an early version of PadWalker (which is even more powerful now, it looks like!) a long time ago: http://www.perlmonks.org/?node_id=316345

npe
Oct 15, 2004
Of course, although tied hashes are actually a sane way to accomplish this sort of thing, whereas I was trying to come up with a hilariously inappropriate prank abusing one of the most wtf aspects of perl (being able to overload string literals).

I'm thinking of replacing the pirate stuff (which seemed novel at the time but is pretty cliche by now) with something more insidious, like replacing ascii numerals with similar-but-different unicode versions.

Edit: Sub::Sealed is pretty funny. Somewhere I have a module I wrote that will set UNIVERSAL::AUTOLOAD to a routine that will search for any semi-close matches for undefined subroutines that get called, including pawing through local directories for .pm files. Prank perl is the best.

npe fucked around with this message at 02:53 on Apr 4, 2008

LightI3ulb
Oct 28, 2006

Standard pleasure model.
I'm having an incredibly strange issue. I'm grabbing info from an sql database to fill a spreadsheet with info that dates back 45 days, and I am keeping track of the number of days that are actually being filled in for purposes of getting accurate averages. This variable is incremented sequentially when it prints a value onto the spreadsheet. This is being done in one giant for loop. In the next one, I use the variable to calculate the averages, but I am running into divide by zero errors. Between the for loops, I have the variable printing out, and in the averaging loop, I have it printing if the variable is 0. This is the output from the program:

Daycount dbz: 0
Daycount dbz: 0
Daycount dbz: 0
Daycount dbz: 0
Daycount dbz: 0
12345

Technically speaking, the 12345 should be on the top, because that's the output from the print between the for loops, and the Daycount dbz's should be on the bottom, because they're literally the last line of code. Is this a scope issue? The variable is declared at the top of the subroutine.

Ninja Rope
Oct 22, 2005

Wee.
We could guess better if you posted some code.

German Joey
Dec 18, 2004

yaoi prophet posted:

Of course, although tied hashes are actually a sane way to accomplish this sort of thing, whereas I was trying to come up with a hilariously inappropriate prank abusing one of the most wtf aspects of perl (being able to overload string literals).

nono, you misunderstand. you overload AND tie. so your overload constructor looks like this:

code:
# all code written and tested within this reply window
package Pirate;

sub import {
    overload::constant( 
        q => sub {
            my $newstr;
            tie $newstr, 'Tie::Pirate';
            return $newstr;
        },
    );
} 

package Tie::Pirate;
require Tie::Scalar;
our @ISA = qw(Tie::StdScalar);

my %filter = ... #

sub FETCH {
    ... # previous post
}
so, same transparency as before without any weird runtime errors :)

quote:

Edit: Sub::Sealed is pretty funny. Somewhere I have a module I wrote that will set UNIVERSAL::AUTOLOAD to a routine that will search for any semi-close matches for undefined subroutines that get called, including pawing through local directories for .pm files. Prank perl is the best.

http://search.cpan.org/~davecross/Symbol-Approx-Sub-2.06/

npe
Oct 15, 2004
Oh, awesome. Great, now I'm going to waste more time on Evil.pm today...

LightI3ulb, you have to post source, you'll probably get an answer within minutes if you do.

<deleted user>

Oh god. Every time I see a module like this I laugh until I realize there are probably people using it in production.

Fenderbender
Oct 10, 2003

You have the right to remain silent.

:froggonk: That modules like a disfigured orphan. Horrifying and depressing at the same time.

TiMBuS
Sep 25, 2007

LOL WUT?

Need halp picking a MVC framework.

Wat I'm doing:
I'm writing a modpanel for kusuba, the lovely software 7chan.org uses. It already has an existing modpanel of course but it's all in php and I hate php, so to hell with modifying the existing one, I'll just write a new one (it's probably a better idea anyway).
So I need to make a dynamic, pretty interface to a database with login/session crap. Your standard fare I guess.

I want to keep it lightweight, because it's just a modpanel. This means catalyst is out the window because I installed it about half an hour ago and that poo poo is HUGE. I looked at CGI::Framework on CPAN and it looks real small and I'd like to use it, but it feels kind of limited. I think I have to keep every page callback in a single file, and I have no idea if it works with fastCGI (which I should add, is what I'm going to be using).

So what should I use?
Think I should just bang out my own custom framework?

Also, Sorta Off-Topic: Has anyone had a look at the Continuity module on CPAN?
It's freakin awesome! It's the sort of idea that, if implemented properly on a large scale could really change how we approach dynamic database-driven webpages.
Or maybe I'm drunk.
Or both!

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

TiMBuS posted:

Need halp picking a MVC framework.

I want to keep it lightweight, because it's just a modpanel. This means catalyst is out the window because I installed it about half an hour ago and that poo poo is HUGE.

I thought Catalyst was small, and that the functionality is in its plugins..

quote:

Think I should just bang out my own custom framework?

God no!

quote:

Also, Sorta Off-Topic: Has anyone had a look at the Continuity module on CPAN?

I've been playing with it the last few days. It's really interesting.


I'm a Jifty developer but if you want something small I'd recommend Catalyst. Jifty comes with everything you need, so the install is much larger than Catalyst's.

TiMBuS
Sep 25, 2007

LOL WUT?

Sartak posted:

I thought Catalyst was small, and that the functionality is in its plugins..
Sure didn't seem all that small.

Sartak posted:

God no!
Hey I already have a halfassed framework I already use. It's pretty nifty and incredibly small. Clearly, it's not as complete as a real framework but it's nice. I keep all the pages in /Pages as .pl files which are all read into a big hash on startup. The pages specify a template in /Templates and fill in the required values, then pass back the hash to the renderer module.
Caveats include needing to edit the controller for session management, it uses mod_rewrite to hide page selection, and due to using the index for page selection its not uncommon to mix 'post' and 'get' requests.
Yeah okay maybe I'll use Catalyst then.

Adbot
ADBOT LOVES YOU

<deleted user>
Catalyst started off great, but it has become a gigantic bloated pig. The whole project went into the woods after a while.

I've looked at all the perl frameworks at length, and I can't say I like any of them anymore. What I'd really like to see is something that very efficiently processes the HTTP request of an environment (CGI, mod_perl, etc) into some object, and a fast url->action mapper. That's the only parts of a framework I find I actually want. The rest is all crap from CPAN (and I do mean crap).

quote:

Continuity...

Continuity is a neat idea, but it's not extremely useful since its going to have much steeper memory requirements than the traditional approach. That's a bad thing in a perl environment.

  • Locked thread