Re: Tk/Perl and the Browser

2003-06-05 Thread zentara
On Thu, 5 Jun 2003 12:39:02 +0200 , [EMAIL PROTECTED] (Khalid Naji)
wrote:

Hi,

Is there any way to display a Tk/Perl application unter the browser?

Thank you
KN

Yes it's called the perlplus plugin

http://www.Lehigh.EDU/~sol0/ptk/ppl/ppl.html

It can be tricky to setup properly, but here is a copy of a recent
post on comp.lang.perl.tk

#33
From [EMAIL PROTECTED] Mon Mar 18 15:29:55 2002
Jim Turner [EMAIL PROTECTED] wrote:
   Has anyone successfully gotten the Apache webserver set up to 
 serve Perl Plus Plugin (Perl/Tk) programs (application/x-perlplus)?  
 I have added the mime-type information (I think correctly), and 
 always get server-error.  The log shows:

 Premature end of script headers. 

   If you have, please tell me what you changed in your Apache config 
 files and or your Perl/Tk (.ppl) script(s).

 Thanks,

 Jim

Solved my own problems!  Security=60 errors caused by
permissions on 
the plugin .so file and directories leading to it (browser could not 
execute the plugin)!  In Apache, added:

application/x-perlplus  ppl

to apache-mime.types; and:

AddType application/x-perlplus .ppl

to commonhttpd.conf.  In browser, modified newly-created helper app
for 
perlplus to use plugin's default description, etc.

Also, had to move .ppl files to my document-root -- they won't work in
the 
CGI path?!?!?.  

Seems to work now in both Mozilla  Netscape!

Jim





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



Memory shortage

2003-06-05 Thread Camilo Gonzalez
Okay, I'm still struggling here. My problem is I have a client who has a 
rather large tab delimited text file I am attempting to slurp up and 
place in a MySQL table. The file is almost 6 megs large but my ISP only 
allows 2 megs of RAM per user. I can slurp up only about 1.5 megs before 
I get an error message. I would like to read in only about 1.5 megs at a 
time but if I use the following I exceed memory limits:

while (sysread (TEMP,  $temp, 1_500_000))
 {
  # read into MySQL
  }
Is there a way to step through a large file and process only what I read 
in? I'm so stymied I wanna puke.

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


help with print MAIL

2003-06-05 Thread Catriona Wordsworth
Hi guys,

Needing a little assistance with some issues I am having trying to get my script to 
print variable details into and email generated by the script.

so far the script generates the email with (sendmail-t)  etc

then goes on print MAIL print this

what I now want it to do is this...

