comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
March 2008
motuwethfrsasuw
     12 9
3456789 10
10111213141516 11
17181920212223 12
24252627282930 13
31       14
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
  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)         


Author: tadmc
Date: Mar 31, 2008 23:18

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.63Kb)
no comments
  FAQ 7.27 How can I comment out a large block of perl code?         


Author: PerlFAQ Server
Date: Mar 31, 2008 18:03

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

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

7.27: How can I comment out a large block of perl code?

You can use embedded POD to discard it. Enclose the blocks you want to
comment out in POD markers. The <=begin> directive marks a section for a
specific formatter. Use the "comment" format, which no formatter should
claim to understand (by policy). Mark the end of the block with <=end>.

# program is here

=begin comment

all of this stuff

here will be ignored
by everyone

=end comment

=cut

# program continues
Show full article (1.86Kb)
no comments
  Returning a dataset with arrays         


Author: Macaruchi
Date: Mar 31, 2008 17:55

Hi!
I am a newbie using Perl and I have a big problem , for me, and it is
that I need to return a query result into a array but I cant do that.

I did this code:

sub getcodigodb()
{ local($table)= shift;
local($field)= shift;
my $code=shift;
my $dbh = open_connection();

my $sql = "SELECT * FROM $table WHERE $field=$code ";
my $sth = $dbh->prepare($sql);
$sth->execute or die "Unable to execute SQL query: $dbh->errstr
\n";

my $sth = $dbh->prepare($sql);
$sth->execute or die "Unable to execute SQL query: $dbh->errstr
\n";

$ref = $sth->fetchall_arrayref;

$sth->finish;
$dbh->disconnect;
Show full article (1.55Kb)
2 Comments
  glade whit multiple windows         


Author: Spocchio
Date: Mar 31, 2008 15:13

hi,
I'm making a glade-based tool: there is a window "father" that have to
open more child windows, here my code:

sub btnNewMessage_onclick
{
my $newWin = Gtk2::GladeXML->new('gui/wSMS.glade');
my $newForm = $newWin->get_widget('wSMS');
$newWin->signal_autoconnect_from_package('callbackSMS');
$newForm->show;
}

package callbackSMS;
my $ID;
sub init #it's on form.show()
{
$ID=rand(0,1000);
}
Show full article (0.75Kb)
no comments
  every combination of Y/N in 5 positions         


Author: joemacbusiness
Date: Mar 31, 2008 13:57

Hi All,

This has probably already been written but I did not see it on CPAN.
Is there a code snippent that can print every possible combination
of Y/N's in a 5 position array or string?

For example: Y Y Y Y Y becomes
N Y Y Y Y
Y N Y Y Y....
Y Y N N Y etc.

Here is my first attempt but it only handles a single field change
moving from left to right etc...

Thanks, --Joe Mac.

#!/usr/bin/perl

my @array = qw(Y Y Y Y Y);

&jumble(0);
&jumble(1);
&jumble(2);
&jumble(3);
&jumble(4);
Show full article (1.29Kb)
33 Comments
  FAQ 8.3 How do I do fancy stuff with the keyboard/screen/mouse?         


Author: PerlFAQ Server
Date: Mar 31, 2008 12:03

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

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

8.3: How do I do fancy stuff with the keyboard/screen/mouse?

How you access/control keyboards, screens, and pointing devices ("mice")
is system-dependent. Try the following modules:

Keyboard
Term::Cap Standard perl distribution
Term::ReadKey CPAN
Term::ReadLine::Gnu CPAN
Term::ReadLine::Perl CPAN
Term::Screen CPAN

Screen
Term::Cap Standard perl distribution
Curses CPAN
Term::ANSIColor CPAN
Show full article (1.76Kb)
no comments
  FAQ 8.6 How do I check whether input is ready on the keyboard?         


Author: PerlFAQ Server
Date: Mar 31, 2008 06:03

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

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

8.6: How do I check whether input is ready on the keyboard?

The easiest way to do this is to read a key in nonblocking mode with the
Term::ReadKey module from CPAN, passing it an argument of -1 to indicate
not to block:

use Term::ReadKey;

ReadMode('cbreak');

if (defined ($char = ReadKey(-1)) ) {
# input was waiting and it was $char
} else {
# no input was waiting
}

ReadMode('normal'); # restore normal tty settings

--------------------------------------------------------------------
Show full article (1.54Kb)
no comments
  FAQ 8.5 How do I read just one key without waiting for a return key?         


Author: PerlFAQ Server
Date: Mar 31, 2008 00:03

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

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

8.5: How do I read just one key without waiting for a return key?

Controlling input buffering is a remarkably system-dependent matter. On
many systems, you can just use the stty command as shown in "getc" in
perlfunc, but as you see, that's already getting you into portability
snags.

open(TTY, "+ system "stty cbreak /dev/tty 2>&1";
$key = getc(TTY); # perhaps this works
# OR ELSE
sysread(TTY, $key, 1); # probably this does
system "stty -cbreak /dev/tty 2>&1";
Show full article (3.55Kb)
no comments