Re: How to make a hyperlink an argument for a CGI script

2002-09-02 Thread Connie Chan

print "http://site/page/script.pl?me=I\&you=U>Click Me";
or
print "Click Me";
or 
print "http://site/page/script.pl?me=I\&you=U\";>Click Me";
or 
print 'http://site/page/script.pl?me=I&you=U";>Click Me';

but beware what you want is /cgi-bin/ or cgi-bin/ .The first one is 
lookup the CGI root from the server, while the second one is lookup 
the script from the current folder.

Rgds,
Connie

- Original Message - 
From: "Nazary, David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 02, 2002 11:35 AM
Subject: How to make a hyperlink an argument for a CGI script


> Hi,
> 
> In the following web page how can I make "foo" to become an argument to
> "cgi-bin\script.pl" script when I click on "foo"?
> 
> 
> 
> foo
> 
> 
> 
> Currently the script takes "" as an argument when I click on "foo". Any
> suggestion are appreciated.
> 
> Thanks
> David Nazary
> 
> -- 
> 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: Help!! Retrieving Image File

2002-08-21 Thread Connie Chan

[.]

> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> open IMAGE, 'test.jpg' or die "Failed to open image $!";
> my $buf_chunk_size = 1024 * 16;
> my $buffer;
> binmode IMAGE;
> binmode STDOUT;
> 
> print "Content-Type: image/jpeg\n\n";
> print $buffer while read IMAGE, $buffer, $buf_chunk_size;
> 

[.]

This works for me =)

#!Perl
use strict;
use CGI::Carp (fatalsToBrowser);
$| = 1;

my $filepath = 'some/where/the/file/is.jpg";
open IMG, "$filepath" or die "$!";
print "Content-type: image/jpeg\r\n\r\n";
binmode (IMG); binmode (STDOUT);
print while ();
close IMG;

Rgds,
Connie


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




Re: http-file-upload

2002-08-21 Thread Connie Chan

> 
>   we all know already, what it looks like, when we have a form like
>   this:
> 
>   
> 
> 
> 
>   
>   
>   will be this as a link:
>   http://bla.net/cgi-bin/blabla.cgi?AREA=1&EXT=bla

For upload file, you need to make the method by POST, 
AND, you have to add enctype="multipart/form-data" inside
the  tag. However, you can handle upload files by 
CGI.pm. 

If you interested to do it by yourself, try the code below :

use strict;

if ($ENV{REQUEST_METHOD} eq "POST")
{
if ($ENV{CONTENT_TYPE}) 
# if content_type exist, that's a multi-part form.
# That is, for file upload.

{ binmode (STDIN) ; 
   read (STDIN, my $data, $ENV{CONTENT_LENGTH});
print "Content-type: text/html\n\n";
print $data; # Hmm... can you read what are they ?
}
else 
{  # this is a normal text form}
}


> 
>   ok but, what does it look link, when we are uploading a FILE?
> 
>   my goal is it to log in my web based email account and automatically
>   replace my addressbook. I wrote the filter for my addressbook,
>   converting the "the-BAT" addressbook to "outlook" style... I just
>   need to upload it yet.
> 

Where is your webmail a/c? and where is your address book? What is outlook 
style? *.wab format ? or you want to fetch your mail from your ad. book page?

>   I was thinking of using the "IO::Socket::INET" module - is that
>   possible? if so, how?
> 

Emmm... I guess not. =)


Rgds,
Connie


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




Re: Help!! Retrieving Image File

2002-08-21 Thread Connie Chan

No... I believe. I've digging on this topic for very very long 
time on my Win32, Sambar and Apache server.

I can't print any image out without \r\n\r\n, where \n\n is for 
text file only. Why? I don't know =) Guess, because \r\n is for
*binmoded data*.

And without binmode STDOUT and IMAGE both. the read / print
process will terminated after 1024k. Why? I don't know either.

Rgds,
Connie




- Original Message - 
From: "david" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 6:48 AM
Subject: Re: Help!! Retrieving Image File


> not sure if you already have the answer to this one but you:
> 
> binmode IMAGE;
> print "Content-type: image/jpeg\n\n";
> while(){
> print;
> }
> 
> should probably be:
> 
> print "Content-type: image/jpeg\n\n";
> binmode IMAGE;
> while(){
> print;
> }
> 
> you need to print the text header first and than print the 
> binary image. try it and see if it works or not.
> 
> alos, use "\n\n" is better than "\r\n\r\n" because "\n\n" is more
> portable. you also don't need to binmode STDOUT
> 
> david
> 
> Perl wrote:
> 
> > Hello All,
> > 
> > I created a simple http upload file routine that uploads file into my
> > accounts sub folder uploads, "/home/myaccount/uploads". This is
> > already running.
> > 
> > Now what I wanted to do is retrieve the uploaded file from the
> > browser, and display the content in the browser if it is an image or
> > a text/html file, if not then download it. I made a simple code and
> > its not working for the image file, I hope someone here in the list can
> > help me.
> > 
> > Here are the sample code that I've tried so far and it didn't work.
> > Kindly please tell me what I missed
> > 
> > 
> > Code 1: It didnt work...
> > 
> > #!/usr/bin/perl
> > 
> > use CGI;
> > $query = new CGI;
> > my $filepath='/home/myaccount/uploads/laptop.jpg';
> > 
> > print $query->header('image/jpeg');
> > print $filepath;
> > 
> > 
> > Code 2: This code is running ok with text/html files, but not with the
> > images, I hope someone here can help me.
> > 
> > 
> > #!/usr/bin/perl
> > 
> > my $filepath="/home/rce/uploads/drugs.jpg";
> > 
> > open(IMAGE, $filepath);
> > binmode IMAGE;
> > 
> > print "Content-type: image/jpeg\n\n";
> > while(){
> >  print;
> > }
> > 
> > 
> > 
> > Thanks in advance
> > 
> > Archie
> 
> 
> -- 
> 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: browser redirect

2002-08-21 Thread Connie Chan

Emm... I think this mail would better go to CGI list ...

[...]
> 
> 
> #! /usr/local/bin/perl
> 
> print "Content-type: text/html\n\n";
> 
> if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla 4/
> and not $ENV{'HTTP_USER_AGENT'} =~ /compatible/i ) {
> print ;
> } else {
> print ;
> }
> 
> 
How about this ?

#! /usr/local/bin/perl
use strict;

my $version = &do_sth_detect_browser_ver();
my $page = 'surly.cgi';
if ($version <= 4) { $page = 'tipsy.cgi' }

print "Content-type: text/html\n";
print "Location: $page\n\n";

# END

Rgds,
Connie


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




Re: Parsing problem

2002-08-19 Thread Connie Chan

> C++ program's output looks like this:
> 
> A= 20
> B= 30
> C= 70
> AVG= 40
> MIN= 30
> MAX= 70
> TIME= 0.0037
> 
> If I call this in Perl:
> 
> #!/usr/bin/perl -w
> my $result = `myapp`;

replace as :
my @results = `myapp`;

> exit;
> 
> there is output myapp saved in $result
> 
> How to move values from $result to my variables, like

Then :

my %data = ();

for (@results)
{ my ($key, $value) = split /= /, $_, 2;
chomp ($value);
$data{$key} = $value;
}

print $data{valA}; # you got 20
print $data{valB}; # you got 30

Rgds,
Connie


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




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread Connie Chan

or can try 

push @INC, 'the/path/you/want';

Rgds,
Connie

- Original Message - 
From: "root" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 20, 2002 2:19 AM
Subject: Re: Can't locate loadable object DBD::mysql in @INC


> to force @INC to look at the directory of your DBI library, use:
> 
> use lib "your DBI directory"
> 
> along the top of your script
> 
> david
> 
> 
> -- 
> 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: CGI script problem

2002-08-19 Thread Connie Chan

[...]
> 
> print "Content-type: text/plain\n\n";
[...]

Try

print "Content-type: text/html\n\n" 
instead of "text/plain\n\n";

Rgds,
Connie




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




Re: Online installer

2002-08-18 Thread Connie Chan

Yes, much clear, and you've simplifies your question welly =)
You may want to look at http://search.cpan.org/search?mode=all&query=FTP

As long as FTP has its own fix protocal, that wouldn't be
very difficult to deal with for file transfering(with Perl).
The only thing I can think about this moment that you may
extra take care is how to handle those line breaker
(\r\n,\n\n etc.)

Then, I opt to modifiy things at local side, so to make the
outer communication becoming simple file overwrite or write.

But, I found that you didn't mension about the "backup".
What if the client made a error to fill the from ? OR
what'll happen if you/them get disconnected while the
files are transfering? Don't miss it.

Rgds,
Connie




- Original Message -
From: "Soheil Shaghaghi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 19, 2002 12:39 AM
Subject: RE: Online installer


Hi Connie,
Thanks for the reply.
Well, I don't think the client side needs to have anything installed.
I kind of know how it's supposed to be done I m just not sure who to write the code :)
A little bit more details:
1. Let's say I have a directory structure for the program like this:
program
program/data
program/test.cgi
program/data/config.txt

2. The user enters his server ftp username/password
The user also enters some server variables like path to Perl, sendmail,...
The user also enters some variables like where he wants the application to be 
installed on the server. His server path,
username/password, e-mail address...
and submits the form.

3. Now, at my server, where the application is located, here is what I need to do:
Method A:
ftp to the user server, and change to the directory he specified in the form
make some directories (program, data)
copy all the files from my server to those directories
set the permission on these files/directories
Open the test.cgi and change the path to Perl, and save it.
Open the config file and enter the variables the user entered and save it.

Method B:
Open the test.cgi and change the path to Perl, and save it.
Open the config file and enter the variables the user entered and save it.
ftp to the user server, and change to the directory he specified in the form
make some directories (program, data)
copy all the files from my server to those directories
set the permission on these files/directories