if ($variable eq this) {then print MAIL  this is it}
elsif ($variable eq that) {then print MAIL that isn't it}
elsif ($variable eq then) {then print MAIL I don't know}

but when I do this it asks if I need to define the print and when I take out print 
MAIL it doesn't work at all.

Can someone set me on the right track here please??

thanks and regards,

Cat


RE: Getting my head round hashes

2003-06-05 Thread Mark Young

One nice way to learn about hashes, arrays, scalars and references, is
to learn the perl debugger and just experiment.

There is a perl debugger tutorial in the perl documentation.

You can print out the arrays and hashes w/o putting print statements
into your code, and that makes the experimentation very easy and
interesting.

Mark


 -Original Message-
 From: Greenhalgh David [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 1:16 PM
 To: [EMAIL PROTECTED]
 Subject: Getting my head round hashes
 
 Hi all,
 
 I have a script which mostly works, but when I get to the part with
 hashes, it stops. I'm obviously doing something very basically wrong,
 but I can't see what. (been staring at so long it could be anything.)
A
 segment of the code is below:
 
 #!/usr/local/perl -wT
 use strict;
 use CGI;
 
 # Do some stuff to identify the value of $marker which will be a
number
 
 # Do MySQL query to grab the data to be manipulated
 
 my $dbh=connect(DBI:mysql:database, user, password);
 my $query=(SELECT task_ID, priority FROM task_list WHERE priority
  $marker);
 my $reponse-prepare($query);
 $response-execute;
 
 # $ response should now contain a
 # reference to a hash filled with task_ID, priority pairs
 # Dereference $response
 
 my %hash=%($response);
 $response-finish;
 
 # Subtract 1 from each value in the hash
 my ($key, $priority, %newhash);
 
 foreach $key (keys(%hash)){
  my $priority=$hash{$key}--;
  %newhash=($key, $priority);
  }
 
 # Put the new $priority values into the MySQL table
 
 $query=(UPDATE task_list SET priority=? WHERE task_ID=?);
 $response-prepare($query);
 
 foreach $key (keys{%newhash}){
  $priority=$newhash{$key};
  $response-execute($priority, $key);
  }
 
 $response-finish;
 
 # Test the result
 
 print Content-Type: text/html\n\n;
 
 $query=(SELECT task_ID, priority FROM task_list);
 $response-prepare($query);
 $response-execute;
 
 while($key, $priority){
  print Priority: $priority Task Ident: $keybr\n\n;
  }
 
 
 Would someone be patient enough to point out the mistake?
 
 Thanks
 
 Dave
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: Memory shortage

2003-06-05 Thread Todd Wade

Camilo Gonzalez [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Okay, I'm still struggling here. My problem is I have a client who has a
 rather large tab delimited text file I am attempting to slurp up and
 place in a MySQL table. The file is almost 6 megs large but my ISP only
 allows 2 megs of RAM per user. I can slurp up only about 1.5 megs before
 I get an error message. I would like to read in only about 1.5 megs at a
 time but if I use the following I exceed memory limits:

 while (sysread (TEMP,  $temp, 1_500_000))
   {
# read into MySQL
}

 Is there a way to step through a large file and process only what I read
 in? I'm so stymied I wanna puke.


Sure... use the readline function or FH notation:

while ( TEMP ) {
  # $_ holds your record
}

This puts only one record at a time in to memory.

Todd W.



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



Streaming HTML

2003-06-05 Thread Aldekein
Hello,

I am writing a Perl program. The goal of it is to process streaming HTML site
(To describe - the document that you load never end - the new information is
added to the end and sent to the client connected, the connection is not closed
after this so it will be used more and more).

Depends on new information received, it will write short information issues
constantly and post them somewhere, where interested people are. For example to
chat, using the post method. 

I don't know - what is better to use: LWP, Socket connection to the server,
Telnet etc. for processing the stream? Advices appreciated.

-- 
Best regards,
 Aldekein ([EMAIL PROTECTED])
 WWW: http://www.aldekein.tk/
 ICQ: 222412145


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



How to automate the sending of mail

2003-06-05 Thread Richard Heintze
I need my web site to automatically send an email
confirmation. I'm using CGI Perl 5.6 on IIS on
Win2000.

What options are there for doing this? 

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



How to access server com object in CGI Perl

2003-06-05 Thread Richard Heintze
I have an nice little example that demonstrates how to
use COM from a console mode perl program.

However, I want to use COM from a perl CGI page and
microsoft discourages ASP programmers from createing
their own COM objects directly. ASP programmers are
encouraged to use the built-in Server object to create
new objects.

So instead of set x = CreateObject(ADODB.Connection)

You are supposed to say set x =
Server.CreateObject(ADODB.Connection)

How do I do this in perl CGI? Is there a perl server
object?

 Thanks,
Siegfried

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



RE: How to automate the sending of mail

2003-06-05 Thread Scot Robnett
 I need my web site to automatically send an email
 confirmation. I'm using CGI Perl 5.6 on IIS on
 Win2000.

 What options are there for doing this? 

MIME::Lite

Mail::Sendmail

Win32::OLE



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



Printing Foreign Language Characters from a CGI

2003-06-05 Thread Greenhalgh David
Hi all,

A more CGI question this time.

The website I have found myself responsible for needs to be bi-lingual, 
English and Japanese. My problem is, how do I persuade the CGI to 
output in Japanese characters?

Can I use:

print Content-Type: text/html\n\n;
print Character-Set: shift-jis\n\n;
to set the page up to receive Japanese?

I haven't been able to test this because I also can't figure out how to 
get a Japanese script into the CDI. The server i am required to work 
with runs Perl 5.005, not Perl 5.6 and doesn't seem to support the use 
utf8 pragma. I have no control over the server and I'm unlikely to get 
the Perl upgraded. I know about the jcode.pm module, but to perfectly 
honest, I find POD hard enough in English without having to translate 
from Japanese first!

There are plenty of sites out there with Japanese CGI, how do they do 
it?

Thanks!

Dave

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