CGI pm Temp File Problems

2002-03-11 Thread Lee Goddard

CGI open of tmpfile: No such file or directory

Got this running the latest AS Perl with CGI.pm:
the directory C:\temp exists, so CGI pm should find
it; form data was encoded correctly and uploaded
ok afaik, from IE6 to Win2k IIS.

Any help appreciated
TIA
lee

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: CGI pm Temp File Problems

2002-03-11 Thread Thomas Bätzler

Lee Goddard [[EMAIL PROTECTED]] asked:
 CGI open of tmpfile: No such file or directory
 
 Got this running the latest AS Perl with CGI.pm:
 the directory C:\temp exists, so CGI pm should find
 it; form data was encoded correctly and uploaded
 ok afaik, from IE6 to Win2k IIS.

It would be helpful to have a bit more context, i.e.
which method call produced the error? What were you
trying to do?

Assuming you were using CGI.pm's read_multipart(), the
error message could mean that either no temp directory
was found or that the ones it found were not writeable
by the user your CGI code is running under.

What you probably should do is create a special temp
directory for your CGI code, give the web server user
full access to it and then set the TMPDIR variable in
the web server users's environment to that directory.

It may be more effort than to change your global temp
dir's permissions, but then it always pays off to have
been paranoid when something goes wrong ;-)

MfG,
-- 
Thomas Bätzler, Network Engineer, Network Operations EMEA
Peregrine Systems GmbH web: www.peregrine.com
Steinhäuserstraße 22 phone: +49-721-98143-166
D-76135 Karlsruhe / Germanyfax: +49-721-98143-196
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: CGI pm Temp File Problems

2002-03-11 Thread Lee Goddard

At 13:31 11/03/2002 +0100, Thomas Bätzler wrote:
Lee Goddard [[EMAIL PROTECTED]] asked:
  CGI open of tmpfile: No such file or directory
 
  Got this running the latest AS Perl with CGI.pm:
  the directory C:\temp exists, so CGI pm should find
  it; form data was encoded correctly and uploaded
  ok afaik, from IE6 to Win2k IIS.

It would be helpful to have a bit more context, i.e.
which method call produced the error? What were you
trying to do?

The context is file uploads: CGI pm creates a temp file when
it receives a 'file' field from an HTML form..

Assuming you were using CGI.pm's read_multipart(), the
error message could mean that either no temp directory
was found or that the ones it found were not writeable
by the user your CGI code is running under.

Yes, although the temp directory c:\temp is apparently
looked for and does exist, and is writable by me ---
though (agh) I've just thought, it probably isn't writable
by the IIS process

Thanks for encouraging me!

What you probably should do is create a special temp
directory for your CGI code, give the web server user
full access to it and then set the TMPDIR variable in
the web server users's environment to that directory.

Yes - got their just before reading this: thanks.

It may be more effort than to change your global temp
dir's permissions, but then it always pays off to have
been paranoid when something goes wrong ;-)

Yeah.

Thanks
lee

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



How to Get Hash Array into an Object

2002-03-11 Thread Frederic Bournival

Hello,

i really need your help...

I'm not able to get the values of an hash array into an object

Here is my code:

package Test;

 # [...]

  sub AddText {

my $this = shift @_;
my $content = shift;

my %hasharray = %$this-{mimeparts};

$hasharray{'text'} = $content;
$this-{mimeparts} = %hasharray;

}

 sub GetText {

 my $this = shift @_;

 my %temp = %$this-{mimeparts};

 return $temp{'text'};

 }

 # [...]

  sub new {

my $class = shift @_;
my %parm = @_;
my $this = {};

  # Hash Array of mimeparts ('text', 'html', 'file1', 'file2...')
 $this-{'mimeparts'} = {};
  # Hash Array of all filenames
 $this-{'filenames'} = {};

bless $this, $class;
return $this;

}

1;

The problem is in the GetText SUB...
$this-{mimeparts}is an Hash Array and
i want to get the value of this hash with the 'html' key ...

How can i do this ?

Thanx a lot 


Frédéric Bournival


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How to Get Hash Array into an Object

2002-03-11 Thread Joseph P. Discenza

Frederic Bournival wrote, on
:  sub GetText {
: 
:  my $this = shift @_;
: 
:  my %temp = %$this-{mimeparts};
: 
:  return $temp{'text'};
: 
:  }
: The problem is in the GetText SUB...
: $this-{mimeparts}is an Hash Array and
: i want to get the value of this hash with the 'html' key ...

Does this not work?

sub GetText {
my $this = shift;
return $this-{'mimeparts'}{'html'};
}

Good luck,

Joe

==
  Joseph P. Discenza, Sr. Programmer/Analyst
   mailto:[EMAIL PROTECTED]
 
  Carleton Inc.   http://www.carletoninc.com
  219.243.6040 ext. 300fax: 219.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How to Get Hash Array into an Object