I guess this is it!
Hopefully this makes it more clear :)
Now, if the different servers are a problem, I don't mind starting from Unix based 
servers and just address those.



Soheil



--
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: Online installer

2002-08-18 Thread Connie Chan

Wow... but I don't believe this can be accompolish without
installing anything to client side computer(/server).
Even you can, you are possibly doing the way on 'hack'. =)

With some file tricky header decorations, you can auto run
a file downloaded in Win OS(Me and previous) not patched.
But I am not sure if this can be run on a Unix like server.

A possible approach would be like this :

At Server Side (Your server)
A "config generator" which handles user's demanded request.
A "Config phraser" to fedback to remote side computer.

At Client Side (Remote Server)
A "Request Engine", perhaps using LWP::* to query your server.
With what they design to.
A "Config phraser" to modify configs, with data respond on
your server.

Anyway, I believe that's a right way to choose Perl, because
you will dealing with many servers. You don't need to change
much on your code.

Perhaps you can tell us more about what kind of I/O and service
you want exactly. That would more easier to solve problems with
piece by piece.

Rgds,
Connie



- Original Message -
From: "Soheil Shaghaghi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 18, 2002 1:04 PM
Subject: RE: Online installer


Hi,
The programs are located on a website, and I want to offer this as a remote service, 
where anyone can basically use to
install it on their server. They might or might not be on the same server.

Thanks,
Soheil





-Original Message-
From: Connie Chan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 17, 2002 9:49 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Online installer




> Hello everyone,
> Can anyone tell me how to create an online cgi installer?
> Details:
> I have a program that want to install on my user's website upon their
> request.

Where are those 'website' located ? Do you mean you
need a configurator at your local(server) side ?

> What I am looking for is some kind of form which the user fills out entering
> their ftp username/password, the directory where they want the program to be
> installed, the name of the directory, and some variables, like the color of
> the page, admin password, which will directly be inputted into the script
> after the installation is completed.

Or you mean some remote control services ?

Rgds,
Connie


--
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]




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




Re: Online installer

2002-08-17 Thread Connie Chan



> Hello everyone,
> Can anyone tell me how to create an online cgi installer?
> Details:
> I have a program that want to install on my user's website upon their
> request.

Where are those 'website' located ? Do you mean you
need a configurator at your local(server) side ?

> What I am looking for is some kind of form which the user fills out entering
> their ftp username/password, the directory where they want the program to be
> installed, the name of the directory, and some variables, like the color of
> the page, admin password, which will directly be inputted into the script
> after the installation is completed.

Or you mean some remote control services ?

Rgds,
Connie


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




Re: How fatalsToBrowser works ?

2002-08-17 Thread Connie Chan

Thanks everybody, I've made it =))


package Die4CGI;
use strict;

$main::SIG{__DIE__} = \&Die4CGI::die;

sub die
{ my $dieMesg = shift; $dieMesg =~ s/ at .+$//;
  my ($package, $file, $line) = caller;
  $file =~ s/^C:\\Server\\Staff\\Connie\\Project\\onTry\\/\\/;
  $file =~ s/\\/\//g;
  print "Content-type: text/html\n\n";
  print <<"HTML";
# A lot of html #
  Garfield said: $dieMesg happens at: $file line $line.
# A lot of html #
HTML
; exit(0);
}

1;


So I can call it like the normal :

use strict;
use Die4CGI;

my $file = 'somewhere/somewhere';
open FH, $file or die "$!"; # prints what I want 

Another fatalsToBrowser, simple and lovely!! ;)

*BUT!! I still not understand, how can this overided
the orgional "die" ? Why shouldn't I write as :
open FH, $file or Die4CGI::die($!) ;

Would anybody tell me more ? 

Rgds,
Connie



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




Re: How fatalsToBrowser works ?

2002-08-16 Thread Connie Chan

[...]
> If you really want to munge the message, you could subclass CGI::Carp and
> install your munger in front of the call to CGI::Carp::die in the
> $SIG{__DIE__} handler.
> 

But what is a 'munger' ? and what about $SIG{__DIE__}?
How to play with ? Is there any reference documents I 
can read on ?

Rgds,
Connie


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




How fatalsToBrowser works ?

2002-08-16 Thread Connie Chan

I am on a Win32 system, and  I use the fatalsToBrowser to prompt errors 
with some scripts. However, the error mesg will also prompt where exactly
the file(script) is located. In case, I don't want the full path is exposed.
Can I modify sth , perhaps regex s///, to mask the root path ?

like :
File not found : html/log/connie.txt at C:\WWWroot\CGI-ALL\index.pl line 12.

is better be masked as :
File not found : html/log/connie.txt at /index.pl line 12.

Is that possible ?

Rgds,
Connie



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




Re: Help!! Retrieving Image File

2002-08-14 Thread Connie Chan

> Code 1: It didnt work...
> 
> #!/usr/bin/perl
> 
> use CGI;
> $query = new CGI;
> my $filepath='/home/myaccount/uploads/laptop.jpg';
> 
> print $query->header('image/jpeg');
> print $filepath;
> 

Of cause, you didn't open the file and read the file.

You are trying to print "/home/myaccount/uploads/laptop.jpg"
to the screen, but with a image header. That's fatal error.

> 
> Code 2: This code is running ok with text/html files, but not with the
> images, I hope someone here can help me.
> 
> 
> #!/usr/bin/perl
> 
> my $filepath="/home/rce/uploads/drugs.jpg";
> 
> open(IMAGE, $filepath);
> binmode IMAGE;

You also have to binmode the STDOUT

> print "Content-type: image/jpeg\n\n";

That should be .../jpeg\r\n\r\n";

Rgds,
Connie


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




Re: real beginners stuff

2002-08-13 Thread Connie Chan

Don't have exact idea, but see inline comments :

> 
> #! /usr/bin/perl -w
Try #!/usr ... you've added a space there.

use CGI::Carp qw(fatalsToBrowser); # try add this line

[...]
> 
> should I get to see the %ENV details of server_a?

Not, but you might check your error.log so you'll get
a better idea on what exact the error is .

> 
> I am getting a 500 error. Permissions are set to 711 for the script and
> 701 for the folder.

Try make them all 755.

Rgds,
Connie


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




Re: How to find the remote time?

2002-08-12 Thread Connie Chan

2 approachs, both js =)

1. get time with js, write a cookie, and read the cookie.
2. get time with js, use a GET method to take it back.

Rgds,
Connie

- Original Message - 
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 11, 2002 10:29 PM
Subject: How to find the remote time?


> Hi all,
> 
> How can I find the local time of the web page visitors?
> Using localtime function shows me the localtime from the location where is
> the server.
> 
> I couldn't find any environment variable for this either.
> 
> Thank you for any hint.
> 
> Teddy's Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> 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: How to use the gmtime() function?

2002-08-12 Thread Connie Chan

my @tm = gmtime(time + $offset_hrs * 3600); # or - hrs

Rgds,
Connie


- Original Message - 
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 11, 2002 10:27 PM
Subject: How to use the gmtime() function?


> Hi all,
> 
> I am GMT + 2 hours (Eastern Urope) but if I use the gmtime function, it
> shows me 3 hours behind.
> I think it doesn't take into account the summer time change.
> Can I solve this problem?
> 
> Thank you.
> 
> Teddy's Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> 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: How to give a name for a file?

2002-08-12 Thread Connie Chan

Thanks a lot, Chris and Teddy,

Without yours mension, I will believe
"Content-Disposition: attachment; filename=$filename"

is just for "Input", where I think the header options 
is only be :

"Content-type: typeof/sth\r\n\r\n"



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




Re: Creating a shopping cart

2002-08-12 Thread Connie Chan

use Business::CreditCard can do something, but I think you better
not to take that risk on your own. look for some e-commerce partner
is a better choice though. =)

Rgds,
Connie

- Original Message - 
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 12, 2002 7:31 PM
Subject: Creating a shopping cart


> Hi all,
> 
> I have a question, not about Perl, but about CGI.
> Can you give me some hints where should I go to learn how to create a
> shopping cart?
> 
> I don't think I have a problem with the Perl code, but I don't know how to
> validate a credit card, how do the transactions work, etc, to be able to
> write a code for that.
> 
> Are there any books or online tutorials, free shopping carts, etc?
> 
> Thank you.
> 
> Teddy,
> Mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> 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: A function for running another Perl script?

2002-08-12 Thread Connie Chan

Try 
print "Content-type: text/html\n";
print "Location: theparamyoudefine/script.pl?paramyouwant\n\n";

Rgds,
Connie


- Original Message - 
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 12, 2002 11:51 PM
Subject: A function for running another Perl script?


> Hi all,
> 
> Is there a function for running another Perl script with a query string, or
> some parameters?
> 
> I can run a Perl script using the do function, but I couldn't make it to
> send a query string nor some parameters.
> 
> Is it necessary to run "perl $script" with a "system" function, or there is
> a built in function that can do that?
> 
> Thank you.
> 
> Teddy's Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> 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]




How to give a name for a file?

2002-08-11 Thread Connie Chan

I have a script that read and then print a binary file on runtime, 
which actually mean to a file is for download.

I mean, not like this : Download.

However, I don't know how to give a name for the file.

I've use this header :  print "Content-type: audio/mp3\r\n\r\n";
and my script 's name is dl.pl.

When I start to download the file, my browser alert if I want to
save "dl.mp3" . Why the extension can come out, but nowhere for me
to assign the file name ?

Could any body tell me what is the story ? 
and how to give a certain name for the file ?

Rgds,
Connie



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




Re: How to convert decimal to hex?

2002-08-08 Thread Connie Chan

