Re: Perl with Ajax issue

2019-08-13 Thread David Dorward

On 12 Aug 2019, at 19:45, Matt Zand wrote:


use CGI;


Do read [CGI: CGI.pm has been removed from the Perl core][1]

Should I install Perl on the server or does it come with Apache 
package.


Apache HTTPD does not include a Perl distribution although some 
third-party bundles include both Perl and Apache HTTPD.


You would also need to configure Apache so it will run the Perl program 
through the perl runtime.



I am getting no response.


If you are getting no response at all, then your problem is unlikely to 
be related to a lack of Perl. That would cause it to return an error 
response.



[1]: 
https://metacpan.org/pod/distribution/CGI/lib/CGI.pod#CGI.pm-HAS-BEEN-REMOVED-FROM-THE-PERL-CORE

Re: cgi development environment

2012-09-19 Thread David Dorward
On 18 Sep 2012, at 13:34, Chris Stinemetz  wrote:
> I am very interested in cgi scripting. I have only used php for web
> development in the past.

CGI or Perl? For a long time CGI with Perl was a popular combination so there 
are a lot of documents which conflate the two.

It is possible to do CGI programming in PHP (which you already know), but 
PSGI[1] is the flavour du jour for server side web programming with Perl.

CGI is still a plausible option though. It has the benefit of simplicity (but 
isn't the most efficient option).

[1] http://plackperl.org/


-- 
David Dorward
http://dorward.me.uk


--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: how to change apa...@mydomain.com to myn...@mydomain.com for emails sent out

2010-02-27 Thread David Dorward

On 25 Feb 2010, at 19:17, kitty wrote:
> Even though I can change the sender full name from Apache to MyName
> for the emails sent out from the server. But in the email header
> details, it still shows from apa...@mydomain.com instead of
> myn...@mydomain.com.
> 
> The code in perl that I use is:
> open (MAILHANDLE,"| mail $address -s \"$subject\" -- -F MyName \n");

Use an abstraction layer: http://search.cpan.org/perldoc?Email::Sender

http://search.cpan.org/perldoc?Email::Sender::Manual::QuickStart has an example 
of what you want to do.

-- 
David Dorward
http://dorward.me.uk


--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Logout from Apache

2009-03-19 Thread David Dorward

Naji, Khalid wrote:

How can I logout via a perl-script from Apache?
  

That depends on the authentication method used.

Usually it just comes down to "Stop sending your authentication data or 
token with each request".


--
David Dorward
http://dorward.me.uk/

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Login code

2009-01-08 Thread David Dorward

Brent Clark wrote:

Would anyone have any example code of sessions for logins.


CGI::Session has some example code:

http://search.cpan.org/~markstos/CGI-Session-4.40/lib/CGI/Session.pm

If you want to use the Catalyst framework, their tutorial has a section 
on handling logins with sessions:


http://search.cpan.org/~hkclark/Catalyst-Manual-5.7016/lib/Catalyst/Manual/Tutorial/Authentication.pod

--
David Dorward
http://dorward.me.uk/

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: embedding a CGI script in a HTML page?

2008-12-16 Thread David Dorward

Adam Jimerson wrote:

Correct me if I am wrong but these template systems seem to only handle
output from the CGI script, which would be nice if my scripts only
handled output but they also need user input

1. Browser sends input data to server

2. Server sends input data to program using CGI interface

3. Program does something (possibly with the data) and generates output data

4. Program passes output data to template

5. Template places output data into some HTML (or whatever)

6. Template passes HTML combined with output data to the program

7. Program outputs HTML combined with output data to server using the 
CGI interface


8. Server sends output HTML back to the browser

Templates are used because it is easier to edit HTML in a template then 
it is to edit Perl that generates HTML.


--
David Dorward



--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: embedding a CGI script in a HTML page?

2008-12-16 Thread David Dorward

Adam Jimerson wrote:

No I am letting CGI.pm generate the HTML for me, I figured that it would
be the easiest way to do it.
  
Most people find that templates are simpler for most purposes (since 
they can then just write HTML and say "Insert data here" rather then 
describing every element in Perl).



- From what I see in the tutorial,
http://template-toolkit.org/docs/tutorial/Web.html#section_Dynamic_Content_Generation_Via_CGI_Script,
the Templete Toolkit only outputs information from the script, but I
need it to handle input as well
You use Perl to handle the input. TT is just for making it easy to write 
the output.


I've just remembered this simpler example:
http://github.com/dorward/simple-ajax-demo/tree/master

The script itself is at 
http://github.com/dorward/simple-ajax-demo/tree/master/webroot/demo.pl


Line 32 gets user input, in exactly the same way that CGI.pm would do 
(I'm using CGI::Fast for this, which is similar).


Line 33 uses that input to change what request gets sent to the database 
on ...


Line 42 (which) gets a list of messages from the database (much like a 
guestbook would).


Line 49 wraps it up in a hash.

Ignore lines 51 to 56, these output JSON instead of HTML.

Line 59 gives that hash to a template.

http://github.com/dorward/simple-ajax-demo/tree/master/templates/html.tt 
is that template.


Lines 15 to 21 of that template loop over the data and output HTML.

The rest of the template is plain, simple HTML which is easy to edit 
(and line 6 pulls a stylesheet in).


--
David Dorward
http://dorward.me.uk/

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: embedding a CGI script in a HTML page?

2008-12-15 Thread David Dorward

Adam Jimerson wrote:

I'm not trying to put perl code into the page, they way I have it now is
I have the page generated by my CGI script inside another page that is
using my CSS.  I've tried to have my CGI script directly handle my CSS
but it didn't work due to its limited support for CSS.  So now I'm
trying to find a better way to make my CGI script look like the rest of
my site, I'm guessing this is what Template Toolkit if I can figure out
how to do it, or if my solution is the best.
I've going to cover some basics here, so I apologise if its starting too 
low for you.


When a browser requests a URI, the server gets the content of that URI 
from somewhere and sends it back.


It might get it from a file, it might get it from somewhere else. In the 
case of CGI, it runs a program and returns that instead.


You need to edit the Perl program that is being called using CGI so it 
outputs the HTML that you want. (Including the  to the stylesheet 
you are using, there is no problem with support for CSS, since when is 
output is just HTML, that is comes from a program rather than a file 
isn't relevant).


We've no idea what method the program is currently using to determine 
what HTML is generated, so we can't tell you what needs to be done to 
edit it.


What we can tell you is that using Template-Toolkit is a good approach 
when it comes to writing this kind of system. When using TT the general 
approach is to:


(1) Gather up all the data you want into a Perl hash
(2) Tell TT to process a template using that data

TT then goes over the template (which might look something like: 
http://github.com/dorward/axford/tree/master/root/default.tt (sorry, its 
got a lot of legacy cruft in it, I'm in the process of cleaning it up) 
and replaces placeholders with the data (and has things to loop over 
arrays when you have repeated data).


--
David Dorward
http://dorward.me.uk/

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: embedding a CGI script in a HTML page?

2008-12-14 Thread David Dorward
Adam Jimerson wrote:

> Not exactly what I was looking for I meant like using an  or
>  tags, which I did try it out and using the  tags to
> embed works with Firefox 3 I don't know if it works for all browsers.

, but frames have issues. (And  for HTML is effectively
the same as an iframe, but less well supported.

> The reason why I posted is because I wanted my page to look like this
> http://vendion.dyndns.org/guestbook.html as opposed to the basic white
> page when viewed through /cgi-bin/guestbook.cgi.

Change the script to use a template that matches the design of the rest
of the site.

-- 
David Dorward   <http://dorward.me.uk/>

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi and ssh

2008-09-23 Thread David Dorward
Dermot Paikkos wrote:
> Hi,
>
> I have a cgi script that needs scp a file from one server to another. 
> Because the script runs under the httpd user
With suEXEC you can run that script (and only that script) under an
account you create with otherwise very limited privileges.

http://httpd.apache.org/docs/1.3/suexec.html

-- 
David Dorward
http://dorward.me.uk/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: sessions

2008-08-24 Thread David Dorward
JuneEarth wrote:
> How to make CGI sessions to be shared among multi-webservers? Thanks.

They have to use a shared data store for the session information. Using
a database for that would be one approach.

-- 
David Dorward   <http://dorward.me.uk/>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Question... I hope

2008-06-04 Thread David Dorward


On 3 Jun 2008, at 18:00, [EMAIL PROTECTED] wrote:


Ok, I'm uploading a file to a 3rd party. The file is being uploaded to
an https site with a cgi extension. The 3rd party finally provided me
with a snippet of their Perl code. They see the attempt coming
through, but there is no data. I understand how all this works... i
think there's just a dot i'm not connecting somewhere. PLEASE HELP...
Thanks in advance!!!

In my html file I have...
File: 




I'd suspect you aren't setting the enctype attribute in your form  
element correctly, but you didn't provide that bit of the code, so it  
is hard to say.


http://www.w3.org/TR/html4/interact/forms.html#h-17.3

You also appear to be using  (which is deprecated) where you  
should have a  and your HTML is invalid due to a missing start  
tag for a paragraph.


--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: .htaccess = .WWWaccess ?

2007-12-05 Thread David Dorward

On 5 Dec 2007, at 14:00, Praki wrote:

 I m working with the CGI for authentication.



bash-2.05b$ more .htaccess
AuthType Basic
AuthName  Cisco-CEC
AuthUserFile  /isaac/www/cgi-bin/pkolanda/authen/.htpasswd
AuthGroupFile /dev/null
Require valid-user


CGI doesn't seem to be involved, you appear to be using an internal  
feature of Apache to perform HTTP Basic Authentication. While it is  
possible to perform HTTP Basic Authentication using a CGI script,  
that isn't what you are doing.


You might have better luck on an Apache mailing list.


--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: first steps with mod_perl

2007-10-09 Thread David Dorward

On 9 Oct 2007, at 04:04, Marek wrote:

if I understand well, it is extremely difficult to make CGI.pm produce
valid html

My problem are the many  tags in the form - and the checked
instead of checked="checked" in the input-tags. But probably I am not
yet understanding CGI.pm?


It has been a long while since I tried generating HTML with CGI.pm  
(these days I lean very strongly towards Template-Toolkit), but I'd  
be surprised if it produced  since its either non-Appendix C  
conformant, nonsensical XHTML (a content-less paragraph) or its, in  
HTML, "Start of paragraph followed by a greater than sign" and using  
features marked as badly supported - avoid.


checked rather than checked="checked" is fine in HTML  
(checked="checked" is another of the "avoid this, its badly  
supported" features).


According to the CGI.pm documentation, it defaults to XHTML (so it  
should be outputting checked="checked") unless you use -dtd to  
specify an HTML 2.0 or 3.2 DTD. (Why not HTML 4.x I've no idea). You  
can also use the -no_xhtml pragma to turn off XHTML generation.


Turning off XHTML generation is generally a good thing: http:// 
www.webdevout.net/articles/beware-of-xhtml


... but I'll stick to Template-Toolkit

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Cant Display the image...

2007-09-06 Thread David Dorward

On 6 Sep 2007, at 13:03, jeevs wrote:

qx{chmod -R 777 /var/www/images/file.png};
print qq();


Your alt attribute is missing.

And the location of the file on the server's file system is not going  
to be the same as the path under the webroot. Otherwise you could go  
to http://www.example.com/etc/passwd on practically any system.



--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Cant Display the image...

2007-09-06 Thread David Dorward


On 6 Sep 2007, at 09:03, jeevs wrote:

 print "";


Where is the alt attribute?


yes i am creating a file in cgi directoy ..


Are you certain that is the current working directory?

If it is for CGI then it could well be set up to try to execute  
everything in it.



but instead of the image just a square box is displayed ..


So look at the server logs to see what the server thinks is happening  
when the image is requested.



--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: .pdf files in a perl cgi application?

2007-04-24 Thread David Dorward
On Tue, Apr 24, 2007 at 08:58:52AM -0700, Mary Anderson wrote:

>> (Please keep this on the mailing list)

No, really. Please keep this on the mailing list. You do that by
emailing beginners-cgi@perl.org rather than my private address.
 
> Its not a cgi "macro image" but a "cgi macro" image.

Oh. The img method of the CGI object.

> Just the image function that expands into the html  tag.

That's an HTML issue, not a CGI issue.

PDF files aren't images, and aren't supported by browsers as images.

> It won't accept .pdf files.

No, you could try an object element, but PDFs are not nice things to
view in a browser window at the best of times, embedded inside a tiny
frame in a page - eugh.

> Is there anyway the user can download a file through the web without
> opening it?

They can configure their client to not use the plugin.

You could also look at sending a content disposition of
attachment. http://www.ietf.org/rfc/rfc2183.txt

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: .pdf files in a perl cgi application?

2007-04-24 Thread David Dorward
(Please keep this on the mailing list)

Mary Anderson wrote:

> All I do with the files is to display them using the cgi.pm macro
> image.  Then the user can download them.  Do you know if this also works
> with a pdf file?  

What is a "macro image"? The phrase does not appear it the CGI.pm
documentation ( http://search.cpan.org/~lds/CGI.pm-3.29/CGI.pm ).



-- 
David Dorward   <http://dorward.me.uk/>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: .pdf files in a perl cgi application?

2007-04-23 Thread David Dorward
Mary Anderson wrote:
>I have successfully put .gif, .jpg , etc. images into my application.  A
> user has just sent me some .pdf files, which must be read with Acrobat
> Reader, I assume.

No, there are plenty of libraries for dealing with PDFs that are not
Acrobat Reader.

>  How would I work these into my application?

In what sense? There are plenty of things you /could/ do with PDF files
in a CGI app. What do you actually want to do?

-- 
David Dorward   <http://dorward.me.uk/>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: how to force html4 output

2007-01-11 Thread David Dorward
On Thu, Jan 11, 2007 at 02:49:31AM +0100, Oliver Block wrote:

> Can anyone tell me, if there is a way to force CGI.pm to deliver the
> html code with a DOCTYPE switch for HTML4 and not XHTML?

$ perl
use CGI qw/:standard -no_xhtml/;
print start_html(); (^D)
http://www.w3.org/TR/html4/loose.dtd";>
Untitled Document

 
Unfortunately it outputs Transitional rather then Strict, and I'm not
aware of any way to override that.

I've always been unimpressed by the CGI.pm markup generation
facilities, I find that its easy to craft something of decent quality
by using Template-Toolkit (or HTML::Template, or etc. etc. etc.).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Getting "Content-Type: text/html; charset=ISO-8859-1" strings in my pages :(

2007-01-09 Thread David Dorward
On Tue, Jan 09, 2007 at 09:17:40AM +, peter church wrote:

> I start the program with this
> my $handler = new CGI;

use strict! use warnings! (and you probably want Taint mode on as well).
 
> print $handler->header("text/html");
> print $handler->start_html("Configurations");

I'd avoid the CGI.pm functions for generating HTML (except _possible_
form controls). They have some oddities (such as, in the version
installed on the server I just did a test with, generating invalid
XHTML 1.0 Basic).

> print $handler->startform("GET","http://${server_name}${script_name}";,
> "text/plain");

text/plain? That isn't an acceptable
value. http://www.w3.org/TR/html4/interact/forms.html#adef-enctype

> When I call the script the first time all is well however when I hit the
> submit button and the second form loads I get  "Content-Type: text/html;
> charset=ISO-8859-1"
> strings :(

I haven't a clue why you would get that. You haven't provided enough
of your script.
 
-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: About MVC framework

2006-12-20 Thread David Dorward
On Wed, Dec 20, 2006 at 04:54:15PM +0800, Wan wrote:
> I'm looking for a MVC framework that fast in develop and run. and I
> don't want to build it myself, please recommend someome.

http://search.cpan.org/search?query=MVC

(Catalyst is probably the most popular option these days. It gets a
lot of buzz, at least.)

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: stuffing the document header

2006-12-06 Thread David Dorward
On Tue, Dec 05, 2006 at 07:03:46PM -0700, David Bear wrote:
> Are there other methods to stuff arbitrary html elements into the head
> section?

You could use a template engine (Template-Toolkit is my preference,
HTML::Template is also popular, there are other options) instead of
generating HTML from Perl.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Store and retrive binary content via perl-cgi

2006-11-16 Thread David Dorward
On Thu, Nov 16, 2006 at 04:53:16AM -0800, cool planet wrote:

>   how it would be possible to download and upload images,videos
>   etc from perl cgi into and from mysql database?

Yes

>   can i have any helpful url ?

http://search.cpan.org/~lds/CGI.pm-3.25/CGI.pm#CREATING_A_FILE_UPLOAD_FIELD
http://search.cpan.org/~timb/DBI-1.53/DBI.pm
http://search.cpan.org/~danieltwc/DBIx-Class-0.07002/lib/DBIx/Class.pm

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: download java applications

2006-11-10 Thread David Dorward
On Fri, Nov 10, 2006 at 03:05:48AM -0800, cool planet wrote:

> How , it is possible to download java applications (jad/jar) via
> perl - cgi ?

It is no different from downloading any other resource.

> can i see few examples ?

http://search.cpan.org/~gaas/libwww-perl-5.805/lib/LWP.pm

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Headers("Location") in Perl??

2006-11-04 Thread David Dorward
On Sat, Nov 04, 2006 at 11:12:51PM -, Richard Bagshaw wrote:
> This may be an obvious question but I am new to perl and I need some
> advice.  Basically I have written a script that makes some changes to a
> database when a drop down is selected, after this is done I then want to
> goto another page in my system.  In php I could use the
> header("Location: www.blah.com") todo this, is there anything like that
> in perl?

You can just print them directly (since CGI expects headers followed
by a blank line followed by message), or CGI.pm has a header method.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: CGI Scripts and IE

2006-09-25 Thread David Dorward
On Mon, Sep 25, 2006 at 10:53:15AM -0400, Shawn Hinchy wrote:
> Everything works fine in Mozilla/Firefox but when I try to use IE 6,  
> it doesn't seem to call the script when the submit button is pressed,  
> kind of like it knows it is already loaded and just reloads it from  
> cache.  Is this possible?  How do I overcome it?

> The script acts differently whether it is called with no parameters or  
> whether it is called after the submit button press and has parameters  
> (action=validate, etc).

I'd /guess/ that you have something like Bar, and you are testing for
$q->param('foo') eq 'baz' and falling over IE's problem of sending
"Bar" as the value.

... but you haven't provided anywhere near enough information about
the problem to say for sure. Real URL? HTML? Perl?

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: What is the reason for different outputs for a cgi script run from a browser and run from the command line?

2006-06-20 Thread David Dorward
On Tue, Jun 20, 2006 at 10:25:33AM +0200, sfantar wrote:
> Why are there differences between the output of the CGI mentioned below 
> which displays the content of $ENV{HOME} et $ENV{PATH}?

The environment the webserver runs is different to the environment
your shell runs.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to do a static variable that persists from page to page

2006-04-28 Thread David Dorward
On Fri, 2006-04-28 at 14:27 -0400, Jay Savage wrote:

> POST and GET aren't CGI...at least not exactly. They're part of the
> HTML spec, and deal with what happens when you click the submit button
> on an HTML form.

No, they are part of HTTP, not HTML.

> GET appends the form elements to the url, POST embeds
> them in the body of the transmission.

Well. Ish. That describes how form data is transmitted with POST and
GET, but there is a little more to it than that.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3

> Sorting them out is the job of the server, not the CGI program; CGI.pm could 
> care less.

The server just dumps the data into the CGI, either as environment
variables or through STDIN. CGI.pm cares very much about how the data is
formatted, it decodes it for you.

> Values of GET and POST requests are accessed by your CGI program in 
> exactly the same way: $q->param{'param'}.

Because CGI.pm is quite smart.

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Data from web form

2006-04-20 Thread David Dorward
On Thu, 2006-04-20 at 18:49 -0600, Scott wrote:
> I am accepting data from a form via the post method. At this time I do not
> have a database server to use with it and need to write to flat files.
> 
> Is there a way to get the results of the data without getting all the +'s
> and various special characters that replace spaces and ', and such?

Use the CGI module.

perldoc CGI

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: catching multiple values

2006-04-18 Thread David Dorward
>   
> and I need to catch all the values of this list but, if I write:
>   $legenda = $pagina->param("legenda");
> the variable $legenda is equal only to the first selected item.
> I read the cgi perldoc, but I cannot locate the answer to may question.

   FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER:


   @values = $query->param('foo');

 -or-

   $value = $query->param('foo');

   Pass the param() method a single argument to fetch the value of
   the named parameter. If the parameter is multivalued (e.g. from
   multiple selections in a scrolling list), you can ask to
   receive an array.  Otherwise the method will return a single
   value.


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: redirect - CGI

2006-04-11 Thread David Dorward
On Tue, Apr 11, 2006 at 10:05:15AM -0300, Augusto Flavio wrote:
> #!/usr/bin/perl
> use CGI qw/:standard/;

Seems to be missing a use strict and use warnings here.

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

You end you HTTP headers here (by printing two new lines).

> print redirect('http://www.yahoo.com');

Then you send more HTTP headers here, and your script probably
shouldn't be outputting a content-type header if its redirecting, let
the server handle that side of things.

#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $cgi = CGI->new();
print $cgi->redirect('http://www.yahoo.com');

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: C++ query with mySQL

2006-04-09 Thread David Dorward
On Mon, 2006-04-10 at 10:02 +0500, Sara wrote:
> Calling the categories starting with PHP and Perl didn't cause any issue, but 
> when I called the Categories
> starting with C_and_C++, nothing was shown because CGI.pm was removing the 
> characters ++.

> I replaced the All ++ in the mySQL database with ASCII ++, so now the 
> categories are in the DB are:
> C_and_C++/Ad_Management

The "+" character has no special meaning in HTML, so you don't need to
represent it with HTML entities unless it doesn't exist in the character
encoding you are using (which is unlikely).

> And now when I am calling the script:
> http://mysite.com/cgi-bin/index.cgi?cat=C_and_C++/Ad_Management

However, the "+" character _does_ have special meaning in URLs - it
represents a space character. You should URL encode the data you pull
from the database. The URI::Escape module can help with this.

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: FTP from my web ssite question

2006-03-14 Thread David Dorward
On Mon, Mar 13, 2006 at 11:03:22PM -0500, Lou Hernsen wrote:
> I would like to offer my guest a way to download fonts and art
> from my web site... I use perl / cgi's to create my HTML web pages.
> What is the CGI code that creates the link to allow people to do this?

...
print q(Download my artwork);
...

Or, if you really want to use FTP:

...
print q(Download ftp://example.com/myfile.zip";>my artwork);
...


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: referer throwing Internal Server Error

2006-03-13 Thread David Dorward
On Mon, Mar 13, 2006 at 07:30:45PM -0600, David Gilden wrote:
> Here is my little script and it throwing a Internal Server Error

Try running it from the command line:

Software error:
Missing right curly or square bracket at - line 13, at end of line
syntax error at - line 13, at EOF
Execution of - aborted due to compilation errors.


> I can not figure out what is wrong here
> and how secure is this, can it be spoofed easily??

The referer header is optional and very easily spoofed.

e.g. (if you have LWP installed)

GET -H'Referer: http://another.example.net' http://www.example.com/

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: using variable in param

2006-02-21 Thread David Dorward
On Tue, Feb 21, 2006 at 12:22:39PM +0100, Adriano Allora wrote:
> opendir(QUERY, 
> "/Users/adrianoallora/Sites/corpora/VALICO/indici_testa/") or $errtex = 
> $!;

So you set a variable if the directory couldn't be opened ...

> @interrogabili = readdir(QUERY);

... but then carry on and try to read the directory anyway?

> foreach $elem (@interrogabili)
>   {
>   next if $elem =~ /^\..*/;
>   $elem = $home->param($elem);
>   }
> 
> Why the  $home->param($elem) line doesn't work?

You don't define $home anywhere.


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Preventing unauthorized use of a CGI script

2006-02-07 Thread David Dorward
On Mon, 2006-02-06 at 22:28 -0600, David Gilden wrote:
> Just wanted hear opinions on how effective this is, as way of preventing 
> email relaying stoping 
> unauthorized use my script.

> This from a script that connects a  page to sendmail
> my $referer = referer; # what page called the script, check the domain
> exit if $referer = ($referer !~ /www\.mydomain\.com/i);

> If somebody from a foreign domain trys to invoke my script it should exit 
> with out a trace.
> Yes?

If you mean X puts up a form on another site with the action pointing
towards your form handler, and visitor Y to that site submits that form.
Then yes ... providing that X didn't put the form in a directory called
www.mycdomain.com.

It will also block legitimate users of your site as the referer header
is (a) optional (b) sometimes munged in the name of privacy (although in
violation of the HTTP spec - probably due to laziness in that
overwriting the referer header with junk means that the software doesn't
need to recalculate the content-length).

If you are trying to stop spammers from using the form handler to send
many messages, then no. Forging a referer header is trivial.

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: CGI - HTML::TEMPLATE - How do it ?

2006-02-02 Thread David Dorward
On Thu, 2006-02-02 at 16:36 -0300, Augusto Flavio wrote:
> The problem is my array... Look:

> @domains = (
>  { name => 'domain1.com'},
>  { name => 'domain2.com'},
>  { name => 'domain3.com'},
> ); 
> 
> where i place the subdomain of the value domain2.com ? 

{ 
  name => 'domain2.com',
  subdomain => 'www.domain2.com',
},

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: CGI - Email Forms

2005-12-08 Thread David Dorward
On Thu, 2005-12-08 at 12:24 -0600, Bill Stephenson wrote:
> I tried your example and could not get it to send the email to the 
> spammed address. It just stuck it in the subject line like it should 
> have.

> I don't have anything special in the script to filter the newline. 

>   use Mail::Sendmail;

I'm not familiar with Mail::Sendmail, but I'm betting that it replaces
the new line with an escape sequence. That has nothing to do with
CGI.pm.

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: CGI - Email Forms

2005-12-08 Thread David Dorward
On Wed, Dec 07, 2005 at 01:19:59PM -0600, Bill Stephenson wrote:

>> Nor should you allow new lines ...
>> $subject = "User entered data with\nBCC: spam victim <[EMAIL PROTECTED]>"

> I wasn't aware of that problem. I'm guessing that using CGI.pm to parse 
> input helps solve that problem. Is this correct?

No. There are plenty of times when you *want* to allow new lines in
user input, even just sticking to the rather narrow field of form
processors that send email, you often want to allow the user to enter
multiple lines of text (in the message body).

Using a prewritten, well-tested formmailer (such as NMS) is a good way
to solve the problem.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: CGI - Email Forms

2005-12-07 Thread David Dorward
On Tue, Dec 06, 2005 at 02:37:18PM -0600, Bill Stephenson wrote:

> >What tests must be in place in order to keep your perl scripts from 
> >being hijacked from spammers? Any help would be greatly appreciated.
> 
> For forms that send email, you don't want to let the user enter a "To, 
> CC, or BCC" address.

Nor should you allow new lines ...

$subject = "User entered data with\nBCC: spam victim <[EMAIL PROTECTED]>"

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Filering a file

2005-12-05 Thread David Dorward
On Mon, Dec 05, 2005 at 02:20:33PM +0100, Adedayo Adeyeye wrote:
>How do I write a script to parse through this file and just return the
>unique names. Ie I want the repetitions ignored.

What have you tried?  Where are you stuck? (Opening the file? Reading
the contents? The actual filtering?). Nothing in your question is CGI
related, have you got this working as a command line script but are
having trouble converting it to work under CGI? What code have you got
so far?


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Need help with making a Modules

2005-11-27 Thread David Dorward
On Sat, 2005-11-26 at 19:48 -0800, Lou Hernsen wrote:
> I am studying modules.. 

perldoc perlmod (and perlmodlib, and perlmodstyle)

> Do I need to pass vars into the mod?

No, but you might need to pass them into subroutines you define in the
module (depending on what you want to do).

> Do i need to declare vars in the mod?

That depends on what you want the module to do.

> What is "our"? something like "my" and "local"?

perldoc -f our

> Do I need to return vars?

The module itself needs to return a true value, this is usually achieved
by sticking "1;" at the end of it.

Your subroutines may or may not return variables depending on what you
want them to do.

> The code I am writing creates part of a web page,
> so I can print it in the mod or in the main.
> (I wold prefer to print it in the mod.. if possible)

Its possible, but I find that building a data structure that represents
the page, then dropping it into a template (using Template-Toolkit of
HTML::Template) makes things more manageable.

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Turn off enctype

2005-11-07 Thread David Dorward
On Mon, Nov 07, 2005 at 05:25:27PM -, Dermot Paikkos wrote:

> I need to turn off the enctype attribute within a form

Why? 

> The docs I have read say that application is the default but that 
> doesn't seem to be the case.

[EMAIL PROTECTED]:~$ perl -MCGI -e'print CGI->start_form()' 


Looks like the case to me (assuming you mean
"application/x-www-form-urlencoded" as "application" by itself isn't
any form of encoding.

If you were talking about "the default of the encoding isn't
specified", then URL encoding is the default of every browser I've
ever tried it with. In fact, its the default type mandated by the HTML
spec:

http://www.w3.org/TR/html4/interact/forms.html#form-content-type

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: uninitialized variable

2005-11-01 Thread David Dorward
On Tue, Nov 01, 2005 at 04:34:45PM +0100, Adedayo Adeyeye wrote:

> I'm getting an error when trying to run a script. Part of the scripts is

> my $action = param('form_action');
> if($action eq 'search');

> The error I get is:
> Use of uninitialized value in string eq at connect_rodopi.cgi line 14. 

Looks more like a warning then an error to me.

> How am I supposed to initialize this value?

By assigning something to it, but in this case its possibly better to
test if something was assigned to it.

if (defined $action && $action eq 'search') ...

or 

if (!defined $action) {
  ...
} elsif ($action eq 'search') {
  ...
} 

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: hardcoded paths

2005-10-28 Thread David Dorward
On Fri, Oct 28, 2005 at 10:28:20AM +0100, Dermot Paikkos wrote:

> I am moving a site from once host to another. There are lots of 
> hardcoded fully qualified paths to the localhost

> I am pretty sure this isn't good practise but I am not a bit lost as 
> to what are good alternatives.

Relative URLs?

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Combined and

2005-10-21 Thread David Dorward
On Fri, Oct 21, 2005 at 10:28:20AM -0500, Jonathan Mangin wrote:

> I've seen several pages with  constructs where
> the first  appears to be 
> How is this done??

With relatively complicated client side stuff, certainly not with CGI.

news:comp.lang.javascript would probably be the best place to ask.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: XML [AntiVir checked]

2005-10-11 Thread David Dorward
On Tue, Oct 11, 2005 at 04:05:53PM +0200, Naji, Khalid wrote:
> Which Module  could you recommend for the use of the XML (XML::Simple,
> XML::Parser and XML::Writer, XML::DOM, XML::PATH...) ?

Which form of transport would you recommend for getting from one place
to another?

It depends on your specific needs.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: XHTML (was Re: One link to 2 frames)

2005-09-21 Thread David Dorward
On Wed, Sep 21, 2005 at 10:18:37AM -0400, Chris Devers wrote:
> On Wed, 21 Sep 2005, David Dorward wrote:
 
> > XHTML 1.1 is XHTML 1.0 Strict with Ruby added. 
 
> Really? 

Yes.
 
> As in the scripting language Ruby? 

No. As in the Ruby Annotation language. 
http://www.w3.org/TR/2001/REC-ruby-20010531/

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: One link to 2 frames

2005-09-21 Thread David Dorward
On Wed, Sep 21, 2005 at 02:29:15PM +0200, MNibble wrote:
> The time delay, well yes there is a problem, but i can't fix that on, so 
> this needs to be my workaround. There a lot a data that needs to be 
> processed, and i didn't want the user to wait for that page, so i put a 
> side befor the output and give the data some time to settle.

The trick here is that when a request comes in:

* Generate a unique ID for the job

* Fork it off into the background (or store the details in a database
  and let a continuing background process handle it)

* Return to the user a page explaining that the process will take some
  time and give them a link (including the job id) to check to see if
  it is ready yet. Idealy you will provide some time estimate on the
  issue. You can also use JavaScript or a meta refresh to periodically
  poll the server without user intervention. This should be in
  addition to the link as JavaScript is optional, and meta refresh
  isn't standardised.




-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




XHTML (was Re: One link to 2 frames)

2005-09-21 Thread David Dorward
On Wed, Sep 21, 2005 at 12:11:59PM +0200, MNibble wrote:

> I won't say you are wrong, since you are right.I (please don't throw 
> stones or bits at me) already use css und div span and stuff like that 
> and if it is called xhtml that's fine for me

That isn't what is called XHTML.

XHTML 1.0 is HTML 4.01 expressed in XML instead of SGML. In practise,
its pointless for 99/100 cases. It has Appendix C which does a bunch
of handwaving and allows you to serve XHTML with the text/html content
type so that "legacy" user agents which don't understand XHTML (like
Googlebot and Internet Explorer) can cope with it if you follow some
additional constraints (of course Appendix C depends on browsers
getting some parts of HTML wrong in the first place, and not all
browsers do, so its pretty rubbish).

XHTML 1.1 is XHTML 1.0 Strict with Ruby added. 

XHTML 2.0 isn't ready and is pretty much an entirely new language that
does a similar job to HTML.

In practise XHTML is far more trouble then its worth unless you have a
need for mixed namespaces (if you don't know what they are, you don't
need them) and should generally be avoided in favour of the better
supported HTML 4.01 (the Strict variant).

Using CSS for layout, HTML (or XHTML) for semantics, relationships and
structure, and JavaScript for behaviour is generally lumped under the
umbrella heading of "Standards based design".

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: One link to 2 frames

2005-09-21 Thread David Dorward
On Wed, Sep 21, 2005 at 08:32:47AM +0200, MNibble wrote:

> Thx both of you. But i realy think there musst be a possibilty. I have 
> two javascript funktions which i try to get rid of.

This started off as a simple case of populating two frames in response
to one user action (at least as far as I understood it). Now you've
introduced a stack of other elements into the equation, all of which
appear to be possible solutions to a larger, undefined problem.

If you specified what the actual problem you are trying to solve is,
you might get some advice that is more relevent to your situation. As
it is, we can only try to answer the questions you ask. (And the
answers you've recieved are good ones in the context of the question).

> The first is this link which fills to frames 

There are two ways to do this.

1. Linking to a new  document
2. JavaScript

In most cases the better solution to the problem is eliminating the
frames and sending the user a single combined document.

> ( i would also fork into two processes with a redirect ... maybe
> that's gonna work )

One request returns one HTTP resource, that's how the web works. You
can't return one document, then return another document a little while
later, the client won't be expecting it.

> and a time delay .. something like: if you are not in 30 sek then
> push

It would be up to the browser to determine if they are "in" or not,
and that would require JavaScript. I've no idea why you would want
that functionality though. It sounds like a band-aid solution to more
serious underlying problem.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: One link to 2 frames

2005-09-20 Thread David Dorward
On Tue, Sep 20, 2005 at 02:05:09PM +0200, MNibble wrote:

> is there a standard solution to this problem

To what problem? (Please don't depend on people reading subject
lines).

There are two:

1. Don't use
frames. http://www.allmyfaqs.com/faq.pl?Problems_with_using_frames

2. Link to a new frameset document.

Neither really involve Perl or CGI.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Forcing a "save as' dialogue box to come up on left click

2005-09-20 Thread David Dorward
On Mon, Sep 19, 2005 at 09:36:16AM -0500, Tony Frasketi wrote:
> Thanks for the response, David.
> I scanned thru the document to which you refer and from what I can 
> understand it appears 'to me'  that the 'Content-Disposition Header 
> Field" being described is in the context of email messages.

Whoops, beg pardon.

http://www.faqs.org/rfcs/rfc2616.html

Section 19.5.1

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Forcing a "save as' dialogue box to come up on left click

2005-09-18 Thread David Dorward
On Sun, 2005-09-18 at 17:46 -0500, Tony Frasketi wrote:
> I'm trying to find a way to force a download dialogue box to come up 
> when the user clicks on a link on a web page 

http://www.faqs.org/rfcs/rfc2183.html

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: CGI.PM and IF statment....

2005-09-10 Thread David Dorward
On Sat, 2005-09-10 at 01:44 -0500, David Gilden wrote:
> 
> Choose type message

> my $mt = param('message type');
> if (length($mt) == 0) {

> This should only redirect it someone has not made a 'selection' 
> what am I missing?

If the user truly has not made a selection, the $mt will be undef, and
your script will throw a warning:

if (!defined $mt) {
  # etc
}

However, it is very difficult for the user to fail to make a selection
given a select element. It would usually require them to construct their
own form, or HTTP request by hand. If you want to test if they have
selected the "Choose type message" option, then you need to check if $mt
contains the data "0".

The length of "0" is 1 (since it is one character long), so (length($mt)
== 0) will always fail.

if (
 (!defined $mt) ||
 ($mt eq '0')
   ) {
  # Etc
}

-- 
David Dorward   <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
 -- The Greatest Show in the Galaxy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: $ENV{'HTTP_REFERER'}

2005-08-24 Thread David Dorward
On Wed, Aug 24, 2005 at 02:12:56PM -0700, Denzil Kruse wrote:

> I want to know the web site that someone came from,
> and so I was planning on reading $ENV{'HTTP_REFERER'}
> to figure it out.  How reliable is that?

Reliable enough for general interest and for finding some sites with
links to moved pages on your site. Not reliable enough to depend on.

> Do browsers or other situations block it or obfuscate it?

Often. Its an optional header, isn't supposed to be sent when arriving
from an https page, and is munged by a goodly number of personal
"firewalls".

>  Is there another way to do it

No

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: getstore and comments

2005-08-19 Thread David Dorward
On Fri, Aug 19, 2005 at 10:58:24AM +0200, Adriano Allora wrote:

> Some questions:
> 1) how can I write multine comments? something like /** ... **/?

You can fake it with POD. I juse use a decent editor that lets me
comment out a every line in a region.
 
> 2) the following script doesn't find the page requested in getstore 
> (baolian.local = 127.0.0.1). Why?

The second parameter for getstore is a file, not a URL.

> 3) $homepage must be a real page/file or I can use it like a normal 
> variable or a filehandle to read with whlie(<>)?

The documentation doesn't say, but usually a module which takes a file
can take either a filename or a filehandle.

If your only intention is to read it, then you might be better off
with get() instead of getstore().

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: htaccess question

2005-08-12 Thread David Dorward
On Thu, Aug 11, 2005 at 10:30:35PM -0400, Chris Devers wrote:

> > If a directory is password protected with .htaccess
...
> > or do you always get the popup box?

I'm guessing you are talking about Basic Authentication here. A
.htaccess file can contain pretty much any Apache directive, so it
could be configured to use a Perl script for authentication (which
would be more on topic for this list).

> You may, however, be able to use this syntax:
> http://Moe:[EMAIL PROTECTED]/members/index.html
> Whether this will work depends on the server configuration.

No, it depends on the browser. There is no difference between that
syntax and typing into a dialog box as far as the server is concerned,
its just different ways for the browser to gather the information from
the user.

The credentials in URL syntax hasn't got as much support as it used to
have though, it was too often used in pishing schemes.

> But note that embedding this in the URL is usually considered a bad 
> habit, unless you have no problem with this information being sent 
> across the internet in the clear for anyone to see.

It is only in the clear if you don't use HTTPS - and if you don't use
HTTPS then any password you send it going to be clear. The difference
here is that it is visible in the URL - and so exposed to the
look-over-the-user's-shoulder-in-the-real-world attack.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How do I make two different web pages come up from one CGI?

2005-08-04 Thread David Dorward
On Wed, Aug 03, 2005 at 10:45:35PM -0700, Luinrandir wrote:
> I want to create two web pages in two different windows
> from one CGI.

Each request gives one file, that's how HTTP works. You will need at
least two requests, with the script running twice (or two scripts
running once each).

You can use JavaScript to spawn a second window, although it might be
blocked by popup blockers (the specifics of such a solution are rather
off topic for this list though, so I'll suggest you look elsewhere if
you want to go down that path).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Easy question

2005-07-19 Thread David Dorward
On Tue, Jul 19, 2005 at 02:54:13PM +0100, Neville Hodder wrote:

> 

* Invalid HTML. The action attribute is required. 

* You haven't specified an enctype, but the default is unstuiable for
  use with file inputs.

* You haven't specified a method, and the default (get) is unsuitable
  for use with file inputs.

http://www.w3.org/TR/html4/interact/forms.html#h-17.3

> 

Funny looking paragraph ...

Inputs without names cannot be successful form controls.

http://www.w3.org/TR/html4/interact/forms.html#h-17.13.2

>  maxlength=\"15\">
> 
> The file is: $ENV{QUERY_STRING}.

Use CGI.pm. Don't try to access CGI related enviroment variables
directly. CGI.pm solves most of the problems you will run into
already.


> 
> 
> 

You should pay a visit to http://validator.w3.org/

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to browse and select a remote file and then return the filename

2005-07-07 Thread David Dorward
On Thu, Jul 07, 2005 at 12:14:42PM -0400, Chris Devers wrote:

> > Well, that specific example anyway :) I suspect a signed Java applet
> > could work on other systems.
 
> I thought Java applets were sandboxed, and that access to the filesystem 
> was explicitly not allowed. Have things changed in the past few years? I 
> thought the whole point of Java applets was that they were "safe", in 
> part, because they couldn't interact with the underlying filesystem. 

That's true for standard applets, but I *think* that a digital
signature and the user granting permission will let them escape the
sandbox. I wouldn't swear to it, I've done very little with applets.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to browse and select a remote file and then return the filename

2005-07-07 Thread David Dorward
On Thu, Jul 07, 2005 at 11:42:29AM -0400, Chris Devers wrote:

> > It isn't possible. For that sort of thing you'll need something like
> > an ActiveX control with permission to read the user's file system. (Or
> > to get the user to type the path to the file).
> 
> And that, in turn, can only be reliable with IE on Windows.

Well, that specific example anyway :) I suspect a signed Java applet
could work on other systems. Its not reliable on IE anyway - its
unlikely that all users would have their security low enough (and
accept the alerts) for it to run.

However, I have trouble conceiving of a circumstance where it would be
useful to do this over the WWW, so its probably in an environment where
user agents can be mandated.
 
> I'm not aware of anyone getting ActiveX to work on anything other than 
> the IE/Windows combination. Admittedly, that's something like 90% of web 
> users, but Firefox, in particular, seems to be growing fast now.

I seem to recall somebody managing to run ActiveX and IE under WINE :)
 
-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to browse and select a remote file and then return the filename

2005-07-07 Thread David Dorward
On Thu, Jul 07, 2005 at 03:00:02PM +0100, Neville Hodder wrote:
> I am in the process of learning how to use the CGI.pm module but can not
> find a method that will allow me to simply choose a 'remote' file. I
> need to be able to return the value "path+filename" of a file that the
> user has browsed to using something like the standard HTML form type:

It isn't possible. For that sort of thing you'll need something like
an ActiveX control with permission to read the user's file system. (Or
to get the user to type the path to the file).

Since the server doesn't have permission to access the user's file
system over the Internet, and since that file system might be UNIX
type, DOC type, or some other unknown type - it isn't a particularly
useful feature to build into HTML.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: HTML::Templates

2005-06-28 Thread David Dorward
On Tue, Jun 28, 2005 at 08:21:02PM +0530, Rajesh Raghammudi wrote:

> I am using HTML::Templating system for my project and the requirement is, 
> URL given at the address bar should not be changed throughout the 
> application

Yuck. The web is not designed to work like that.

> I could able to achieve this and works fine for me (I have a 
> login page and users have to login to access the application).
> 
> The problem I am facing is, If the user refreshes or does anything, nothing 
> will happen and everything works fine, but when the user places cursor at 
> the address bar and presses Enter, then the page is getting redirected to 
> login page asking the user to login again.

I'm guessing you are passing everything as POST data? Use a session to
track where the user is at any given point, and return them there if
they revisit the page without submitting POST data.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: hide source code 2 - online game

2005-06-19 Thread David Dorward
On Sat, Jun 18, 2005 at 09:21:55PM -0400, Luinrandir Insight wrote:

> my web host's cgi-bin is password protected.
> is this enough to hide my perl-cgi code that makes the HTML pages?
> the player files are in the same dir as the cgi code.
> I have an online game, so I don't want people to cheat.

Do the players have access to the server other than through http?  If
you request one of the player files over http, what do you get?
 
As a general rules, any data files should be kept out of the web root
entirely.

> now I am hearing that PHP is the way to go for maximum hacker
> protection...  comments?

Err... "Ha!"? (Code is only secure as the person who writes it, I find
it rather harder to write secure code in PHP, it doesn't come with
such sane features as, for example, DBI bind variables.)

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: hide source code

2005-06-18 Thread David Dorward
On Sat, Jun 18, 2005 at 07:43:58PM +0200, Glauco Magnelli wrote:
> Excuse me, you're right. I want hide Perl code from
> other users of the server.

http://perlmonks.org/?node_id=423870
 
-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: hide source code

2005-06-18 Thread David Dorward
On Sat, Jun 18, 2005 at 02:51:51PM +0200, Glauco Magnelli wrote:
> I would hide source code in my CGI Perl scripts.

Which source code (Perl, HTML?)? From whom (other users of the server,
visitors to the website?)?

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How do I change the font color of a checkbox group

2005-06-13 Thread David Dorward
On Mon, Jun 13, 2005 at 09:23:00AM -0400, miwalsh wrote:

> I am building a web page using CGI. The page contains checkboxes,
> popup menus etc. I have been able to change the font of most of the
> page by surrounding the statements on the page with the  color='color> tag. For example, some of the code might look like
> this: print "This is my web page.";

The  element is deprecated, you really should be using CSS for
this.

http://www.w3.org/Style/CSS/learning
 
> I would like to change the font of the words in the checkbox groups so that 
> they match the rest of the page. However, I don't know how to do this and I 
> can't find anything in the documentation that helps. If anyone has any ideas 
> about this I would be greatfull to hear them.

It really depends on the markup that is being generated, something
like:

legend { color: red; }
label  { color: red; }

... should do the trick if the generated markup is good.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to save the state of a CGI script

2005-05-30 Thread David Dorward
On Sat, May 28, 2005 at 09:57:55PM +0530, Ankur Gupta wrote:

> I read perldoc CGI and found that state of a script could be saved by the
> following function.

> $myself = $query->self_url;
> print q(I'm talking to myself.);

Not quite. If you used "qq" so that the string would interpolate
variables then it would create a link back to the current URL -
including the query string.
 
> print $q->start_form(-method=>'POST',

You cannot create POST requests using a hyperlink, in HTML the only
way to set this up is with a form. Additionally, since the data not
sent using the query string then simply reading the query string won't
include the same values.

You would need to loop through the posted data and generate form
controls (such as hidden inputs) for each value. Since the rest of
your message discusses sorting of data, you should consider that GET
is supposed to be used when retrieving any information from the server
and POST when you are changing something. (This has implications such
as GET being bookmarkable, and POST causing most browsers to warn
about resubmitting data).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to use mime types for excel?

2005-05-15 Thread David Dorward
On Sat, May 14, 2005 at 10:25:28AM -0600, Siegfried Heintze wrote:
> Cannot I just check for the mime-types supported by the browser (by checking
> ENV{HTTP_ACCEPT}) 

You'll find very few user agents which claim to support that
explicitly, the best you could hope for is that it includes a "*/*" to
say "Well, I'll try to do something sensible with whatever you throw
at me."

That doesn't change the fact that an HTML document is not an Excel
document, and should not be served as such.

> and conditionally set the content type to application/msexcel?

application/msexcel is not a MIME type registered with the iana.

> Incidently, I discovered that this mime type works and
> excel automatically converts the HTML to excel tables.

Excel is not the only piece of software to read Excel files. 

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to use mime types for excel?

2005-05-14 Thread David Dorward
On Fri, May 13, 2005 at 02:06:42PM -0600, Siegfried Heintze wrote:
> I saw a very simple demonstration last night (at the Boulder Java users
> group) where Scott Davis showed a very simple java server pages program that
> transmitted HTML table data to a browser resident instance of Microsoft
> Excel. IE automatically looked at the mime types and invoked MS Excell to
> convert the HTML to a spreadsheet.

Don't do that. You've no idea what software the end user will be
using, so if you lie and claim that an HTML document is really an
Excel document then you can cause problems for people.

If you want to generate Excel, then Perl has many fine modules to do
just that.

(At a wild guess I'd say that perhaps you were encountering the IE
knows the Content-Type better then the server issue, and it was
realising that you Excel document was really an HTML document and
doing The "Right" Thing).
 
-- 
David Dorward  http://dorward.me.uk




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Remote Desktop

2005-04-20 Thread David Dorward
On Wed, Apr 20, 2005 at 06:30:12PM +0530, Rajesh Raghammudi wrote:
> Hi, Just need one info.
> Does anybody have any idea, I need to capture the desktop of a remote
> user, as part of my project, I need a web-based application for this.

VNC, has a Java Applet client and webserver to host it. Nothing to do
with Perl or CGI though.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Variables in Modules

2005-04-13 Thread David Dorward
On Wed, Apr 13, 2005 at 05:14:31PM -0300, Sergio Pires de Albuquerque wrote:

> Thanks, but when I call another script from script1.cgi the value has 
> gone

HTTP is stateless. Each time a user requests an HTTP resource provided
by a script, that script is run from scratch. If you want to make data
persistent from one HTTP request to another, you either have to get
the browser to pass it back (by encoding the data in the URL
(typically with the query string, or (with the help of a form) in a
POST request - either way it can be accessed with the param method of
the CGI module), or by storing it on the server and asking the client
to pass a token about (typically in a Cookie) to identify which set of
data belongs to the user (this is usually done with sessions:
http://search.cpan.org/~sherzodr/CGI-Session-3.95/Session.pm )


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Internal links with cgi

2005-03-26 Thread David Dorward
On Sat, Mar 26, 2005 at 11:11:15PM +0530, Ankur Gupta wrote:

> I have a link like this. http://127.0.0.1/link.cgi#word";>word.

> When I click on the link word, I want the link.cgi to execute and then it
> should navigate to the word "word".

Then wrap that word in a named anchor or (if you are writing modern
code and don't need to support browsers as obsolete as Netscape 4) a
suitable element with an id.
 
> Its not happening for me. Is it valid in cgi or am I missing something.

All the browser knows is that it has recieved some HTML because it
made a request for an HTTP resource. It doesn't matter how the server
goes about working out what content to send back, CGI, mod_perl, a
static file, its all the same to the client.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: IE save, other shows image

2005-02-10 Thread David Dorward
On Thu, Feb 10, 2005 at 10:30:59AM +0100, Ing. Branislav Gerzo wrote:
> I have simple question, in my CGI script I have:
> 
> print $query->header(-type=>'image/jpg');

This is wrong, the registered MIME type for JPEG images is image/jpeg

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Problem with script requiring valid referrer

2005-02-08 Thread David Dorward
On Tue, Feb 08, 2005 at 11:43:05AM -0800, Chris Schults wrote:
> In both cases, our visitors swear that they are linking to these scripts
> from valid Grist pages. Any ideas why some people are getting the error
> messages? 

The referer header is optional, and when it is used there are a number
of products out there which munge it (e.g. replacing http://foo with
XXX:X). You can't depend on it.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Incorrect HTML Rendering?

2005-02-08 Thread David Dorward
On Mon, Feb 07, 2005 at 05:42:45PM -0800, Graeme St. Clair wrote:
>   

Mozilla will support it in XHTML mode, but not tag soup mode (serve it
as application/xhtml+xml not text/html).

A better solution would be to use your CGI script to handle your macro
functions.

(Insert mutterings about markup authoring questions being
inappropriate for a Perl CGI list).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: embedding dynamic images in html output

2005-01-21 Thread David Dorward
On Fri, Jan 21, 2005 at 09:43:40AM -0500, Chad Gard wrote:
> I have a CGI that generates a page from data in a database.  I want to 
> include several graphs of data in the page.
> 
> I can use GD::Graph to create the images.  But, the data sets are 
> rather large/awkward to try to send off to another CGI that I could use 
> with the IMG tag, and I really don't want to write images to files on 
> disk. 

How about passing it the data it needs to make a suitable database
request?

> I'd like to be able to embed the image data directly in the 
> output of the one CGI.

This isn't really practical.

> I have found an offhand reference to embedding the image data in an 
> OBJECT tag (in Perl Graphics Programming, page 374 of the first 
> edition).  But cannot find any information about how to actually go 
> about doing that.

This? http://www.faqs.org/rfcs/rfc2397.html

Browser support isn't very good, Internet Explorer doesn't support it
(for instance).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to avoid accidental re-sending of POST data

2004-12-14 Thread David Dorward
On Mon, 2004-12-13 at 18:58 -0500, Ingo Weiss wrote:
> print $query->redirect('http://somewhere.else/in/the/world');
> 
> In the above example, the document that was originally requested does
> never make it to the client, right?

The client should receive the entire document that your script sends
after it finishes outputting the headers. According to the HTML
specification that should be a document that tells the user about the
redirect (for user agents which don't support 302 (which aren't very
common)). Most user agents hide this from the user.

> The reason I am asking is the usabiliy problems associated with meta tag
> redirects - they break the back button.

HTTP redirects do not break the back button.
-- 
David Dorward <http://dorward.me.uk/>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: cascading menus in perl??

2004-12-14 Thread David Dorward
On Tue, 2004-12-14 at 11:41 +1100, Cat wrote:
> Been using a cascading menu written in javascript but would like to
> convert this to perl so that on mouseover it drops down further
> options to click through.

If you want something on the client to change in response to an action
then you either need to have the browser visit a new URL and send back a
different webpage or use client side scripting.

While you could do this in client side Perl, the number of users who are
using Internet Explorer AND have the PerlScript plugin installed are
minimal (and the subject is off topic for this mailing list anyway).


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



Re: Form PARAM is wierd (to me)

2004-12-12 Thread David Dorward
On Fri, Dec 10, 2004 at 02:04:33PM -0500, Robert wrote:
> I am getting a wierd value. When I submit the form I am getting 
> "position=VALUE++" back in the URL. I have no idea where the "++" is coming 
> from and I can't find a darn thing about it.

Most likely they are form encoded space characters. If you pay a visit
to Google and search for something including spaces, you will probably
see the same effect.

I suspect you will find that when you get the value in your CGI script
you will see them converted back to spaces.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Using a CSS file

2004-12-08 Thread David Dorward
On Wed, Dec 08, 2004 at 07:47:09AM -0800, Graeme St. Clair wrote:
>  [Wed Dec 08 10:30:01 2004] [error] [client ###.###.###.###] c:/program
> files/perl_apache/apache/cgi-bin/fred/blah.css is not executable; ensure
> interpreted scripts have "#!" first line

Looks like your server is configured to treat all files in cgi-bin as
CGI scripts.

> 1) is there some appointed place for 'blah.css' other than where it is?

Somewhere where the server won't try to execute them. This probably
means "Anywhere but in the cgi-bin" :)

> 2) 'blah.css' contains only the CSS specs, nothing else.  Is that as it
> should be?

Yes

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Printing from a Web Browser

2004-12-01 Thread David Dorward
On Wed, 2004-12-01 at 18:51 +, David Dorward wrote:

> By default a ed style sheet applies to screen media only.

Whoops, I got that backwards. Its 

Re: Printing from a Web Browser

2004-12-01 Thread David Dorward
On Wed, 2004-12-01 at 12:05 -0600, Bill Stephenson wrote:
> I just spent several hours formatting a web page template with a Style 
> Sheet only to find that when the browser sends the page to a printer it 
> apparently tosses the CSS info and renders it in the default HTML. Very 
> frustrating

By default a ed style sheet applies to screen media only. Use the
type attribute (as described in the HTML and CSS specifications) to
specify style sheets for other media types.



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




Re: Address bar & redirects

2004-11-04 Thread David Dorward
On Thu, Nov 04, 2004 at 10:08:51AM -0500, Jonathan Mangin wrote:
> That's not me, man. I'm not using frames

Then either:

(a) The URI you provided is not one to a site you are running (so why
did you bring it up?)

or

(b) (more likely) You have chosen a third party domain name hosting
solution with is frames based and are not taking responsibility for
it.

Either way, the problem you are experiencing has nothing whatsoever
with any redirects you use Perl for.

>  or JavaScript.

JavaScript is the usual way to escape from frames, not something I
noticed the site you referenced using.

(Relevant background lost as I'm too busy to repair other people's top
posting).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Address bar & redirects

2004-11-04 Thread David Dorward
On Thu, Nov 04, 2004 at 09:52:18AM -0500, Jonathan Mangin wrote:

> http://youve-reached-the.endoftheinternet.org/

The above URI is a frameset (eugh, icky frames). If an http resource
loaded into the frameset performs a redirect then the URI won't change
becuase the URI in the addressbar is not a reference to the document
performing the redirect.

If you want to break out of frames you need some sort of client side
technology. JavaScript framebusters are not difficult to find, but are
out of scope for this mailing list.

> It was accomplished *exactly* like the one that got me to
> where the next redirect doesn't change the address bar.

I'm really not clear what you are refering to by "It" or "the one"
here.

-- 
David Dorward  http://dorward.me.uk

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Address bar & redirects

2004-11-04 Thread David Dorward
On Thu, 2004-11-04 at 12:49 -0500, Chasecreek Systemhouse wrote:
> However, before you go traipsing off to research - try using
> target="_new" and have the NEW url open in a NEW window.

or not, since:

(a) New windows are a usability hazard
(b) _new is not an allowed value for the target attribute (you seem to
be thinking of _blank)
(c) _top would be more apropriate
and
(d) you can't use targets in anything automatic

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




Re: was php & Perl, now reusable page elements

2004-11-03 Thread David Dorward
On Thu, 2004-11-04 at 15:35 +1100, Cat wrote:
> What made me work with php was it's ability to draw reusable page
> elements like the header, menu, footer from another html page from a
> fixed html page.
> 
> Now I know that this can be done in perl when the pages are generated
> by a script,

When a page is generated by PHP it is generated by ... a script! PHP is
just another programming language.

>  but my pages are fixed html to take advantage of meta tags etc plus

If you mean "static" HTML, then:
* That will have no influence of your ability to use  elements
* That will provide no advantage to any search engine optimisation you
might be trying to do

Static pages do make it somewhat less work to get sane cache control
headers, and that can provide benefits to search engines (and, more
importantly, to visitors).

>  completely different layouts required within the one function.

Do I not understand what "function" means in the context of programming?

>   So I was attemtping to use the function in php to call headers,
> footers etc from another html page so that I don't have to alter 150
> odd pages each time I change one minor thing in the layout.

As I believe I suggested before, you can do that with Perl.

> So, I am not sure that it would be a great idea to call a subroutined
> directly from a fixed html page even if it can be done

Again, if you mean "static", then you can't - by definition. The moment
you start calling server side scripting functions/methods/subroutines
your page becomes dynamic, not static.

> so how else would I call my headers. footers etc using perl.  Tis the
> question at the end of all of that  :-)

I think I mentioned Template::Toolkit last time. 



There is also HTML::Template.



and Mason.



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




Re: cgiemail - formquestion

2004-11-01 Thread David Dorward
On Mon, Nov 01, 2004 at 04:59:35AM -0500, Chasecreek Systemhouse wrote:

> > I made a form that is working... Now the client wants
> > the form to self-update the content of the fields as
> > the user fills out the form. For example, if they pick

> I would choose DHTML or JavaScript - which are things that happen on
> the client.

DHTML being code for "JavaScript + DOM + HTML" ... usually.

The problem with this is that you can't know if it will work - it
depends on the client. It is also easy for the client to forge. So
while it can be used to give information to the user, it is essential
that you do not depend on any data generated from JavaScript to either
exist or be accurate.

-- 
David Dorward  http://dorward.me.uk




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Help with php & perl

2004-10-22 Thread David Dorward
On Fri, Oct 22, 2004 at 05:51:06PM +1000, [EMAIL PROTECTED] wrote:

> just spent absolutely days re writing all my html file into php with
> css & includes for reusable page elements. only to find that my perl
> script won't run the css or the php includes.

A CSS @import (assuming that is what you mean by a CSS include) is
client side. What software you use to generate your client side code
is rather irrelevent. Perl should not a be a factor in this not
working. (Of course it is possible you are generating invalid content,
or sending a Content-type header that claims the CSS is something
other then CSS, but that is impossible to debug without seeing the
code.)

As for Perl and PHP; they are different tools to do the same
job. While it is theoretically possible to configure your server to
chain together PHP and Perl interpretors (thus generating HTML from
PHP, but generating the PHP from Perl (or generating Perl from PHP and
the HTML from the Perl) this isn't something I'd want to do as it is
overly complex and inefficient.

Once you get down to it, there isn't anything you can do with PHP that
you can't do with Perl (and vice versa), although some things might be
easier in one or the other. I suggest you pick a language and stick to
it. (Perl is a good choice :D )

> the newbie at perl & php.

If you are a PHP beginner AND a Perl beginner then its even more of a
bad idea to try to use them both at the same time!

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: cgi errow 403 if accessed with lynx browser

2004-10-20 Thread David Dorward
On Wed, 2004-10-20 at 14:51 -0400, Ingo Weiss wrote:
> > That suggests you are trying to access /cgi-bin/ instead of
> > /cgi-bin/someScript.cgi. Have you checked the HTML output of the
> > previous script? Is the HTML valid?
> 
> I checked it and it validates as XHTML 1.1 transitional

That is very unlikely. There is no such language as XHTML 1.1
transitional.

> > Do you see this issue if you
> > explicitly visit the URI of the second script?
> 
> No. Not if I put the url in quotes, like:
> lynx "http://www...";

That, probably, just stops your shell snipping off part of the URI
before passing it to the lynx binary. Certain characters (such as &)
have special meaning in the shell.

> This is what my URLs look like:
> 
>  href="?inst=neu&course=art635&year=2004&term=fall&
> section=news">
> 
> I am using "?" to indicate the same script that generated the page -
> could that be a problem?

Yes. Lynx believes it means "./?etc" rather then "myScript.cgi?etc".

>  if yes how is this done correctly?

Give the URI to the script, don't try to get the browser to fill it in
for you.

> Could the encoding of the url be a problem ("&" for "&")?

No.


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




Re: cgi errow 403 if accessed with lynx browser

2004-10-20 Thread David Dorward
On Tue, Oct 19, 2004 at 02:41:34PM -0400, Ingo Weiss wrote:
> I am usin the lynx browser to test my cgi's (in order to get a rough
> sense of the accessiblity of my pages).
 
> I can access a URL OK, but if I follow a any link (that points to
> another CGI) in lynx, I am getting the following error:

> Forbidden: You don't have permission to access /cgi-bin/ on this server
> (403)

That suggests you are trying to access /cgi-bin/ instead of
/cgi-bin/someScript.cgi. Have you checked the HTML output of the
previous script? Is the HTML valid? Do you see this issue if you
explicitly visit the URI of the second script? Does the problem occur
with user agents other then lynx (if not, then it suggests the problem
is with the HTML and lynx isn't managing to compensate for your
error)?

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Reimplement CPAN as a Torrent?

2004-10-19 Thread David Dorward
On Tue, 2004-10-19 at 13:41 -0700, Bill Jones wrote:
> Should CPAN be re-implemented as a Torrent?

No, it shouldn't.

(a) CPAN changes frequently
(b) Most people don't need a complete CPAN archive

> P2P is really hot and raging in some circles.  Maybe torrents can benefit us in 
> legal ways?

> At any rate, this is a new torrent on SuprNova:

(URI Snipped)

And that looks very much like a non-legal way.

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




Re: getting files from the internet

2004-10-14 Thread David Dorward
On Thu, Oct 14, 2004 at 09:09:00AM -0500, Jeff Herbeck wrote:
>  Here is what I have so far.  It runs, but it doesn't do anything but
> display "aaa"
> 
> #!/usr/bin/perl

Where are use strict and use warnings?
 
> getstore("$URL", "/var/www/html/$remote_user/");

According to the perldoc for getstore, the second parameter should be
a file, not a directory.

You should probably be checking the response code that getstore
returns as well.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Printing html document

2004-09-24 Thread David Dorward
On Fri, Sep 24, 2004 at 12:12:33PM +0300, victor wrote:
>So I need I button in a web page that will print that page to a 
> printer that is not attached to the local computer, but to the web 
> server where the page is hosted.
>   
>The problem is that when I send a html page it prints all the tags: 
> , ...

So you need some sort of filter to convert an HTML document to a
format that your printer can understand. Are you trying to get plain
text output? HTML::Striper might be your friend. Want it formatted?
HTML::Latext might do as a first stage (then you'll need to convert
the LaTeX to something your printer can understand (maybe
postscript)).

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to display a Text file using web browser under CGI

2004-08-13 Thread David Dorward
On 10 Aug 2004, at 21:52, Sun, Jian wrote:
Could anybody help me to figure out How to display a Text file 
using the web browser in a CGI program?
* output suitable http headers such as the content type
* open the file
* read the file
* output the file
Where are you having difficulty?
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Posting hyperlink value

2004-06-15 Thread David Dorward
On 15 Jun 2004, at 14:24, David Dorward wrote:
Bad form, following up by own post et al. However:
$hostname = escapeHTML($hostname);
Should be:
$hostname = escapeHTML(escape($hostname));
as the data needs to be url encoded as well as html encoded.
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Posting hyperlink value

2004-06-15 Thread David Dorward
On 15 Jun 2004, at 14:18, Werner Otto wrote:
I have a hyperlink defined as: $hostname in a form.
http://validator.w3.org/ is your friend. There is no name or value 
attribute for the anchor element.

$hostname = escapeHTML($hostname);
print qq();
Then the variable is called "hostname" not "$hostname".
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: use CGI qw(:standard);

2004-06-11 Thread David Dorward
On 11 Jun 2004, at 09:57, Werner Otto wrote:
I am making use of use CGI qw(:standard); to create my form. I need to 
amend the size of a submit button
   print $query->submit(-name=>'button_name',
-size=>15,
-value=>'value');
and need to tell the button which script to call (ie. action=test.cgi).
You can't do that. The closest you can come in an HTML document is to 
use JavaScript (attached to the onclick and onkeydown even handlers) to 
dynamically alter the action. This is a really bad idea as it fails in 
the absence of JavaScript.

The standard way to get the same effect is to test the value of the 
button (which you must give a name) in the form handler. You can then 
do whatever actions you like (which may involve an http redirect to 
another script). Be aware that it is possible for users to submit forms 
without clicking on any submit button, so you need to have the form 
handler act in a sane way if $query->param('button_name') isn't set.

Where can I find documentation on all the attributes of the components
http://www.w3.org/TR/html4/index/elements.html
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



  1   2   >