2002-03-11 Thread Martin Moss

my %hasharray=%{$this-{mimeparts}};




 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of
 Frederic Bournival
 Sent: Monday 11 March 2002 15:21
 To: Perl Win32-users
 Subject: How to Get Hash Array into an Object


 Hello,

 i really need your help...

 I'm not able to get the values of an hash array into an object

 Here is my code:

 package Test;

  # [...]

   sub AddText {

 my $this = shift @_;
 my $content = shift;

 my %hasharray = %$this-{mimeparts};

 $hasharray{'text'} = $content;
 $this-{mimeparts} = %hasharray;

 }

  sub GetText {

  my $this = shift @_;

  my %temp = %$this-{mimeparts};

  return $temp{'text'};

  }

  # [...]

   sub new {

 my $class = shift @_;
 my %parm = @_;
 my $this = {};

   # Hash Array of mimeparts ('text', 'html', 'file1', 'file2...')
  $this-{'mimeparts'} = {};
   # Hash Array of all filenames
  $this-{'filenames'} = {};

 bless $this, $class;
 return $this;

 }

 1;

 The problem is in the GetText SUB...
 $this-{mimeparts}is an Hash Array and
 i want to get the value of this hash with the 'html' key ...

 How can i do this ?

 Thanx a lot 


 Frédéric Bournival


 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How to Get Hash Array into an Object

2002-03-11 Thread Thomas Bätzler

Joseph P. Discenza [[EMAIL PROTECTED]] wrote:

 Frederic Bournival wrote
 : $this-{mimeparts}is an Hash Array and
 : i want to get the value of this hash with the 'html' key ...

 Does this not work?
 
   return $this-{'mimeparts'}{'html'};

No, there is a reference operator missing, i.e.
$this-{'mimeparts'}-{'html'} would be the right answer.

That is of course because this-{'mimeparts'} can only
be a hash reference - you can't store a hash as a
scalar value without taking a reference. Well, you could
flatten it, but that might make accesses cumbersome ;-)

MfG,
-- 
Thomas Bätzler, Network Engineer, Network Operations EMEA
Peregrine Systems GmbH web: www.peregrine.com
Steinhäuserstraße 22 phone: +49-721-98143-166
D-76135 Karlsruhe / Germanyfax: +49-721-98143-196
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



How to Get Hash Array into an Object - Thanks

2002-03-11 Thread Frederic Bournival

A really BIG thank you :

this two ways are fine:

  return $this-{'mimeparts'}{'test'};

  my %hasharray = %{$this-{mimeparts}};
  return $hasharray{'test'};

Thanx again :))

Frédéric Bournival


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How to Get Hash Array into an Object

2002-03-11 Thread Joseph P. Discenza

Thomas Bätzler wrote, on Monday, March 11, 2002 10:46 AM
: Joseph P. Discenza [[EMAIL PROTECTED]] wrote:
:  Frederic Bournival wrote
:  : $this-{mimeparts}is an Hash Array and
:  : i want to get the value of this hash with the 'html' key ...
: 
:  Does this not work?
:  
:  return $this-{'mimeparts'}{'html'};
: 
: No, there is a reference operator missing, i.e.
: $this-{'mimeparts'}-{'html'} would be the right answer.

Perhaps you haven't read the doc, where it's made clear that the
reference operator is optional between ][, ]{, }[, and }{. The
two formulations (mine and yours) are exactly the same. Yours
is perhaps more self-documenting to those unfamiliar with the
idiom.

From perllol:
=
So how come you can write these:

$AoA[2][2]
$ref_to_AoA-[2][2]

instead of having to write these:

$AoA[2]-[2]
$ref_to_AoA-[2]-[2]

Well, that's because the rule is that on adjacent brackets only (whether
square or curly), you are free to omit the pointer dereferencing 
arrow.=

Joe

==
  Joseph P. Discenza, Sr. Programmer/Analyst
   mailto:[EMAIL PROTECTED]
 
  Carleton Inc.   http://www.carletoninc.com
  219.243.6040 ext. 300fax: 219.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Encoding HTML in hidden inputs

2002-03-11 Thread Byron Wise

I have a form that allows the user to input html. 
After they submit I'm needing to put that value in a
hidden field and wait for them to fill out the second
page before processing.  
What is the best method of encoding the html.  It
seems that the problem is double quotes but I'd rather
have a more robust solution than just handeling the
quotes.

any suggestions?

may thanks,
Byron

__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How to use vbNullString datatype in Perl Win32::OLE???? (second r equest)

2002-03-11 Thread Bullock, Howard A.

The problem may lie in the fact that when the process is running there are
no current user credentials for it to use or that the process is running as
a different user than you expect.

Is there a way of checking who it thinks the current user is?

Thanks for reply. I am running the script in a DOS window under my
credentials.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Encoding HTML in hidden inputs

2002-03-11 Thread Ember Normand

Try:
$yourname = CGI::escape($yourname);