$HEX = sprintf "%1x", $DEC;

for more, perldoc -f sprintf

Rgds,
Connie

- Original Message - 
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 3:11 AM
Subject: How to convert decimal to hex?


> Hi all,
> 
> Please tell me how to convert a decimal number like 255 into its
> corresponding hex value.
> 
> For example I want a result of "ff" for a decimal of 255.
> 
> I've tried playing with the functions ord, hex, pack, ... but with no
> result.
> 
> Thank you.
> 
> Teddy's Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> 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: Combination of "while" and "for" delivers wrong result from array

2002-08-04 Thread Connie Chan

> 
> while () {
>   my @rows= split (/;/);
>   for my $i (0 ..$#rows) 
>{
>print $q->a({href=> "/cgi-bin/details.cgi?nr=$i"},
>escapeHTML($rows[0]))."\n"; 
>} 
>close ADDRESSLIST;

You have closed the file handle here, but the while loop has not ended.

> 
>}

Rgds,
Connie


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




Re: Help Needed: Debugging web applications in perl+cgi+php+mysql on apache+ssl

2002-08-04 Thread Connie Chan

use strict
use warnings

Will help you to save most of debug time.

And. perhaps you still have option C.

Thaz, if you need some quick test, you can
make the form data becomes uri escaped. or
boundary based. So you can test it inline.
with warn, and die. you will really what
error is happened at which line.

But that's a side effect. You can't use
CGI.pm to handle this sort of data, unless
you know how to make the escaped string
becomes STDIN.

Rgds,
Connie





- Original Message -
From: "Saurabh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, August 04, 2002 3:17 PM
Subject: Help Needed: Debugging web applications in perl+cgi+php+mysql on apache+ssl


Hello,

I am not sure if this is the right mailing list to ask this question or not but I have 
exhausted all my resource
(various search engines, including google, some newsgroups and various websites) and I 
could not find a convincing
answer/solution to my question/problem.

Pls direct me to the appropriate mailing list if this is not the correct mailing list 
for this question.
So, here is the scenario:

Basically, I have to create a secure web site functional from most browsers that is 
written in perl+cgi+php+mysql(for
various fcunctionalities  like accessing database etc). How do I debug a web 
application that uses Perl, CGI, PHP, HTML,
Apache+ SSL?

There are mainly two ways that I could found and atleast one of them is not very 
efficient and the second one I am not
sure about.
(a)First solution is to use:
use CGI::Carp qw(fatalsToBrowser); I am not very comfortable with this solution.
(b)The second solution is to use a perl debugger called ptkdb. I am not sure how much 
useful is this ptkdb in debugging
a web appplication.

I have not used any of these solutions. It is a big application and would probably 
need lot of debugging.

Here are my questions to gurus:
(1) Am I correct that anyone of these approaches can be used to debug web application
(2) Which of these is a better approach to debug web application keeping in mind that 
it is a huge application and would
need lot of debugging.
(3) Can anyone suggest me anything else which is better than the two approaches listed 
above.
(4) Can anyone tell me what are the pros and cons of using the two approaches.

I greatly appreciate all the help.

thx,
Saurabh












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




Sort of questions about CGI

2002-08-03 Thread Connie Chan

1. Can remote user hide their REMOTE_ADDR and HTTP_REFERER?

2. What types of REQEUST_METHOD will CGI / CGI.pm handles ? I 
think just get and post.

3. How many enctypes here ? What I know is 2. Is that refer to CGI/1.1 
or HTTP/1.1 or the browser?

4. When I pick up a form, would the line breaks by \r\n and \n are difference after 
the "pack" procedure ? So which side determine that ? Remote side or server side ?

5. Is that CONTENT_TYPE only appear when a form is encrypted by 
multipart/form-data ?

6. What is the standard or what for how the boundary --123456789 is 
formed ?

7. When is the time I know the length on CONTENT_LENGTH or the QUERY_STRING?
When the form is firstly activated my script (the header)? or When the whole content 
is 
totally received ?

8. When a form with files attached, how can I know what is the type of file ? by 
filename's
extension or what ?

9. Where can I find more sources about the protocal on HTTP and CGI ?

Thanks in any respond and / or pointing me to some referece page.

Rgds,
Connie


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




Re: To upload file from client to Appache server (WNNT)

2002-08-02 Thread Connie Chan

I didn't read the rest of your code, but I found a very visible 
error You say your perl(perhaps you mean the comipler)
is installed at C:/progra~1/perl/... but your code write it as : 
#!E:/Perl/bin/perl -wT

So I guess everything will going wrong

Rgds,
Connie






- Original Message - 
From: "Bruce Ambraal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 02, 2002 10:23 PM
Subject: Re: To upload file from client to Appache server (WNNT)


> Check out the errors I am getting when I run the bruce.html on my
> Appache 
> (Apache/1.3.26 Server at 165.25.207.246 Port 80) 
> 
> my Perl have been install in dir c:/program files/perl/bin.
> When I view any Perl program via the web then I get the same errors.
> 
> What am I doing wrong.
> 
> Please help
> 





> -- 
> 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: Multiple Selects to Perl Script

2002-07-31 Thread Connie Chan

Sorry, wrong =)


One
Two
Three


Don't missed the value= inside option.
where value= is the value throw to CGI, 
otherwise, you will get type=(nothing).

Rgds,
Connie

- Original Message - 
From: "Margaret" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 01, 2002 1:45 PM
Subject: Fw: Multiple Selects to Perl Script


> 
>  Hi
> 
>  My html looks like this :
> 
>  
>  .
>  .
>  
>  one
>  two
>  three
>  etc
>  
>  .
>  .
>  
> >
> > Does this look right?
> >
> > Thanks
> > Margaret
> >
> > - Original Message -
> > From: "Kipp, James" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 31, 2002 3:36 PM
> > Subject: RE: Multiple Selects to Perl Script
> >
> >
> > > are you sure all the values are associated with the name 'type' ?
> > >
> > >
> > > > -Original Message-
> > > > From: Margaret [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, July 31, 2002 9:27 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Multiple Selects to Perl Script
> > > >
> > > >
> > > > Hi
> > > >
> > > > I am having a most frustrating problem. I created a from with multiple
> > > > selects using a perl script and passed the multiple
> > > > selections to an array
> > > > ie.
> > > >
> > > > @array1 = $q->param('type').
> > > >
> > > > The array only contains the first selection and none of the
> > > > others. How do I
> > > > fix this? I have read a lot of documentation and it is
> > > > supposed to work.
> > > > What am I doing wrong?
> > > >
> > > > Regards
> > > > Margaret
> > > >
> > > >
> > > > --
> > > > 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]
> > >
> > >
> >
> 
> 
> -- 
> 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: Checking Form data

2002-07-31 Thread Connie Chan

> > What is the best way to validate form data. 

That would be a very very big topic here...
I can't show the method, but can share some steps.

 Client Side 
1. Check missing fields (Check it if js enabled)
2. Check pattern (js also do regex, but not powerful as Perl)

 Server Side 
3. Pick up data ( you may have to deal with GET and POST )
## Do 1 and 2 here if client side disabled js.
4. Check referer / session id /cookies / whatever
(Aim to check where the form sign from)
5. Check yours own expectation on fields perference.

That's all about on my point of view.

> > I have a form which the user
> > enters dates like '08/01/2002'. What is the best way to make sure this
> > format is entered. Should i use javascript here or regex?

None of them, you should create a select/opt menu.
Then you even no need to check it, so you can put you focus
to avoid 31/02/2002 etc.

Rgds,
Connie




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




Re: Post to a second CGI script

2002-07-29 Thread Connie Chan

Use cookies is the best choice.
or use frame to hide any URIs as alt.

Rgds,
Connie

- Original Message - 
From: "Jim Lundeen" <[EMAIL PROTECTED]>
To: "begin begin" <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 8:06 AM
Subject: Post to a second CGI script


> Hello All,
> 
> I have 2 scripts.  One accepts 3 values LOGIN_USERNAME, LOGIN_PASSWORD
> and ACTION from an HTML form.  That script looks in a user table in
> MySQL to verify the user.  If valid, it passes them to MENU.CGI with
> LOGIN_USERNAME and a unique session number (USN).
> 
> Here's the question:  How to I "post" the LOGIN_USERNAME and USN to the
> MENU.CGI script?  I don't want the user "carrying" the info around in
> the "Location" bar as "?USN=1234&LOGIN_USERNAME=somebody" -- I want it
> to be part of the user's Perl process if you know what I mean, so that
> if they hit RELOAD the values are still with them.  Too, I don't want
> someone trying to modify the info if it were in the "Location" bar, so
> it needs to be a part of the "post."
> 
> Any advice would be much appreciated!
> 
> Thanks!
> 
> Jim
> 
> 
> 
> -- 
> 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: Big success! and a question.

2002-07-26 Thread Connie Chan

> I've seen why it is a good idea to deny uploading files on the server if
> this is not necessary using CGI.pm.
> 
> Well, what happends if someone tries to upload a file on the server with a
> fake form, if I am not using CGI.pm in that script?

If the true form is within your site, then, you can 
check where the form comes from by $ENV{HTTP_REFERER}.
This carries where the form's address is submitted from.
More accurate, that telling where this script was activated
by.

> 
> Will the server try to upload the file?

Do you mean the file will out going from your server ? or
do you mean the acceptance of file uploading from a fake
form ? Both of case are depends on how you define them.

> 
> Who is responsable for uploading? CGI.pm? Any script?
> 

Of cause, the client's browser respond for this. =)
Just kidding, for uploading a file, you will have to write 

Then the request will be known as with a file attached.

Even though most of time, I won't use CGI.pm, but for receive
a uploading file, I will use it. 

Rgds,
Connie



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




