comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
December 2006
motuwethfrsasuw
    123 48
45678910 49
11121314151617 50
18192021222324 51
25262728293031 52
2006
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: DB access problems         


Author: John Bokma
Date: Dec 29, 2006 13:07

Sherm Pendley dot-app.org> wrote:
> I may have misinterpreted him, but I don't think the OP was asking
> about that. Based on the "\n" in his message, I think he was
> asking if a complete, valid HTML document is required in response to
> AJAX requests, and the answer to that is "no".

Yup true.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
no comments
  FAQ 4.58 How can I know how many entries are in a hash?         


Author: PerlFAQ Server
Date: Dec 29, 2006 12:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.58: How can I know how many entries are in a hash?

If you mean how many keys, then all you have to do is use the keys()
function in a scalar context:

$num_keys = keys %%hash;

The keys() function also resets the iterator, which means that you may
see strange results if you use this between uses of other hash operators
such as each().

--------------------------------------------------------------------
Show full article (1.41Kb)
no comments
  Re: DB access problems         


Author: John Bokma
Date: Dec 29, 2006 11:39

Sherm Pendley dot-app.org> wrote:
> "JoeyP" wright.edu> writes:

[..]
>> Questions: Do I have to build the HTML with statements like print
>> "\n"; in my CGI?
>
> Good $DEITY no!

Uhm, that depends. There is no problem with sending HTML ("AJAH") if
that's all you need.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
1 Comment
  Re: Debug question         


Author: JoeyP
Date: Dec 29, 2006 11:22

Paul Lalli wrote:
> JoeyP wrote:
>> I am accessing a (perl)CGI script from an HTML doc. Something is
>> blowing up in the CGI.
>> How do I send an 'alert' pop-up message while in the CGI?
>
> You don't. If something is "blowing up" in the CGI program, that
> program is not going to correctly create an HTML document that the
> browser can render. It is the browser's own Javascript that would
> process the alert box.
>
>> I tried print " alert("Error"); "; but that didn't work.
>
> Not surprising...
>
>> I am new to perl.
>
> The problem has nothing to do with Perl and everything to do with CGI.
> You seem to have a fundamental lack of understanding about what a CGI
> program is. ...
Show full article (1.07Kb)
no comments
  FAQ 4.69 How can I use a reference as a hash key?         


Author: PerlFAQ Server
Date: Dec 29, 2006 06:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.69: How can I use a reference as a hash key?

(contributed by brian d foy)

Hash keys are strings, so you can't really use a reference as the key.
When you try to do that, perl turns the reference into its stringified
form (for instance, "HASH(0xDEADBEEF)"). From there you can't get back
the reference from the stringified form, at least without doing some
extra work on your own. Also remember that hash keys must be unique, but
two different variables can store the same reference (and those
variables can change later).

The "Tie::RefHash" module, which is distributed with perl, might be what
you want. It handles that extra work.

--------------------------------------------------------------------
Show full article (1.72Kb)
no comments
  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.7 $)         


Author: tadmc
Date: Dec 29, 2006 00:10

Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information ...
Show full article (16.58Kb)
no comments
  FAQ 4.50 How do I select a random element from an array?         


Author: PerlFAQ Server
Date: Dec 29, 2006 00:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.50: How do I select a random element from an array?

Use the "rand()" function (see "rand" in perlfunc):

$index = rand @array;
$element = $array[$index];

Or, simply:

my $element = $array[ rand @array ];

--------------------------------------------------------------------
Show full article (1.30Kb)
no comments