Sending JavaScript variables to a perl program
hi... is there a good way to send JavaScript variables to a perl program WITHOUT using a form? (or mybe with a form, but i don't want the program to return anything, and i don't want a popup window to show up...) I know it sounds wierd, so i'll give an example... lets say i have a statistics gathering script called stats.pl and it returnes nothing to STDOUT when run, only writes to a data file. I can tell the user's IP by using $ENV{'REMOTE_ADDR'} etc., but i want to know some more stuff, like the user's screen size or the local time, which i can tell using JavaScript. My problem is sending this data to my perl script. The problem when using a form is that the browser loads a new document for the result, even if it is empty. If you got my intention, please help... thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Function for HTML code
Hello, which function could I use to transform characters such as '' into code for HTML. Any think like: $string='ab'; Func($string) return ('agt;b') Thank you KN -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sprintf questions
On Wed, 12 Mar 2003, David Gilden wrote: Is the following considered ok as in good PERL style? #!/usr/bin/perl -w $num =1.12345; my $tax_formated = sprintf(%.2f, $num); # --- THIS LINE print $tax_formated ,length($tax_formated), \n; The important thing is, does it do what youo are expecting it to do? -- Brett http://www.chapelperilous.net/ QOTD: The elder gods went to Suggoth and all I got was this lousy T-shirt. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Previous and Next
You need to use Javascript. a href=javascript:history.back()Back/a Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 13, 2003 10:42 AM Subject: Previous and Next Hi List, How can i write a PERL Script to simulate the Previous (-) and Next (-) Links (like in IE or Netscape). Thanks KN -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sending JavaScript variables to a perl program
On Wednesday, Mar 12, 2003, at 13:22 US/Pacific, Shahar Evron wrote: hi... is there a good way to send JavaScript variables to a perl program WITHOUT using a form? (or mybe with a form, but i don't want the program to return anything, and i don't want a popup window to show up...) I know it sounds wierd, so i'll give an example... lets say i have a statistics gathering script called stats.pl and it returnes nothing to STDOUT when run, only writes to a data file. I can tell the user's IP by using $ENV{'REMOTE_ADDR'} etc., but i want to know some more stuff, like the user's screen size or the local time, which i can tell using JavaScript. My problem is sending this data to my perl script. The problem when using a form is that the browser loads a new document for the result, even if it is empty. If you got my intention, please help... [..] First off it would be nice if JavaScript had a way to open a socket connection back to the web-server to send a message to it that contained all of the 'query string' information that you would want to pass back to the web-server for 'logging purposes'. But that is not easy and a bit more complicated to try and pull off. One way to solve your problem is to have a 'prefatory' page that collects the data, and then POST's that back to the web-server before showing the 'real page'. This way the 'flow' seems 'reasonable' to the user. You could have one cgi script say DataCollector.cgi that contains some java scripting, to get all of the relevant data, but calls RegularProcess.cgi which will first off call your stats.pl script with the relevant information, and then return the appropriate web_page to the user. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Function for HTML code
On Thu, Mar 13, 2003 at 11:32:02AM +0100, [EMAIL PROTECTED] wrote: Hello, Hello, which function could I use to transform characters such as '' into code for HTML. Any think like: $string='ab'; Func($string) return ('agt;b') The HTML::Entities module can do this for you: #!/usr/bin/perl use strict; use warnings; use HTML::Entities; print encode_entities('abc'); Along with other related functions -- perldoc HTML::Entities HTH, -- Michael [EMAIL PROTECTED] http://www.jedimike.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formatting money $12.00
#!/usr/bin/perl -w $num =1.12345; my $tax_formated = sprintf(%.2f, $num); # --- THIS LINE ### $tax_formated is used in a few places The important thing is, does it do what youo are expecting it to do? Well yes, I think so. I wanted to cut down on the times I was calling sprintf(%.2f, $num); This is new function to me :) One more quick question here has to with filling a HASH my (%bags_ordered,$bag); # is it ok to mix match the type of variables inside a # my vars declaration? @bags = param('handbag'); #CGI.pm foreach my $bag (@bags){ $bags_ordered{$bag} = {} unless exists $bags_ordered{$bag}; } ### Is the code below -- more better and or correct? foreach my $bag (@bags){ $bags_ordered{$bag} = $bag unless exists $bags_ordered{$bag} } Thanks! Dave == Cora Connection: Your West African Music Source Resources, Recordings, Instruments More! http://www.coraconnection.com/ == -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Trouble with CGI::Carp
I am trying to prevent generic crashes going to the browser in my CGI program. I am using : use CGI::Carp 'fatalsToBrowser'; and eventually I will use a set_message. However I have a strange problem in that the following subroutine, if there are errors on the statement execution, it does not send the error to the browser. I can put my own 'die' in there and it works. I am forced to use the 'eval' statement, as you can see on the first SQL statement. Would be grateful for any guidance. Gary sub add_record { (code snipped here and there for brevity). ### Subject ### if($add_subject) { my $sql = SQL1; INSERT INTO valid_subjects values('$login','$subject',NULL) SQL1 # Execute the SQL statement. $sth= $dbh-prepare($sql) or die preparing: ,$dbh-errstr; eval { $sth-execute }; if ($@) { failure($co); } } ### From address ### if($add_from_addr) { my $sql = SQL2; INSERT INTO valid_senders values('$login','$fromaddress',NULL) SQL2 # Execute the SQL statement. $sth= $dbh-prepare($sql) or die preparing: ,$dbh-errstr; $sth-execute or die (failure($co)); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Previous and Next
Octavian == Octavian Rasnita [EMAIL PROTECTED] writes: Octavian You need to use Javascript. Octavian a href=javascript:history.back()Back/a If the answer is javascript, you asked the wrong question. And if you think a user can't figure out how to press the back button when they want to do that, how in the world are they going to click on a link that could do the same thing? The biggest problem here is in the original question: Octavian How can i write a PERL Script to simulate the Previous (-) and Next (-) Octavian Links Octavian (like in IE or Netscape). As in, what could that possibly mean? That's either impossible or mis-specified. We need to know more before we could even begin to write code or answer it. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ASN1.pm
On Wed, 12 Mar 2003 12:02:52 -0500, [EMAIL PROTECTED] (Susan Aurand) wrote: I am getting an error can't locate ASN1.pm, I have tracked that down to - I need Convert-BER-1.25.tar.gz. I have downloaded the file. I cannot find the documents on this download, where to unzip and load, etc... Does anybody know. Thanks - Susan You must be using windows. A tar.gz file is like a zip file on windows. You can get untar programs that run on windows, but I don't think that will help you any to run it on a windows version of Perl. You should see if you can get the Convert-BER package for the particular version of Perl for windows that you have. If you need a free untar program, go search for untar or tar on www.nonags.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ASN1.pm
From: zentara [EMAIL PROTECTED] On Wed, 12 Mar 2003 12:02:52 -0500, [EMAIL PROTECTED] (Susan Aurand) wrote: I am getting an error can't locate ASN1.pm, I have tracked that down to - I need Convert-BER-1.25.tar.gz. I have downloaded the file. I cannot find the documents on this download, where to unzip and load, etc... Does anybody know. Thanks - Susan You must be using windows. A tar.gz file is like a zip file on windows. You can get untar programs that run on windows, WinZip understands .tar.gz and most other similar programs do as well. but I don't think that will help you any to run it on a windows version of Perl. You should see if you can get the Convert-BER package for the particular version of Perl for windows that you have. You might have been right five years ago, but not now. Most CPAN modules can be instaled under Windows just like anywhere else. The only problem is that the base install of Windows doesn't contain a C compiler, but 1) you don't need it for Perl-only modules (ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe is enough) and 2) you may use the compiler that comes with cygwin or some others. Convert::BER is pure Perl so if you are using ActivePerl, download the nmake, unpack the .tar.gz into a temporary dir and run perl Makefile.PL nmake nmake test nmake install and you should be fine. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]