Re: Finding the country

2002-07-25 Thread Connie Chan


- Original Message - 
From: "Hytham Shehab" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 25, 2002 4:21 AM
Subject: Re: Finding the country


> Randal L. Schwartz wrote:
> > If you're using it to force the language of the page, no.  Use the
> > browser specification instead.
> 
> thanks v. much for that Randal, but *how* ?
> how i can use the browser specification?

my $browser = $ENV{'HTTP_USER_AGENT'};
my $lang = $ENV{'HTTP_ACCEPT_LANGUAGE'};

you can also get this by javascript too.

However, that's a problem case if I am using a Chinese Win, 
and I use a English Netscape. You can get my system language 
if I use IE, however, you can't get it when I use Netscape, 
unless the user had set the browser accept other language too.

Rgds,
Connie


> 
> --
> Hytham Shehab
> 
> 
> 
> 
> -- 
> 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: another way to show results ?

2002-07-25 Thread Connie Chan


>- Original Message - 
>From: "alpha" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, July 25, 2002 6:30 AM
>Subject: another way to show results ?
>

>hi all 
>i am new in perl and want to know can a perl cgi , return results in other way ? 

It depends on how you activate the perl script. by SSI or new page as you mensioned 
below.

>i know cgi script return result in new webpage . but i dont want a new  page open . 
>i want it return result in same page and in row i call it . 

So you will use IFRAME, ILAYER method, or by SSI Method. but I don't know
what is "in row i call it". In case, you can have some method that let javascript
to activate the script.

>like a counter or other web tools 

Counter like return is a "Single Process" independ from your entire page.
The counter script return a boolean data which is called from the IMG tag, 
so as EMBED.

If I treat EMBED and IMG is an object, and say, you can plug any object anywhere
anytime you want. So, Iframe and iLayer are object too.

1 thing more, you may try to return the result to a frame along you current window,
if you have frames assigned.

Rgds,
Connie





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




Re: Two Questions

2002-07-24 Thread Connie Chan

> 1.- I've perl for windows (active perl) when i try to
> do a line command it's doesn't work! i do something
> like this:
> D:\>perl -e 'for(1..300)sleep 1;print STDERR ".";'

It could be : 
perl -e "sleep 1 for (1..300) ; print STDERR '.'"
or 
perl -e "for (1..300){sleep 1 } print STDERR \".\""

you can't start in this way by -e '..'

Rgds,
Connie



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




Re: my mailbox is filling with all posted messages, what to do?

2002-07-23 Thread Connie Chan


- Original Message - 
From: "Michal Simovic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 11:54 PM
Subject: my mailbox is filling with all posted messages, what to do?


> I'm sorry for bugging you but I don't understand (I'm
> not a native english speaker) 

So.. me too =)

> [...] what should I do if I
> only wish to receive answers to my questions to my
> mailbox and not all the others that were posted. 
> could somebody explain? 

Filter it, mail from this list to you is by 
beginners*@perl.org, delete them all. unless the
To, Cc field have stick your address inside. 

But I don't recommand you do so, if you are the beginner. 
You can really learn alot here. 

Rgds,
Connie

> thank you
> 
> __
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> -- 
> 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: question about cgi-lib.pl

2002-07-23 Thread Connie Chan

Hmm... if I don't remember it wrongly, cgi-lib.pl is some sort
of old Perl(4) code. Now, you better use CGI.

Rgds,
Connie

- Original Message - 
From: "Michal Simovic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 4:28 PM
Subject: question about cgi-lib.pl


> I'd like to ask how to tell perl script to use
> cgi-lib.pl and where cgi-lib.pl should be placed.
> 
> __
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> -- 
> 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: Script for making declarations

2002-07-18 Thread Connie Chan

So what kinds / types of declarations you want to make ?

Rgds, 
Connie

- Original Message - 
From: "Murli Nair" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 19, 2002 3:58 AM
Subject: Script for making declarations


> Hi !!
> Is anyone aware of a script that I could use to make 
> declarations in my perl code. I have a huge CGI 
> which does all the work and it does not use strict.
> It was written by someone else, and I am cleaning it  up. 
> I have broken up this CGI into atleast 10 different 
> CGI's,  I now have to make declarations for all the 
> variables that it uses. If you have one  which does this 
> I will appreciate if you could send me the same. 
> Cheers always!!
> Murli
> 
> 
> 
> -- 
> 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: multi-page form and cgi.pm

2002-07-17 Thread Connie Chan

First, you can use cookies, temp files.

 >  with multiple
> scripts and html forms and hidden fields.

Do you mean that's a CGI script ? or Javascript ?

> However, I would like to try to
> use one script with subroutines.  I guess my main stumbling block is
passing
> hidden form fields between subroutines.

What difference when a CGI script receive those data ?
whatever textarea, raido, hidden, text, still a name=value pair, isn't it ?
=)


> Can anyone offer me a simple
> example of how to go about passing a form field from one subroutine to
> another subroutine where it is a hidden field using cgi.pm?

It's quite confuse for "passing a form field" do you mean , value ?

if you want to passing values in subs, here you are :
sub entryA
{ my ($entry) = shift ; my $result = ''; . return $result}

# MAIN
my $data = ''
if ($model_no) { $data = &entryA($model_no)  ;. }

Again, there is no different for "hidden" or not. Hidden is also name=value
pair, the difference is only visitors can't see the data.

Rgds,
Connie


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




Re: cgi put script?

2002-07-16 Thread Connie Chan

> I'm trying to get the "put" function from Netscape, to work with Apache.

What is the "put function" ?

> I have a windows OS (NT server), and I'm using the windows version of perl
> as a cgi script interpreter.  The problem is, the put script won't work
> with perl.

Have you correctly set the parameter which let Apache know where is your
cgi-bin is ? and in your code, have you state #!C:/blah/blah... / -wT
correctly ?
Did your success for some simple test, just like print 'hello world' ?

> I just get "server error" messages, because perl doesn't like
> the commands, or the syntax, in the scripts.

Do you mean 500 Server error ? but can you sure there are no error inside
the code ? did you turn on warnings ? and use die "..." ? and did you print
header (ie. print "Content-type: text/html\n\n" ) ?

> I found the scripts from a web site, and a book on Apache.  I'd like to
> first try just finding another put script that will work with perl, in
> windows.

So what's the code ? Would you show us ?

> Are there any sources for cgi scripts, I might look at?

There are a lot if you search it by a google engine. But what do you want ?

Rgds,
Connie


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




Re: Does Windows support flock?

2002-07-13 Thread Connie Chan

> I thought Windows doesn't support Perl's flock, but I heard that it does.
> Is it true?

Yes, flock can use in Win32 OS.

>
> I've seen more Perl programs that create another temporary file for
marking
> a file as locked than programs that use the flock function.
>

Imagine, there is a text based guest book file. But when 2 ppl sign to the
book
at the same time , what will happen if the first one's entry still writing
and the
second one already start to write to the file ? (Ans. The file will be
erased ).
So flock it.

Imagine, there is shopping cart's quotation program for public. You need to
count,
and save some referece to somewhere and print out at last. What will you do
? A
temp file maybe an idea, because you may not need it after the quot. has
printed out.

For me, flock is pointing to some file for long run, and temp file as it
named, for temp
usuage, just short run.

Rgds,
Connie


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




Re: What is this string type? How to play with?

2002-07-11 Thread Connie Chan

Hi David,

Hehe... Thanks in advice. Anyway what I am looking for is making
those stuff back to what they looks like when they come, that is,  the
$input in your script...

However, may I have some questions about your sample ? =)

> my @variables = split(/[\&\;]/, $input);
; has no problem, why you would like to escape( \ )it ?

> next if ($variable !~ /\=/);
= also no problem , why you would like to escape it too ?
Besides, if you 'next' it if that $variable is not a name=value pair,
so is that mean this var will throw away ?

> $name =~ tr/+/ /;
> $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Hmmm... what is this purpose ? $name is probrably going to be a
var's name, how come it goes with a blank ? and with an assumption
that the $name is coming as a URI escaped string ?

> .. Keep in mind, you may have multiple
> # values for the same name.

Just hard to imagine how come a request coming with same name.
Aren't we supposing the later come value with same name will overwrite
the first one ?

