comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 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
  The map function         


Author: mynews
Date: Apr 18, 2008 20:30

Whis is difference between map and for-each?
Why the map function is fast than for-each? <== is it for all case?
42 Comments
  FAQ 4.44 How do I test whether two arrays or hashes are equal?         


Author: PerlFAQ Server
Date: Apr 18, 2008 18: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.44: How do I test whether two arrays or hashes are equal?

The following code works for single-level arrays. It uses a stringwise
comparison, and does not distinguish defined versus undefined empty
strings. Modify if you have other needs.

$are_equal = compare_arrays(\@frogs, \@toads);
Show full article (2.81Kb)
no comments
  Form Post         


Author: zoomcart.com
Date: Apr 18, 2008 16:17

Hello and thanks in advance for your help.
I have code below that posts form data to a perl cgi scripted shopping
cart and it works great on my mac/firefox browser, but it doesn't work
on ibm/netscape machines. what gives? apparently the data isn't being
recognized and so the cart defaults to it's home page.








Show full article (0.84Kb)
1 Comment
  Looking for a utility that lists all the functions under a preprocessing directive in a C++ file .         


Author: Avi
Date: Apr 18, 2008 13:24

I'm looking for a utility that will scan a C++ file and list all the
functions under a preprocessing directive.

In the example code below:
Upon request to list all the files under the preprocessing directive
AAA
the utiltiy should report
foo1
foo2

Upon request to list all the files under the preprocessing directive
BBB
the utiltiy should report
foo3

Thanks,
Avi

main()
{
}

#ifdef AAA
Show full article (0.55Kb)
1 Comment
  FAQ 5.24 How do I randomly update a binary file?         


Author: PerlFAQ Server
Date: Apr 18, 2008 12:03

This is an excerpt from the latest version perlfaq5.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 .

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

5.24: How do I randomly update a binary file?

If you're just trying to patch a binary, in many cases something as
simple as this works:

perl -i -pe 's{window manager}{window mangler}g' /usr/bin/emacs

However, if you have fixed sized records, then you might do something
more like this:
Show full article (1.85Kb)
no comments
  Selecting Default Gateway         


Author: Cosmic Cruizer
Date: Apr 18, 2008 10:45

I'm using IO::Socket to test a port on a remote server on the Internet from
our intranet. I need to make sure I go through the same proxy server each
time. I believe I can direct my port probe to use the proxy server as the
default gateway, which would solve my problem. From what I can tell,
IO::Socket does not allow me to do that.

Is there a module that will let me enter a value for a default gateway so I
can dictate which proxy server I want to pass through?
4 Comments
  weird bug         


Author: kj
Date: Apr 18, 2008 10:27

The following short module illustrates a puzzling bug:

use strict;
package Foo;
my $x = +{ 1 => 'one' };

sub foo {
keys %%$x if 0; # should do nothing
my $y = eval '$x'; die if $@;
printf "%%d\n", scalar keys %%$y;
}

1;
__END__

OK, now: the following one-liner produces the expected output:

%% perl -MFoo -e 'Foo::foo()'
1

...but if one comments-out the first line of Foo::foo, the output changes:

%% perl -MFoo -e 'Foo::foo()'
0
Show full article (1.23Kb)
4 Comments
  HTTP::Recorder and WWW::Mechanize for testing web sites         


Author: M.O.B. i L.
Date: Apr 18, 2008 09:33

Hi,
WWW::Mechanize is a Perl module that simulates a web browser.
You can use HTTP::Recorder to write WWW::Mechanize code automatically as
you surf, see the article:
http://www.perl.com/pub/a/2004/06/04/recorder.html

Then you can improve this code with variables and loops and use it for
testing of web sites.

I saved the proxy server program in the article and started it:
./proxy.pl &

I reconfigured Firefox to use the proxy server in
Preferences/Advanced/Network/Connection Settings. It's on port 8080 on
localhost, and use this for all protocols. Remember to remove localhost
and 127.0.0.1 from 'No Proxy for' if you test against a local web server.

Then I test my web application using a newly reseted test database.

After that I stop the proxy:
kill -15 %%1

And reset the database.
Show full article (1.67Kb)
no comments
  sending email from perl using a pipe and mailx         


Author: bl8n8r
Date: Apr 18, 2008 07:05

#!/usr/bin/perl

# the main user to send the email to
$recip = 'mainuser@domain.org';

# a comma separated list of users to CC the email too
$cclist = 'ccuser1@domain.org,ccuser2@domain.org';

# open a pipe to the mailx utility and feed it a subject along with
# recipients and the cclist
open (FI, "|/usr/bin/mailx -s 'TEST: New email message' $recip -c
$cclist");

# send the body of the email message and close.
# note: the email is not sent until the pipe is closed.
printf (FI "blah\nblah blah\n");
close (FI);
4 Comments
  FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?         


Author: PerlFAQ Server
Date: Apr 18, 2008 06:03

This is an excerpt from the latest version perlfaq1.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 .

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

1.4: What are Perl 4, Perl 5, or Perl 6?

(contributed by brian d foy)

In short, Perl 4 is the past, Perl 5 is the present, and Perl 6 is the
future.

The number after perl (i.e. the 5 after Perl 5) is the major release of
the perl interpreter as well as the version of the language. Each major
version has significant differences that earlier versions cannot
support.

The current major release of Perl is Perl 5, and was released in 1994.
It can run scripts from the previous major release, Perl 4 (March 1991),
but has significant differences. It introduced the concept of
references, complex data structures, and modules. The Perl 5 interpreter
was a complete re-write of the previous perl sources.
Show full article (2.18Kb)
2 Comments
 
1 2