libembperl-perl debian package uploaded

2003-01-09 Thread Angus Lees

libembperl-perl appeared in the Debian "unstable" archive a few days
ago.  Its currently 2.0b9dev5-1, based on a CVS checkout in
mid-December (from memory).

This version is compiled against apache1.3/mod_perl (and libxslt). I'm
waiting for mod_perl2 to be uploaded before building an apache2
version, although I may upload something to "experimental" before then
(mod_perl2 packages exist in experimental too).  Since the two
mod_perl packages conflict, the apache2 embperl package will have to
have a different name, probably "libapache2-mod-embperl".

Xalan didn't work for me immediately, so I disabled it. If anyone
really cares I can look into it further (register a bug on
bugs.debian.org).

-- 
 - Gus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question on multipart forms and %fdat

2003-01-09 Thread Luiz Fernando B. Ribeiro
Em Thu, 09 Jan 2003 16:29:37 +0900
Keith Watanabe <[EMAIL PROTECTED]> escreveu:

> i think this issue was discussed in the past, but i really didn't see
> a resolution in the mail archives so i might be covering grounds 
> again.  still i want to work through this problem with anyone else who
> encountered it and see what they did to solve it (if at all possible).
> 
> Here's the issue.  Currently i have a form where i'm using the 
> method="post" and enctype="multipart/form-data" part of a form for 
> uploading an image file.  when I use post in the form, my %fdat
> variable produces something like (in going through my error logs):
> 
> 
> [Mon Jan  6 22:17:49 2003] [warn] [7054]ERR:  32:  Warning in Perl
> code: q :  name is "upload" at 
> /home/jadmin/projects/joshi/perl/lib/Handler/Controller.pm line 25.
> [Mon Jan  6 22:17:49 2003] [warn] [7054]ERR:  32:  Warning in Perl
> code: q :  filename is "fl.jpg"
> Content-Type: image/jpeg
> 
> ÿØÿà at /home/jadmin/projects/joshi/perl/lib/Handler/Controller.pm
> line 25.
> 

I use file upload in Embperl without problems, can you post your form
and describe better (with code) the way you are handling %fdat to
retrieve the file?

Regards,

Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question on multipart forms and %fdat

2003-01-09 Thread Keith Watanabe


I use file upload in Embperl without problems, can you post your form
and describe better (with code) the way you are handling %fdat to
retrieve the file?


oh boy.  this is going to get nasty quickly.  i'll try to a few code 
sources without showing too much since the way i'm building my site is 
kinda complex in structure.  hopefully it'll be enough.

the main file containing the embperl form page is the one below.  this file 
mainly is used to capture the data and then send it off to the index.epl 
page which contains the code for calling handler/controller object for 
manipulating the %fdat and %udat variables.  this page is just a view with 
a few elements for displaying the results of either a lookup or after the 
form is submitted for editing purposes.



  

  

  
Add/Edit Image
  

[$ if $fdat{msg}->{msg} $]

  
[+ $fdat{msg}->{msg} +]
  

[$ endif $]
[$ if defined $fdat{msg}->{data}->{image}->{id} $]

  

 width="[+ $fdat{msg}->{data}->{image}->{width} +]"
 height="[+ $fdat{msg}->{data}->{image}->{height} +]">
  

[$ endif $]

  
Load Image:
  
  

  


  
Image Type:
  
  
[-
$fdat{image_type_id} =
$fdat{msg}->{data}->{image}->{image_type_id}
if 
$fdat{msg}->{data}->{image}->{image_type_id};
Execute('image_type_select.epl');
-]
  


  
Height:
  
  

  


  
Width:
  
  

  


  

[$ if defined $fdat{msg}->{data}->{image}->{id} $]

[$ endif $]
  

  

  





this next page is the controller kind of view which makes calls to 
instantiate a controller object and hand the request and session 
information to the controller object (as well as some customized 
environment settings which is represented by the
$Apache::system->{config} and $Apache::ep references).


[-

use Handler::Controller;

my $controller = new Handler::Controller(
system => $Apache::system->{config},
event => $Apache::ep,
session => \%udat,
request => \%fdat
);
$fdat{msg} = $controller->process();
if (defined $fdat{msg}->{data}->{dude})
{
$udat{user} = $fdat{msg}->{data};
}
-]




[- Execute ('header.epl') -]

[- Execute ($fdat{msg}->{page}) -]




the next object is handles the request data and assembles it into hash refs 
(or occasionally array refs depending on the application).  I do this to 
segregate my data so that I can send it to an appropriate data object for 
persisting in my database.  However, you'll note here that there is a piece 
of code that says:

upload => $q->{upload} which represents the uploaded file.

package Builder::AddImage;

use Builder::Base;
use strict;

@Builder::AddImage::ISA = qw(Builder::Base);

sub init
{
my ($self, $class, %args) = @_;
$self->{image} = {};
}

sub build
{
my $self = shift;
my $q = $self->{request};
$self->{image} = {
id => $q->{id} || 0,
image_type_id => $q->{select_image_type},
height => $q->{height},
width => $q->{width},
upload => $q->{upload},
};
return 1;
}

1;

the file that writes the file to my server is the one below.  i think it's 
pretty close to how a lot upload scripts handle saving a file to the 
server, except that i use an object to handle it.

package Utilities::Upload;

use strict;

sub new
{
my ($class, %args) = @_;
my $self = {};
$self->{file} ||= $args{file};
$self->{dest} ||= $args{dest};
bless $self, ref $class || $class;
}

sub upload
{
 my $self = shift;
 my $file = "$self->{dest}/$self->{file}";
 unlink $file if -e $file;
 open FILE, ">>$file" || die $!;
 my $buffer;
 my $totallength = 0;
 my $bytes;
 while( $bytes = read($self->{file}, $buffer, 1024) )