Maybe I am still new to Perl... so I'm try to write my script to handle a
form request
like this ? Would you and the list comment on me ? ( except telling me to
use CGI,
because I won't use it unless I have to deal with multipart form =))

my %data = undef;
my $input = undef;

($ENV{REQUEST_METHOD} eq "POST") ?
{ read (STDIN, $input, $ENV{CONTENT_LENGTH)} :
{ $input = $ENV{QUERY_STRING}} ;

my @vars = split (/\&/, $input);

for (@vars)
{ my ($name, $value) = split (/=/, $_);
$value=~ tr/+/ /;
$value=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$data{$name} = $value;
}

Rgds,
Connie


> --
--
> my @variables = split(/[\&\;]/, $input);
> foreach $variable (@variables) {
> next if ($variable !~ /\=/);
>
> my ($name, $value) = split(/\=/, $variable);
>
> $name =~ tr/+/ /;
> $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
> # assignment to some form of a variable structure that you will be
> # using out side this loop.  Keep in mind, you may have multiple
> # values for the same name.
> }
> --
--
>
> Regards,
> David
>
>
>
> - Original Message -
> From: "Connie Chan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, July 10, 2002 4:21 PM
> Subject: What is this string type? How to play with?
>
>
> Hi all,
>
> With get method from form, we always see that the
> $ENV{QUERY_STRING} like this :
> &message=%20%2F%15+...&...
>
> btw, what is the name of that string in types of ? Escape ? Unicode ?
>
> With simple tr/// and s///, I can get back what exact the input
> is, but, how can I make a the input back to the above format ?
> Totally have no idea...
>
> Rgds,
> Connie
>
>
>
>
> --
> 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]




What is this string type? How to play with?

2002-07-10 Thread Connie Chan

Hi all, 

With get method from form, we always see that the 
$ENV{QUERY_STRING} like this :
&message=%20%2F%15+...&...

btw, what is the name of that string in types of ? Escape ? Unicode ?

With simple tr/// and s///, I can get back what exact the input
is, but, how can I make a the input back to the above format ?
Totally have no idea... 

Rgds, 
Connie



Re: Ternary Regex Evaluation

2002-07-08 Thread Connie Chan

Sorry, I am poor in English, but is this what you want ?

$title = $content;
while ()
{   chomp;
 $title = $1 if ( /(.+)<\/title>/i );
}   print $title;

Rgds,
Connie




- Original Message -
From: "John Pitchko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 12:57 AM
Subject: Ternary Regex Evaluation


Hello,

I am trying to do some pattern matching in a ternary evaluation, but it does
not seem to work. If I place the regex into a structured if statement, it
evaluates fine, but not in a ternary evaluation. Here is what I have so far.

my $title;
...
...
...
open FH, HTML_HOME . $directory . $content or die "Cannot open file : $!";
while ()
{
chomp;
(m/(.*)<\/title>/i) ? $title = $1 : $title = $content;
}
print $title;

Does anyone have any suggestions?

TIA

John Pitchko
Data Services
Saskatchewan Government Insurance



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




Re: Is it possible?

2002-07-07 Thread Connie Chan

Maybe yes, maybe no.

You may try to use LWP to grab the page's content, and digest it by your
coding effort.
However, you may have to face the cookies gard, and password gard(like
cNet).
Good luck if you really want to have a try.

If I do not make a wrong memory recall, SOAP is a module can link with the
Google
Engine, and I guess this is a more practical way for you to deal with the
rest.

Rgds,
Connie


- Original Message -
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 07, 2002 9:05 PM
Subject: Is it possible?


> Hi all,
>
> You know that  all download sites like ZDNet or Tucows use a CGI program
for
> letting visitors download a file.
>
> Is it possible to make a Perl script that should find out the real path to
a
> file from ZDNet or Tucows, instead of that path that use a CGI script?
>
> Thank you.
>
> Teddy Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
>
>
>
> --
> 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: Odd boxes after uploading

2002-07-07 Thread Connie Chan

> Sure, I've got my own Apache-server.

Then I wonder why you going to Upload it, but not save your file
directly inside the bin ? Are you running them with different OS ?

 > print "Content-type:text/html\n\n";

Yes, like Janek said, you may try to make it
print "Content-type: text/html\n\n";
(with a space between : and text )

> http://voelspriet2.nl/cgi-bin/comments.cgi
> http://voelspriet2.nl/cgi-bin/commentgood.cgi
>

you can try to run your sciprt in shell, or use CGI::Carp
qw/fatalsToBrowser/
to check ( Janek told me =))

If you can run this with no error in shell, but you can't run it on browser,
that
would normally, just normally because of the header problem.

Conclusion, I can't tell if your script's fatal is because of the box (^M)
or not,
but if you are running you OS same as the server, don't upload it. Directly
save
your work to the bin would be fine.

Rgds,
Connie


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




Re: Odd boxes after uploading

2002-07-07 Thread Connie Chan

So what's your error message you got ? and where you got
the error? And what is the "boxes" mean ? I dont' see any
boxes there. so what is your text editor for writing this script ?
But the most important things are :
1. Do you have the right to run CGI at your server ?
2. Do you know if you are pointing your perl compiler
at a right path( #!/usr/bin/perl) ?  You can't just copy this from
book. Different server may config it at different location..

Rgds,
Connie



- Original Message -
From: "Henk van Ess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 07, 2002 9:59 PM
Subject: Odd boxes after uploading


> Dear all
>
> I just uploaded the following .cgi to my server:
>
> #!/usr/bin/perl
> print "Content-type:text/html\n\n";
> print "Show me the monkey"; #this line prints the sentence "Show me the
monkey"
>
> Even after I chmod'ed it to 751 or 755, I got an error! So I
> downloaded the script to see what went wrong. Suddenly I've got
> "boxes" added in the text - see attachment (I hope I'm allowed to send
> this attachment)
>
> I tried FlashFXP and WS-FTP for uploading the file, but both gave the
> same result.
>
> What is wrong?






> --
> 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: How to add " "

2002-07-07 Thread Connie Chan

$input =~ s/^(.+)$/"$1"/;

Don't use it. This is too trouble to doing this way.
Just want to tell, this is also a method =)

Rgds,
Connie





- Original Message - 
From: "Henk van Ess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 07, 2002 5:12 PM
Subject: How to add " "


> 
>  I've got a beginnersquestion. How do I add a " before and a " after
>  any given user-input? I want to make a phrase out of the user-input.
> 
>  Example:
> 
>  userinput:
> 
>  walking in mountains
> 
>  output should be:
> 
>  "walking in mountains"
> 
>  So basically, I want to change
> 
>  userinput
> 
>  into
> 
>  "userinput"
>  
>  Any help?
>   
> 
> -- 
> Best regards,
>  Henk  mailto:[EMAIL PROTECTED]
> 
> 
> -- 
> 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: perl cgi and html table td tags..

2002-07-05 Thread Connie Chan

First, I have to declare that below are my own opinion only.

Second, I would like to give you a pure HTML sample for a 2x2 table.




Col 1 Row 1
Col 2 Row
1


 Col 1 Row
2
Col 2 Row
2



Third, I would say, CGI.pm can handle simple  with quite fair
quality,
but it should not for a table. Code will be so ugly and hard to debug.
Imagine what will
be the code looks like if there are table2 inside table1, while table 3
inside table 2 and
Table3's first row want to span 2 column, while table 3 have 4 column. So I
recomment
you to write in this way :

print <<"HTML";





HTML

So, reserve CGI.pm for just handling Form data process and header
printing and whatever functions, beside Table and Frame.

Rgds,
Connie

- Original Message -
From: "jmpond" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 06, 2002 2:18 AM
Subject: perl cgi and html table td tags..


Hello List,

Here is my issue.  Trying to use perl/cgi script to build a table in a form.
Building the table is straight forward as the code snippet below works.  The
problem is -- How do I set up the code to align cell 1 right and align cell
2 left? Or more generally how do I set up the code to apply different HTML
attributes to individual cells?

print $q->table((
  {-cellpadding=>"5", -cellspacing=>"0", -border=>"1", -width=>"100%"},
 $q->Tr({-align=>'center'}, [
  $q->td([" this is cell 1","this is cell 2"]),
  $q->td({-align=>"left"},[" this is cell 3"])])));

After that I will want to set up different font faces in each cell so any
info on that would be helpful too.

Thanks in advance for helping.

Joe Pond



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




FW: Check Mail then Fax [BEGGING FOR HELP.... PLEASE]

2002-07-05 Thread Connie Chan

Please anybody I am begging now. Please help...
  This is a mess now... I even have no concept on how to start.
  I will working on something like this

  There are 2 interface as input. One is a Web interface, which will accept
  HTML tag and plain text by POST method, but by GET method, the input
  would be an URL. Another One is a mail box, like [EMAIL PROTECTED], 
  maybe that's not really an interface, just a input channel.
  So, there are 3 sources will be needed to handle. GET, POST and Mail box.

  Then , whatever GET, POST, or Detected mail arrival, they will write into
  a log for waiting handle. What the meaning of handle is to FAX it out.

  ===

  Problems  :

  Q1) For Get method, How can I get the whole content of an URL ( including 
  image and html  layout ) and save it to my temp directory ?

  Q2) For Detecting mail arrival, I can do this. But how can I fetch those attachment
  data (Excel, Word) and dump to my printer driver (actually WinFax) ?

  Q3) How can I detect how many attachment(s) in a mail ?  Because I would like
  to treat no attachment and attached more then 1 file as error.

  Q4) Refer to Q2, should I firstly split the attachemt file to a temp folder at first 
?
  If so, how can I PICK UP the attachment from the mail ?

  ===

  Any advice, module recommend, are very welcome.

  Thanks a lot,
  Connie in sick >_<''



Re: array of arrays :: part2

2002-07-05 Thread Connie Chan

Well, I don't know how to pick a reference like this... but I guess 
using a hash of array may also fulfill your job...
my @code = ('001', '002', '003', '004');
my @name = ('Joe', 'May', 'Bob', 'Foo');
my @birth= ('Jan', 'Feb', 'Mar', 'Apr');
my %Data = (Code=>\@code, Birth=>\@birth, Name=>\@name );
print $Data{Name}[2]; # So you get "Bob"

If you want to know what 'fields' inside %Data :
@DataKeys = keys(%Data);
print "@DataKeys"; # So you get "Code, Birth, Name"...
# However, the elements order in @DataKeys is not base
#on how's the order you create your key field in %Data.

If you want to know how many elements inside @DataKeys :
$total = $#DataKeys;
print $total;

rgds,
Connie

- Original Message - 
From: "Alex B." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 10:52 PM
Subject: array of arrays :: part2


> Hi,
> 
>  I've read http://webmaster.indiana.edu/perl56/pod/perllol.html and
>  this cleared some points. :)
> 
>  still I do have some problems... the assignment of values to arrays
>  in arrays works, but I gave the arrays in the array names:
> 
>  @array = \(@names, @school, @othercrap);
> 
>  so $array[2][3] would be some entry in @school...
>  ok, but is there a way of getting the name of @school by supplying
>  the number only?  like $array[2] < 
>  any ideas? (thanks in advance)
> 
> 
> 
> 
> --
> mfg
>  Alex  mailto:[EMAIL PROTECTED]
> 
> 
> -- 
> 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]




Check Mail then Fax

2002-07-04 Thread Connie Chan

Hi all, 

This is a mess now... I even have no concept on how to start.
I will working on something like this

There are 2 interface as input. One is a Web interface, which will accept
HTML tag and plain text by POST method, but by GET method, the input
would be an URL. Another One is a mail box, like [EMAIL PROTECTED], 
maybe that's not really an interface, just a input channel.
So, there are 3 sources will be needed to handle. GET, POST and Mail box.

Then , whatever GET, POST, or Detected mail arrival, they will write into
a log for waiting handle. What the meaning of handle is to FAX it out.

===

Problems  :

Q1) For Get method, How can I get the whole content of an URL ( including 
image and html  layout ) and save it to my temp directory ?

Q2) For Detecting mail arrival, I can do this. But how can I fetch those attachment
data (Excel, Word) and dump to my printer driver (actually WinFax) ?

Q3) How can I detect how many attachment(s) in a mail ?  Because I would like
to treat no attachment and attached more then 1 file as error.

Q4) Refer to Q2, should I firstly split the attachemt file to a temp folder at first ?
If so, how can I PICK UP the attachment from the mail ?

===

Any advice, module recommend, are very welcome.

Thanks a lot,
Connie in sick >_<''





 






Re: Concatenating names from form

2002-07-04 Thread Connie Chan

So what's your input ? and you's your supposed output ?

regards,
Connie in sick >_<



- Original Message -
From: "Paul Arsenault" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 04, 2002 7:48 AM
Subject: Concatenating names from form


> I want to be able to read in names from a web-based form and then take the
> first initial from the first name and concatenate it with the whole last
> name.  I can do everything except isolate the first initial in the first
> name.  Anyone know of an easy way to do this with a regex or reading the
> name into an array as individual characters and then using something like:
>
> $first_initial = $name[0];
>
> Thanks,
> Paul
>
>
>
> --
> 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: Random images on a bulletin board

2002-07-02 Thread Connie Chan

Hi May,

> if ($plup =~ m/(^\w\.gif\|^\w\.jpg)/ {
So... you forgot a ) at last before {
you may you may simpliy write in this way
if ($plup =~ /(\.gif|\.jpg)$/)

print "";
This is another dead point.

you should use \" inside the print "" statement... if you want
to use double quote inside (I 've mensioned =))
however, you may omit the quotes, (i.e. =100)
or you may use single quote ( i.e. ='100' )

But for your case, don't you want it as large as full screen ?
so you may use 100%. However, if you are using double
quote, or omit the quote within the print "" statement, you
have to write 100\%, otherwise, perl will looking for a hash...

Finally, it is EMBED, not EMB

Hope this help,
Smiley Connie =)

PS. You may run your script in shell ( perl yourscript.pl ),
before you go on with the web browser... So it will direct
tell you the syntax error at which line.. It saves your time
to debug


- Original Message -
From: "Troy May" <[EMAIL PROTECTED]>
To: "Beginners CGI List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 1:49 PM
Subject: RE: Random images on a bulletin board


> Ok, thanks for the advice.  It makes sense how to do it now.  I adjusted
the
> code a bit and it is throwing errors.  My regex might be screwed up? (I'm
> not very good with them)
>
> Here's the code:
>
> -code-
>
> @images =
> ("meth.jpg","pennywise.jpg","power.gif","nightshade.swf","pckiller.swf");
>
> srand(time() ^ ($$ + ($$ << 15)));
> $plup = rand(@images);
>
> print "Content-type: text/html\n\n";
> if ($plup =~ m/(^\w\.gif\|^\w\.jpg)/ {
> print "";
> } else {
> print "";
> }
>
> -code-
>
> See anything wrong with the regex or any reason it's throwing a 500 error?
>
>
>
>
> -Original Message-
> From: Connie Chan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 01, 2002 10:47 PM
> To: Troy May; Beginners CGI List
> Subject: Re: Random images on a bulletin board
>
>
> Emm. I don't exactly know what do you want,
> but try this if that's what you want:
>
> make an array to put your IMG files,
> make another array to put your SWF files.
>
> make a random 0, 1 to choose if you want to output
> as IMG or SWF
>
> if IMG, random a file from the IMG array,
> if SWF, random a file from the SWF array,
>
> if ($type = "img" ) { print "" }
> elsif ($type="swf") { print "" }
> ## you may set width=100\% and height=100\%
> else { print "Hi!" }
>
> Hope this help,
> Smiley Connie =)
>
>
> - Original Message -
> From: "Troy May" <[EMAIL PROTECTED]>
> To: "Beginners CGI List" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 02, 2002 5:41 AM
> Subject: Random images on a bulletin board
>
>
> > Hello,
> >
> > I'm trying to make a random signature for use on bulletin boards.
Images
> > are fine, they are set sizes.  But I'm trying to make it display Flash
> files
> > also.  These Flash files default to full-screen when there are no size
> > limits set.  I can't figure out how to adjust this script to display
> images
> > AND Flash files.  Here's part of the script:
> >
> > ---
> > $basedir = "http://www.mysite.com/sigs/";
> >  @files =
> >
>
("Night1.jpg","Night3.jpg","Nightshade5.jpg","Kimme2s.jpg","Amazsig.gif","Ni
> > ghtshade1.jpg");
> >
> > srand(time ^ $$);
> > $plup = rand(@files);
> > print "Location: $basedir$files[$plup]\n\n";
> > ---
> >
> > This works with just these images.  But these .swf files have to be
> limited
> > to 100x100 through HTML.
> >
> > Any ideas, or is this impossible?
> >
> > Troy
> >
> >
> > --
> > 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]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002
>
>
> --
> 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: Perl CGI FORM statement

2002-07-02 Thread Connie Chan

So... I've viewed your code...  the only problem is you used so may
""
In case, one is enough and all ( just for your case )

However, that's not the Perl stuff, but HTML prob.,
So I only explain it short =)

You can finish your whole script like this, actually the
framework should be looking like this...













>
> --- Maureen E Fischer <[EMAIL PROTECTED]> wrote:
> > Hello,
> > My question is about CGI's form statement.  I
> > wrote a program that
> > outputs
> > three fields.  Two of the three are fields from
> > which one option is
> > selected.  The
> > number and type of options presented are based on
> > the user identified in
> > the environmental variables.
> > I got the screen to print out correctly, but
> > when the submit button
> > is pressed the only information that is passed to
> > the next program is
> > the information from the last FORM statement that I
> > output.  So I am
> > thinking that I have to somehow output all three
> > fields
> > in one form statement. If that is true then how is
> > this done when the
> > number of OPTIONs will vary.
> > Thanks,
> > Maureen
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
>
>
> =
> "Now it's over, I'm dead, and I haven't done anything that I want; or, I'm
still alive, and there's nothing I want to do." - They Might Be Giants,
http://www.tmbg.com
>
> __
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
> --
> 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: Perl CGI FORM statement

2002-07-02 Thread Connie Chan

Any sample ? and Source Code ?

Smiley Connie =)


- Original Message - 
From: "Maureen E Fischer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 12:24 AM
Subject: Perl CGI FORM statement


> Hello,
> My question is about CGI's form statement.  I wrote a program that
> outputs
> three fields.  Two of the three are fields from which one option is
> selected.  The
> number and type of options presented are based on the user identified in
> the environmental variables.
> I got the screen to print out correctly, but when the submit button
> is pressed the only information that is passed to the next program is
> the information from the last FORM statement that I output.  So I am
> thinking that I have to somehow output all three fields
> in one form statement. If that is true then how is this done when the
> number of OPTIONs will vary.
> Thanks,
> Maureen
> 
> 
> 
> -- 
> 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: Random images on a bulletin board

2002-07-01 Thread Connie Chan

Emm. I don't exactly know what do you want,
but try this if that's what you want:

make an array to put your IMG files,
make another array to put your SWF files.

make a random 0, 1 to choose if you want to output
as IMG or SWF

if IMG, random a file from the IMG array,
if SWF, random a file from the SWF array,

if ($type = "img" ) { print "" }
elsif ($type="swf") { print "" }
## you may set width=100\% and height=100\%
else { print "Hi!" }

Hope this help,
Smiley Connie =)


- Original Message -
From: "Troy May" <[EMAIL PROTECTED]>
To: "Beginners CGI List" <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 5:41 AM
Subject: Random images on a bulletin board


> Hello,
>
> I'm trying to make a random signature for use on bulletin boards.  Images
> are fine, they are set sizes.  But I'm trying to make it display Flash
files
> also.  These Flash files default to full-screen when there are no size
> limits set.  I can't figure out how to adjust this script to display
images
> AND Flash files.  Here's part of the script:
>
> ---
> $basedir = "http://www.mysite.com/sigs/";
>  @files =
>
("Night1.jpg","Night3.jpg","Nightshade5.jpg","Kimme2s.jpg","Amazsig.gif","Ni
> ghtshade1.jpg");
>
> srand(time ^ $$);
> $plup = rand(@files);
> print "Location: $basedir$files[$plup]\n\n";
> ---
>
> This works with just these images.  But these .swf files have to be
limited
> to 100x100 through HTML.
>
> Any ideas, or is this impossible?
>
> Troy
>
>
> --
> 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: HTML contents into Perl CGI

2002-06-30 Thread Connie Chan

So where do you "print out the data" ?
In a console ( shell or dosprmpt ) ? or as a html page ?

If that's the first case, it should not be happened unless you do something
to elimate the \n operator If the second case, assum you should know,
HTML will not auto break line even in your souce is. So you better use

print "$data"

or

$data =~ s/\n//g;
print $data




- Original Message -
From: "jmpond" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 30, 2002 5:31 AM
Subject: HTML  contents into Perl CGI


Hi,

If this has been answered before please direct me there as I am at a loss as
to where to look as there is so much info to plow thru.

Situation:  I am reading into my script via param() a textarea called Job
Duties.  When I print out that parameter in perl all of the new lines are
ignored and it prints as one long string.

Q: How do I get the perl print statement to recognize the new lines so that
the printed output looks like the html input screen?

Perhaps the print statement is the wrong thing to use but.

I've been looking at regex's and the split function and have been able to
determine that there are infact newlines in the data but they are being
ignore when I print out the data.

Any assistance would be great.

Thanks.

Joe Pond

[EMAIL PROTECTED]



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




Re: What is wrong? (LWP::Simple)

2002-06-26 Thread Connie Chan

How about LWP::UserAgent ?

Besides, did you make the  in your index.html ?
( I don't know if this is nessary or not, but I always get the right
result with  and the file.html as a full path)

And Umm Is the "Page cannot be found" Comes up by your
server ( Standard 404 ), or Explorer Error, or your script ?
Normally, if a scripts take a long time to run, but not handling
a big file, it's likely be you script cannot be run properly...
So, do you confirm #!/perl/bin/perl -W is the right place for your
Perl compiler's loc declaration ? For my Apache, I have to type
#!C:/Perl/bin/Perl.exe -wT

To test is, you may go to dosprompt and type
perl c:\yourscriptpath\yourscrip.pl



- Original Message -
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 26, 2002 8:36 PM
Subject: What is wrong? (LWP::Simple)


> Hi all,
>
> The following script works under Apache 1.33 and Apache 2.0.36, but it
> doesn't work under Apache 2.0.39.
> Can you tell me why?
>
> It is a simple script which tests if the main page from localhost exists
or
> not.
> The script tells me that the Page can't be found. ... after a long time of
> "Opening page..."
> It seems that the new Apache is bad. Is it true?
>
> #!/perl/bin/perl -W
>
> use LWP::Simple;
>
> print "Content-type: text/html\n\n";
>
> my $path = "http://localhost/";;
>
> if (head($path)) {
> print "The page is there";
> }
> else {
> print "The page cannot be found";
> }
>
>
> Teddy,
> My dear email address is [EMAIL PROTECTED]
>
>
>
> --
> 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: text/plain versus text/html

2002-06-26 Thread Connie Chan

Well... what's the rest of your .shtml file ?
did you put a  ?

- Original Message -
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 26, 2002 10:11 PM
Subject: text/plain versus text/html


> Hi all,
>
> Can you tell me what should I put in an SHTML file to show like text/html
> and not as text/plain?
>
> if I use:
>
> use LWP::Simple;
> print head(http://localhost/index.shtml);
>
>
> This prints:
> text/plain; charset=ISO-8859-1Apache/2.0.36 (Win32)
>
> I have problems because of this fact with a web crawler.
>
> In my index.shtml file I have:
>
>  "http://www.w3.org/TR/html4/loose.dtd";>
>   Title
> 
>
> If I change the name of the file to index.html, it tells me that the file
is
> text/html.
>
> Thank you.
>
> Teddy,
> My dear email address is [EMAIL PROTECTED]
>
>
>
>
> --
> 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: Can someone tell me what I did wrong with this?

2002-06-22 Thread Connie Chan

Seems that you missed a line to capture the $ENV{QUERY_STRING};
such as : ($ignore, $body) = split (/=/, $ENV{QUERY_STRING});
when (! $body), your if and elsif statements will not be run.


- Original Message -
From: "Kyle Babich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 22, 2002 8:52 PM
Subject: Can someone tell me what I did wrong with this?


I'm a beginner.  The following is what I wrote:



#!/usr/bin/perl
print "Content-type:text/html\n\n";

@days = ("Sunday","Monday","Tuesday","Wednesday","Thursday",
   "Friday","Saturday");
@months = ("January","February","March","April","May","June",
 "July","August","September","October","November",
 "December");

($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$year = $year + 1900;

if ($body eq "yahoo") {

print "http://www.yahoo.com/\";>Yahoo\n";

} elsif ($body eq "date") {

print "$days[$wday] $mday $months[$mon] $year\n";

}




I uploaded it and it works without giving me a 500 and when I check the
syntax via the shell it says everything is correct so why when I go to
test.cgi?body=yahoo or test.cgi?body=date the pages just appear blank
instead of showing the content?

Here are the urls:
http://kb2.net/cgi-bin/test.cgi?body=yahoo
http://kb2.net/cgi-bin/test.cgi?body=date

Can someone tell me what I did wrong?

Thank you

--
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]




Need module recommandation

2002-05-15 Thread Connie Chan

Hi everybody,

Is there any module can advise me to use for developing
image counter ? 

Thank you very much,
Connie



Re: Multi thread ? Programming Style ? [with update]

2002-04-26 Thread Connie Chan

Thousand Thanks, John,

At lease I get the idea on what I am doing is correct.

"perl -d" is very useful for tracing errors, better than log down
activities.
and I've test it and found that the "while (! -e $result) is not nesssary,
the
case is actually A to B, B to C, C to D, and D gen reult, then
D ret null to C , C ret null to B, B return null to A,
and then the open, print, unlink statements.

What about fork ? In such case, would it be better ? or even making more
trouble ? I've read about perldoc, but still not very clear, what are the
zombie means ? doesn't those vars be removed if the script run once
only ?

Have a good day =)
Connie


- Original Message -
From: "John Brooking" <[EMAIL PROTECTED]>
To: "Connie Chan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 12:44 AM
Subject: Re: Multi thread ? Programming Style ?


> See comments below.
>
> --- Connie Chan <[EMAIL PROTECTED]> wrote:
> > Now, I have a CGI script which using GET method to
> > receive Query,
> > and my script looking like this :
> >
> > 
> > # C:/PERL/BIN/PERL.EXE
> > # script name : QUERY.PL
> >
> > require "my_external_scripts.pl";
> >
> > $query = $ENV{QUERY_STRING};
> > $result =
> >
> time."_".$ENV{REMOTE_ADDR}.$myPackage::random(9);
> >
> > &call_query_string_handler($query, $result);
> > while (! -e $result) { 1 }
> >
> > open (FILE, $result) ;
> > while () { print $_ }
> > close (FILE);
> > unlink($result)
> > 
> >
> > In case, I am trying to enforcing the script unable
> > to terminate
> > until the result file comes. And the result file
> > will be built when
> > all the child process are done.
> >
> > my questions are :
> >
> > 1. When 2 or more users are querying the same script
> > with the same query
> > at the same time, would the script handle it with
> > 'another colsole'? or
> > involving to wait until the first in query has done
> > ? How about the child subs?
>
>   The standard situation is that each request that
> comes in starts up a new and completely separate
> process, which is what I assume you mean by 'console'.
> There is no interaction between them. If your server
> is running some additional software such as FastCGI or
> mod_perl, then it may not start up a new process, but
> I still think that each multiple invocation is
> independent of the others.
>
>   So if two users are invoking this script, then both
> users will be sitting waiting for the files to come
> in. When they do, then both processes and their
> subroutines will continue independently of each other.
>
> > 2. Is it a bad programming style ?  Straight line
> > running, Sub scripts are working
> > as self operating.  Main will call A, A will call B,
> > B will call C, C will call D, and D
> > gen the result,  no value will return to 'the
> > caller'.  I can imagine that might quite
> > a problem for tracing errors, so I designed each sub
> > script will log down their
> > activities on common log file with, A,B,C and D.
> > Would it be better ?
>
> If you are asking about if your use of modularization
> (splitting the code up in routines A, B, and so on),
> it's hard to say without seeing what all the code
> does. For tracing errors, check out the Perl debugger
> (perl -d). It will follow calls to different modules,
> so that's not a concern.
>
> In terms of modularization in general, I think I could
> probably condense the thought process I apply when
> designing my own program structure to the following
> guidelines:
>
>1) Simpler is better. Introduce no more complexity
> than necessary. Additional complexity may be justified
> by either of the following considerations.
>
>2) As soon as a bit of code is re-used in more than
> one place, consider making it a subroutine. If I see a
> program that has similar code copied and pasted more
> than 3 or 4 times, even with slight variations, I
> conclude that its author is a bad (ok, maybe just
> inexperienced) programmer. (Up to 3 or 4 times I could
> accept as mere laziness.) If you can replace all those
> variations with a single subroutine with parameters,
> your code will have fewer bugs and your maintenance
> will be much easier.
>
>3) Even if you are coding something for the first
> time, if it is something you could see yourself
> re-using, and it's not too much more work to make it
> g

Multi thread ? Programming Style ?

2002-04-24 Thread Connie Chan

Now, I have a CGI script which using GET method to receive Query, 
and my script looking like this :


# C:/PERL/BIN/PERL.EXE
# script name : QUERY.PL

require "my_external_scripts.pl";

$query = $ENV{QUERY_STRING};
$result = time."_".$ENV{REMOTE_ADDR}.$myPackage::random(9);

&call_query_string_handler($query, $result);
while (! -e $result) { 1 } 

open (FILE, $result) ; 
while () { print $_ }  
close (FILE);
unlink($result)


In case, I am trying to enforcing the script unable to terminate
until the result file comes. And the result file will be built when
all the child process are done.

my questions are :

1. When 2 or more users are querying the same script with the same query
at the same time, would the script handle it with 'another colsole'? or 
involving to wait until the first in query has done ? How about the child subs?

2. Is it a bad programming style ?  Straight line running, Sub scripts are working 
as self operating.  Main will call A, A will call B, B will call C, C will call D, and 
D 
gen the result,  no value will return to 'the caller'.  I can imagine that might quite 
a problem for tracing errors, so I designed each sub script will log down their 
activities on common log file with, A,B,C and D. Would it be better ?

Any comment and/or hints are very apperciate. At lease, please tell me
how to test it by myself ^_^"

Thanx alot,
Connie



A super huge form.

2002-04-20 Thread Connie Chan

Hi all, would anybody know how to handle a form with 
about 6000 around data field ? and if there any max size
for data submit through CGI ?
Anyway, I don't want to use cgi.pm.

Thank you for any hints and advise =)
Connie



strict problem

2002-04-09 Thread Connie Chan

Dear all, 

I have this statement 
if ( $ENV{REQUEST_METHOD} eq "GET")
{
...
...
}

That works fine if I don't use -w , but if I use  -w, 
it tells "Use of uninitialized value in string eq at."
why ? Is that related to declare it first such as :

my $req = $ENV{REQUEST_METHOD};

Thanks for advise, 
Connie



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




Re: IP Address

2002-04-04 Thread Connie Chan

Why don't simply use cookie ? or when a page is open, redirect to :
youscript.cgi?ip=xxx.xxx.xxx.xxx&whateverParams=whateverVar
(you may use your way to encrypt ip & the ip address)
Or if you want to avoid duplicate click on Submit, you can use javascript
to disable the submit button when it clicked once.


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




Re: netscape problem !!!

2002-04-01 Thread Connie Chan

You may try this as header :

print "Content-type: text/html\n\n";

- Original Message -
From: "Aman Raheja" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 1:13 AM
Subject: netscape problem !!!


> Hi all
> I have created a cgi-perl script for a web-site. I am using cookies and
> mysql for database on a Linux box.
> When my page is called in IE, it works great, but Netscape throws out the
> whole HTML code.
> Now, if I copy this code and save it in a file as xyz.html, it works
perfect
> in Netscape. I think if the HTML code had been imperfect it would have the
> same problem, but that's not the case.
> Please help
> Thank you
> Aman
>
> _
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> 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: Another strange idea

2002-03-26 Thread Connie Chan

Hmm. I guess it is not possible.
First, when a file want to upload, the input type should be FILE, not
HIDDEN, not TEXT.
Second, when input type is FILE, I found that this is unable to make preset
value.
Third, the sequency for the ftp is file uploaded first, give the name at
last.
Am I right ? =)

Have a nice day,
Connie


- Original Message -
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 12:27 AM
Subject: Another strange idea


> Hi all,
>
> I am just a beginner, not a hacker, but an idea came to my mind.
>
> If I make a script for uploading files, it will result a variable with a
> path to that file that user choose.
> When the visitor will submit the form, I can modify the  path to point to
> another file. Is it true?
>
> And she could upload another file without knowing this.
>
> Is this a security whole?
>
> Thank you.
> Teddy,
> My dear email address is [EMAIL PROTECTED]
>
>
>
>
> _
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
>
> --
> 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: Problem in running CGI script with PWS server

2002-03-26 Thread Connie Chan

Is that PWS in terms of  Personal Web Server by MS ?  If I didn't remember
it wrongly,
you can't run perl script there, but ASP instead.

Anyway, if you try to run CGI, I would like to tell the CGI-BIN is just the
location
where your scripts are putting in ( Maybe a virtual directory, depends on
your server
setting. ).and you have to tell where is the compiler at the first line in
your script
eg. #!C:/Perl/bin/perl.exe

Finally, I would like to tell that PWS is not a good server, try Apache if
you can =)

Have a nice day,
Connie

- Original Message -
From: "Ng Yuen Soo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 5:29 PM
Subject: Problem in running CGI script with PWS server


> Hi,
>
> I am a newbie, setting up a test web server on Win98 with Activeperl
> Complier.  Apparently, the CGI-BIN is finally working but the browser IE
6.0
> does not execute the *.cgi with activeperl.  It merely just displays the
> content.
>
> How do I get the PWS to associate .cgi with Activeperl?
>
> Thanks!
>
>
>
>
> --
> 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]




Sort of Conceptual, Syntax, and modules related questions

2002-03-22 Thread Connie Chan

Dear All, 

I have sort of questions, would you please give me some hint, even refering me to a 
perldoc would be nice too.

1. When I open a text file with *lines, however, I just want to read the first line, 
would this be a good idea ?
open (FILE, "textfile.txt"); $firstline = ; close (FILE);
would this process run till EOF, or terminated after read $firstline ?

2. I am using Win32 system , would you tell when is \n apprear and when is \r\n 
apprear ?
What about this when dealing with binary files ?

3. Is this different for this 2 scripts ?
version 1 :  sub any { for (@data) { my ($a, $b) = split (/=/, $_) } return 1 }
version 2 :  sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split (/=/, $_) } 
return 1 } 

4. Is that reading binary data faster then reading text file ?

5. How can I write multiple line if remark like /* and  */ pairs, instead of using # 
at every line ?

6. Is that any syntax for local call about  'use' and 'require', so as something like 
'not require', 'not use' expressions ?

7. Would you give me some short examples for //e, and //g ? I am confused for their 
usuage.

8. Any modules can help to check connecting threats for a certain page ? or if I run 
$alive = `ping $ip` a good idea ?

9. Any modules can help to read and write the ID3vX for mp3 files ?

Any ideas and respond will be very very helpful. Really urgent for a project 
design and development.
Thank you very much =)

Connie



Sorry for off topic, please reply as interested, and off list....

2002-01-11 Thread Connie Chan

now, I am writing a script which to let user modify the password of
their email account automatically, but our email server will encrypy 
the password in some ways. so it makes me unable to cmp or write.

such as, if I give "A" as a new pass, it encrypted as QQ== in the user's profile.
if I give "AA", it encrypted as QUE=
if I give "AAA", it enctypted as QUFB
if I give "B", it change to Qg==
if I give "BB", it change to QkI=
if I give "BBB", it change to QkJC

any expert can help me to accomplish this un-encryption,  or give
me some ideas on how to make this up ? I've tried to think from 
ascii code, change ascii from bin, hex, oct, dec. and analysis what
is varying... but I got nothing related... Thank you very much for any help

Again, I am aplogize for this off topic question.



Sorry, just Testing...

2002-01-05 Thread Connie Chan





Re: Refreshing a Guest Book type page

2002-01-04 Thread Connie Chan

As no code here, so I only raise idea according to my experience =)

The possible output for a guest book are :
1. Thank you page
2. The same page as the guest book (but resulting on the process
of POST)
3. Redirect to the page same as the guest book(By GET method)

If case no. 1 , you may add another file with log on IP address and
sign Time. When a next sign is active, compair the IP and sign time
pairs along the log file. So if the sign time and IP are match, and the
time difference is shortern than a certain time period, than don't do
the sign(write) progress, but returning to some other page.

If case no. 2, you better re-write the result process, It's not a good
idea anyway.

If case no.3, you could make a time comes with the url.
suppose before sign, guest is visiting http://somesite.com/guest.pl?page=0
and after sign, direct to http://somesite.com/guest.pl?page=0&1231203201231
People behavior on RELOAD a page mostly because can't see what they sign.
with this, cache will not affecting the result, they must see what they
sign. (if no
problem with your script)

have a nice day =)


- Original Message -
From: "Troy May" <[EMAIL PROTECTED]>
To: "Beginners CGI List" <[EMAIL PROTECTED]>
Sent: Friday, January 04, 2002 3:58 PM
Subject: Refreshing a Guest Book type page


> Hello,
>
> I don't have a working example, this is for a friend.
>
> He says he has a guest book set up on his site.  All is fine with it.
> People submit their entry, it takes you to a view page (dynamic, from the
> Perl program) where it shows you all the entries.  But he says when people
> refresh that page, it posts the same message AGAIN.  And it will keep
doing
> that over and over.
>
> What can he put in his Perl code to make it stop doing that?  So when
people
> refresh the screen, it doesn't post their message again?  It sounds like
> it's just keeping their message stored in the program's memory and
> refreshing that page makes it post again, but I'm not really sure how to
> make it stop.
>
> Thanks in advance for any help.
>
>
> --
> 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: A little off topic, but still deals with CGI, just the results.

2001-12-30 Thread Connie Chan

^M means you want to find a string that "start with M".
if you want to cut ^M as a space, maybe in this way;

s/\^M/ /g;

- Original Message -
From: "Brian N. Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 31, 2001 4:42 AM
Subject: A little off topic, but still deals with CGI, just the results.


> When save to a file, I have a bunch of "^M" characters .. I wrote a little
> strip to try to get rid of them, but of course, I tried the ^M instead of
> whatever I should have had done ... any help?
>
> #!/usr/bin/perl
>
> open (myFile, " open (myOut, ">out_file");
> while ()
> {
> s/^M/ /g;
> print myOut $_;
> }
> close myFile;
> close myOut;
>
> That is what I have now ... what I should I actually be looking for?
> Obviously it is not the ^M, because it still exists.
>
> Thanks,
>
> Brian.
>
>
> --
> 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]




I need some concepts about binmode

2001-12-30 Thread Connie Chan

Yet. I still don't know how to handle binary data with perl..
I just made a text file with Pascal... It sound read write are quite
easy.. but in perl... I have read some examples. it is require
for use binmode(MYFILE) ; then the read is require something 
say as buffer size... What are they actually ? Would anybody tell
me how to handle binary data ?



re-convert

2001-12-19 Thread Connie Chan

Since we know this :  $string =~ s/([a-fA-F0-9][a-fA-F0-9])/pack ("C",
hex($1))/eg;

is a statement which can converting back the "real string" from
a form field, but, could anybody tell how to convert the "real string"
to the "long long" string ??

Besides, anybody can tell what is the exactly meaning of : ("C", hex($1)) ?



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