-Original Message-
From: David Kaufman [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 1:13 PM
To: Byron Wise; Perl-Win32-Users
Subject: Re: Encoding HTML in hidden inputs


Byron Wise [EMAIL PROTECTED] wrote:

 I have a form that allows the user to input html.
 After they submit I'm needing to put that value in a
 hidden field and wait for them to fill out the second
 page before processing.
 What is the best method of encoding the html.  It
 seems that the problem is double quotes but I'd rather
 have a more robust solution than just handeling the
 quotes.

you will eventually run acros data that contains four things that will tend
to break html forms (whether your re-populating hidden inputs, text inputs,
or textareas) and they are quotes, both single *and* double, since
single-quotes can also be used to delimit input values, and also in some
cases, those pesky open- and close-angle-brackets  can screw up a
textarea.

you can get around all of them by replacing each with their HTML entities:

$html_data =~ s/\'/amp;/gs;
$html_data =~ s/\/quot;/gs;
$html_data =~ s/\/lt;/gs;
$html_data =~ s/\/gt;/gs;

there are also some weird cases (i've run into at least once, but can't
remember why) where you might need to replace ampersands with their html
entity amp;

$html_data =~ s/\/amp;/gs;

obviously if you do this, you need to be sure to run this substitution on
the string *before* the four above, since they will insert their own
ampersands which must not be re-replaced.

hth,

-dave

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Compress::Zlib replacement for pknunzip

2002-03-11 Thread Dirk Bremer



Here is a incomplete code example 
forArchive::Zip;

 use 
Archive::Zip;
 # Check that the zip archive 
exists. unless (-e $ZipInputFile) {WriteLog("$ZipInputFile 
does not exist",0); exit(0);}

 # Object constructor. $ZipObject = 
Archive::Zip-new();

 # Read in the zip archive. unless 
($ZipObject-read($ZipInputFile) == 0) 
{ 
SetAttr($ZipInputFile,'AHR'); 
WriteLog("Cannot open zip archive 
$ZipInputFile",1); 
exit(0); }

 # Determine the number of files within the zip 
archive. $NbrMembers = 
$ZipObject-numberOfMembers();

 # Check that files exist within the zip 
archive. unless ($NbrMembers  0) 
{ 
SetAttr($ZipInputFile,'AHR'); 
WriteLog("$ZipInputFile is 
empty",1); 
exit(0); }

 WriteLog("Number of files in archive: 
$NbrMembers",0);

 # Extract each file from the zip 
archive. foreach 
($ZipObject-memberNames()) 
{ # Define the output 
filename. $ZipOutputFile = join 
'',$ZipOutputDir,$JobType,$Coop,$Cycle,$Extension; 

 # If the output filename already 
exists, attempt to delete it. 
DeleteFile($ZipOutputFile);

 # Extract the file into the output 
filename. if 
($ZipObject-extractMember($_,$ZipOutputFile) != 
0) 
{ 
WriteLog("Cannot extract $_ from $ZipInputFile, file may be 
corrupted",1); 
next; } 
}

 
Dirk Bremer 
- Systems Programmer II - ESS/AMS - NISC St. Peters636-922-9158 ext. 
652 fax 636-447-4471

[EMAIL PROTECTED]www.nisc.cc

  - Original Message - 
  From: 
  [EMAIL PROTECTED] 
  
  To: [EMAIL PROTECTED] 
  
  Sent: Monday, March 11, 2002 12:50
  Subject: Compress::Zlib replacement for 
  pknunzip
  Hi all; My apologies for the newbie type question, but the 
  perldoc on this one isn't clear to me. I want to extract a file from a .ZIP 
  archive and I think that this is the right package, but am hoping to find a 
  code snippet that I can emulate. I'm trying to replace system calls like: 
  system("pkunzip -e $zipfilename $searchfilename") which works, but may force 
  unwanted screen interactions. Thanks, John**This 
  e-mail and any files transmitted with it are considered confidential and 
  are intended solely for the use of the individual or entity to whom they 
  are addressed (intended). This communication is subject to agent/client 
  privilege. If you are not the intended recipient (received in error) or 
  the person responsible for delivering the e-mail to the intended 
  recipient, be advised that you have received this e-mail in error and that 
  any use, dissemination, forwarding, printing or copying of this e-mail is 
  strictly prohibited. If you have received this e-mail in error please 
  notify the sender 
  immediately.**


Circumvented: How to use vbNullString datatype in Perl Win32::OLE???? (second r equest)

2002-03-11 Thread Bullock, Howard A.

Although I would eventually like to understand this issue and be able to use
OpenDSObject if I wanted, but the issue has currently been by-passed by
using Win32::OLE-GetObject. This apparently used the default credentials. I
am not sure why I selected to use OpenDSObject other than I saw it used in
some sample code on MSDN. For whatever reason I can not proceed. Thank you
to all that took time to respond.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs