niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl » modules
Install Picks Wrong Dir for Include Files
Post new topic   Reply to topic Page 5 of 6 [76 Posts] View previous topic :: View next topic
Goto page:  Previous  1, 2, 3, 4, 5, 6 Next
Author Message
Juha Laiho
*nix forums Guru Wannabe


Joined: 22 Feb 2005
Posts: 139

PostPosted: Sat Jan 14, 2006 12:11 pm    Post subject: Re: https / proxy problem (LWP::UserAgent) Reply with quote

"Larry" <larry_grant_dc@hotmail.com> said:
Quote:
Juha Laiho wrote:
"Larry" <larry_grant_dc@hotmail.com> said:
I have a script on Windows which uses LWP to make a simple GET request
through a proxy:
....
I also have Crypt::SSLeay installed so that I can access https sites.
When I try to run the script as above, it prints some HTTP headers and
an HTML-formatted error message from the firewall server which says
"Scheme not supported".

Could it be that LWP does not support HTTP 'CONNECT' method for working
with proxies? As it is this what is needed to proxy https requests:
you first make a 'CONNECT' request to the proxy, and then place your
https traffic in the connection that the proxy opened for you.

I took out the "get" call and replaced it with CONNECT as follows:

It wouldn't be quite that simple; 'CONNECT' is something that would leave
you with a connection to the proxy, and would instruct your proxy to
open a connection to the remote machine. Using the same connection
you should then start your SSL traffic.

However, I did dig a little bit deeper into Google with this issue, and
found the following discussion which appears to have a solution for you:
http://groups.google.fi/group/perl.libwww/browse_thread/thread/aee0e06b1404387/e28d1e3670a21ad5?lnk=st&q=%22https+through+proxy+with+libwww%22&rnum=1#e28d1e3670a21ad5

In short:
- with LWP and Crypt::SSLeay you should be able to do as documented in
Crypt::SSLeay documentation - that is, set environment variable
HTTPS_PROXY, and not set any proxy directives for LWP
(and after this in your perl code you just do 'GET' as you would
do without any proxy in between)
- with LWP and IO::Socket::SSL looks like accessing SSL sites through
a proxy is not possible (I'm happy to accept corrections for this)
- without LWP, HTTPS through proxy appears to be possible with just
Net::SSLeay
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Back to top
Larry
*nix forums Guru


Joined: 20 Feb 2005
Posts: 325

PostPosted: Tue Jan 17, 2006 3:23 pm    Post subject: Re: https / proxy problem (LWP::UserAgent) Reply with quote

Juha Laiho wrote:
Quote:
"Larry" <larry_grant_dc@hotmail.com> said:
Juha Laiho wrote:
"Larry" <larry_grant_dc@hotmail.com> said:
I have a script on Windows which uses LWP to make a simple GET request
through a proxy:
...
I also have Crypt::SSLeay installed so that I can access https sites.
When I try to run the script as above, it prints some HTTP headers and
an HTML-formatted error message from the firewall server which says
"Scheme not supported".


However, I did dig a little bit deeper into Google with this issue, and
found the following discussion which appears to have a solution for you:
http://groups.google.fi/group/perl.libwww/browse_thread/thread/aee0e06b1404387/e28d1e3670a21ad5?lnk=st&q=%22https+through+proxy+with+libwww%22&rnum=1#e28d1e3670a21ad5

In short:
- with LWP and Crypt::SSLeay you should be able to do as documented in
Crypt::SSLeay documentation - that is, set environment variable
HTTPS_PROXY, and not set any proxy directives for LWP
(and after this in your perl code you just do 'GET' as you would
do without any proxy in between)
- with LWP and IO::Socket::SSL looks like accessing SSL sites through
a proxy is not possible (I'm happy to accept corrections for this)
- without LWP, HTTPS through proxy appears to be possible with just
Net::SSLeay

I tried the first method you suggested and it worked perfectly! Thanks
so much... this is just what we needed! We were really out of ideas,
and this helped a whole lot.
Back to top
DJ Stunks
*nix forums Guru Wannabe


Joined: 20 Dec 2005
Posts: 192

PostPosted: Thu Apr 13, 2006 11:33 pm    Post subject: Re: Producing a hash of values from Parse::RecDescent... Reply with quote

Maybe I'll see if anyone in this group has any ideas, since it's really
a module question...

< original message follows >

TIA,
-jp


DJ Stunks wrote:
Quote:
Hello all,

I'm taking my first crack at using Pastor Conway's Parse::RecDescent.
My grammar works (after some hacking around) but I'm not sure how to
get my information into a hash in the way I'd like it.

Here's a copy of a short but complete script which demonstrates what
I'm trying to accomplish. Below is an example of the structure I'd
like returned once the parser is finished.

I tried to use <autotree> but I've hardly used objects at all, and, in
any event, I want to end up with all the variables in an array.

Does anyone have any insight as to how to capture this data as desired?
My next step is to buy Advanced Perl Programming (2nd Ed)...

Thanks in advance,
-jp

=========== Script ===========

#!/usr/bin/perl

use strict;
use warnings;

use Parse::RecDescent;

my $grammar = q{
<autotree

header : config_line(s?) 'OIDs(Variables):' variable_line(s?) /\z/

config_line : config_var /=/ config_value
config_var : /\w+/
config_value : /\S+/

variable_line : /Var-\d+ =/ oid <skip:'\('> variable_name
oid : /[.\d]+/
variable_name : /([^)]+)\)/
};

my $parser = Parse::RecDescent->new($grammar);

my $header = do {local $/; <DATA>};

if (my $header_obj = $parser->header($header) ) {
print "Valid Header\n";

use Data::Dumper;
print Dumper $header_obj;
}
else {
print "Invalid Header\n";
}

__DATA__
NodeName=XYZ_10.91.224.12
NodeAliasName=XYZ12-Headquarters
Category=Category.0.12
ConfName=Category.0.12
OIDs(Variables):
Var-1 = 1.3.6.1.4.1.1.2(IpAddress)
Var-2 = 1.3.6.1.4.1.1.16(PktsReceived)
Var-3 = 1.3.6.1.4.1.1.15(PktsRetransmitted)
Var-4 = 1.3.6.1.4.1.1.14(PktsSentSuccess)
Var-5 = 1.3.6.1.4.1.1.27(totalEgressBytes)
Var-6 = 1.3.6.1.4.1.1.22(totalForwardPktsDropped)
Var-7 = 1.3.6.1.4.1.1.26(totalIngressBytes)
Var-8 = 1.3.6.1.4.1.1.23(totalReversePktsDropped)
Var-9 = 1.3.6.1.4.1.1.25(totalEgressBytes)
Var-10 = 1.3.6.1.4.1.1.24(totalngressBytes)

=========== Desired Output ===========

$VAR1 = {
'Category' => 'Category.0.12',
'ConfName' => 'Category.0.12',
'NodeAliasName' => 'XYZ12-Headquarters',
'NodeName' => 'XYZ_10.91.224.12',
'Variables' => [
{
'name' => 'PktsReceived',
'oid' => '1.3.6.1.4.1.1.2'
},
{
'name' => 'PktsRetransmitted',
'oid' => '1.3.6.1.4.1.1.15'
},
{
'name' => 'PktsSentSuccess',
'oid' => '1.3.6.1.4.1.1.14'
},
{
'name' => 'totalEgressBytes',
'oid' => '1.3.6.1.4.1.1.27'
},
{
'name' => 'totalForwardPktsDropped',
'oid' => '1.3.6.1.4.1.1.22'
},
{
'name' => 'totalIngressBytes',
'oid' => '1.3.6.1.4.1.1.26'
},
{
'name' => 'totalReversePktsDropped',
'oid' => '1.3.6.1.4.1.1.23'
},
{
'name' => 'totalEgressBytes',
'oid' => '1.3.6.1.4.1.1.25'
},
{
'name' => 'totalngressBytes',
'oid' => '1.3.6.1.4.1.1.24'
}
]
};
Back to top
nobull@mail.com
*nix forums Guru Wannabe


Joined: 09 Nov 2005
Posts: 240

PostPosted: Tue Apr 18, 2006 7:01 pm    Post subject: Re: Producing a hash of values from Parse::RecDescent... Reply with quote

DJ Stunks wrote:

Quote:
Here's a copy of a short but complete script which demonstrates what
I'm trying to accomplish. Below is an example of the structure I'd
like returned once the parser is finished.

I tried to use <autotree> but I've hardly used objects at all, and, in
any event, I want to end up with all the variables in an array.

my $grammar = q{
<autotree

header : config_line(s?) 'OIDs(Variables):' variable_line(s?) /\z/

config_line : config_var /=/ config_value
config_var : /\w+/
config_value : /\S+/

variable_line : /Var-\d+ =/ oid <skip:'\('> variable_name
oid : /[.\d]+/
variable_name : /([^)]+)\)/
};

__DATA__
NodeName=XYZ_10.91.224.12
NodeAliasName=XYZ12-Headquarters
Category=Category.0.12
ConfName=Category.0.12
OIDs(Variables):
Var-1 = 1.3.6.1.4.1.1.2(IpAddress)
Var-2 = 1.3.6.1.4.1.1.16(PktsReceived)
Var-3 = 1.3.6.1.4.1.1.15(PktsRetransmitted)
Var-4 = 1.3.6.1.4.1.1.14(PktsSentSuccess)
Var-5 = 1.3.6.1.4.1.1.27(totalEgressBytes)
Var-6 = 1.3.6.1.4.1.1.22(totalForwardPktsDropped)
Var-7 = 1.3.6.1.4.1.1.26(totalIngressBytes)
Var-8 = 1.3.6.1.4.1.1.23(totalReversePktsDropped)
Var-9 = 1.3.6.1.4.1.1.25(totalEgressBytes)
Var-10 = 1.3.6.1.4.1.1.24(totalngressBytes)

=========== Desired Output ===========

$VAR1 = {
'Category' => 'Category.0.12',
'ConfName' => 'Category.0.12',
'NodeAliasName' => 'XYZ12-Headquarters',
'NodeName' => 'XYZ_10.91.224.12',
'Variables' => [
{
'name' => 'PktsReceived',
'oid' => '1.3.6.1.4.1.1.2'
},

<autotree> is IMHO a most useful tool for developing Parse::RecDecent -
you leave it in to provide default actions for each rule and
iteratively replace them with the actual actions you need for your
parser. Once you've done, you remove <autotree>.

Following this approach I was able to refine your grammar to...

header : config_line(s?) 'OIDs(Variables):' variable_line(s?) /\z/
{ $return = {
Variables => $item{'variable_line(s?)'},
map { %$_ } @{$item{'config_line(s?)'}}
};
}
config_line : config_var /=/ config_value
{ $return = {
$item{config_value} => $item{config_value}
}
}
config_var : /\w+/
{ $return = $item[1]; 1 }
config_value : /\S+/
{ $return = $item[1]; 1 }

variable_line : /Var-\d+ =/ oid <skip:'\('> variable_name
{ $return = {
oid => $item{oid},
name=> $item{variable_name},
}
}
oid : /[.\d]+/
{ $return = $item[1]; 1 }
variable_name : /([^)]+)\)/
{ $return = $item[1]; 1 }

Note: I return a reference to a single element hash in the config_line
rule. A two elment array would be maginally more efficient but less
ideomatic. Sweezing every last drop of efficiency is hardly relevant
when using a monster such as Parse::RecDescent.
Back to top
DJ Stunks
*nix forums Guru Wannabe


Joined: 20 Dec 2005
Posts: 192

PostPosted: Wed Apr 19, 2006 3:04 am    Post subject: Re: Producing a hash of values from Parse::RecDescent... Reply with quote

Brian McCauley wrote:
Quote:
DJ Stunks wrote:

Below is an example of the structure I'd
like returned once the parser is finished.

=========== Desired Output ===========

$VAR1 = {
'Category' => 'Category.0.12',
'ConfName' => 'Category.0.12',
'NodeAliasName' => 'XYZ12-Headquarters',
'NodeName' => 'XYZ_10.91.224.12',
'Variables' => [
{
'name' => 'PktsReceived',
'oid' => '1.3.6.1.4.1.1.2'
},

I was able to refine your grammar to...

header : config_line(s?) 'OIDs(Variables):' variable_line(s?) /\z/
{ $return = {
Variables => $item{'variable_line(s?)'},
map { %$_ } @{$item{'config_line(s?)'}}
};
}
config_line : config_var /=/ config_value
{ $return = {
$item{config_value} => $item{config_value}
}
}
config_var : /\w+/
{ $return = $item[1]; 1 }
config_value : /\S+/
{ $return = $item[1]; 1 }

variable_line : /Var-\d+ =/ oid <skip:'\('> variable_name
{ $return = {
oid => $item{oid},
name=> $item{variable_name},
}
}
oid : /[.\d]+/
{ $return = $item[1]; 1 }
variable_name : /([^)]+)\)/
{ $return = $item[1]; 1 }

Note: I return a reference to a single element hash in the config_line
rule. A two elment array would be maginally more efficient but less
ideomatic. Sweezing every last drop of efficiency is hardly relevant
when using a monster such as Parse::RecDescent.

Many thanks, Brian. I did eventually pick up Advanced Perl Programming
and I was able to come to a nearly identical grammar after digesting
the iCal parser from the book.

If I were to go with autotree output as I originally did, how does one
access the objects? (I haven't done much with Perl objects)

Thanks again, I appreciate it :)

-jp
Back to top
nobull@mail.com
*nix forums Guru Wannabe


Joined: 09 Nov 2005
Posts: 240

PostPosted: Wed Apr 19, 2006 7:41 pm    Post subject: Re: Producing a hash of values from Parse::RecDescent... Reply with quote

Brian McCauley wrote:

Quote:
config_line : config_var /=/ config_value
{ $return = {
$item{config_value} => $item{config_value}
}
}

That should, of course, say...

$item{config_var} => $item{config_value}
Back to top
DJ Stunks
*nix forums Guru Wannabe


Joined: 20 Dec 2005
Posts: 192

PostPosted: Wed May 03, 2006 9:20 pm    Post subject: Re: match nested tags Reply with quote

Hey guys, I'm not getting any responses over at perl.beginners so I
thought I'd cross post this here to see if anyone has any ideas.

Here's the original message:

FangQ wrote:
Quote:
hi

is there a simple way using regular expression to find nested tags?

for example, the string is:

{{ {A} this is part A of the document
{{ {A.1} this is part A1 }}
}}

I want to define a function findtag("A") to give me

this is part A of the document
{{ {A.1} this is part A1 }}


and findtag("A.1") to give me

this is part A1

can anyone give some hint?
thanks

I thought this sounded like a prime candidate for Parse::RecDescent,
but I can't get the nested nature of the part(s) to work.

Here's my first crack at it, but it doesn't parse. I monkeyed with it
for a while, but to no avail.

I did note, however, that in the Parse::RecDescent FAQ, Pastor Conway
suggests using Text::Balanced to extract nested parenthesis. I tried
that too, but again, no luck.

I'd be interested to see if anyone here has a suggestion for this
problem. Thanks in advance.

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Parse::RecDescent;

my $grammar = <<'EO_GRAMMAR';
<autotree>

document : '{{' part(s) '}}'

part : part_id part_text part(s?)
part_id : '{' /[^}]+/ '}'
part_text : /.+/s

EO_GRAMMAR

my $parser = Parse::RecDescent->new($grammar)
or die "Could not parse grammar: $@";

my $document = do {local $/; <DATA>};

my $doc_ref = $parser->document($document)
or die "Invalid document";

print Dumper $doc_ref;


__DATA__
{{ {A} this is part A of the document
{{ {A.1} this is part A1 }}
}}

__END__

-jp
Back to top
DJ Stunks
*nix forums Guru Wannabe


Joined: 20 Dec 2005
Posts: 192

PostPosted: Wed May 03, 2006 10:04 pm    Post subject: Re: match nested tags Reply with quote

DJ Stunks wrote:
Quote:
FangQ wrote:
is there a simple way using regular expression to find nested tags?

for example, the string is:

{{ {A} this is part A of the document
{{ {A.1} this is part A1 }}
}}

Allow me to just reply to myself here... :P

I repaired my crummy grammar and posting technique (who would have
thought __END__ would end up in __DATA__?). My grammar now parses and
is shown below (getting there!), now I need to concentrate on getting
the output hash right.

Also, I'm not able to have a { or } in the part_text, which I expect
would be a problem in the real world.... I don't know how to
incorporate Text::Balanced here though....

I'll keep working on it.

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Parse::RecDescent;

my $grammar = <<'EO_GRAMMAR';
<autotree>

document : part(s)

part : '{{' part_id part_text part(s?) '}}'
part_id : '{' /[^}]+/ '}'
part_text : /[^{}]+/

EO_GRAMMAR

my $parser = Parse::RecDescent->new($grammar)
or die "Could not parse grammar: $@";

my $document = do {local $/; <DATA>};

my $doc_ref = $parser->document($document)
or die "Invalid document";

print Dumper $doc_ref;

__DATA__
{{ {A} this is part A of the document
{{ {A.1} this is part A1 }}
}}

-jp
Back to top
Alan J. Wylie
*nix forums beginner


Joined: 22 Feb 2006
Posts: 2

PostPosted: Thu May 18, 2006 7:15 pm    Post subject: Re: ActivePerl error message? Router script. Please help.Newbie Reply with quote

Firstly, as the original author of this code, my apologies to the perl
groups for the inconvenience.

The original posting was accompanied by the text:

| Notes: you will need to:
| run the script as root if you use ICMP echo requests
| change the IP addresses that it pings
| change the username and password
| change the command to reboot the system
| do a bit of tidying up, especially if you are using Windows

| Apologies to any Perl hackers out there for the coding style, from an
| old fart who still thinks in Algol-60, -68, Fortran and C.

On 18 May 2006 08:52:12 -0700, wrreisen2@yahoo.com said:

Quote:
I have commented out all to do with the Mailer and Syslog now. I get
the error message:

CGI Error The specified CGI application misbehaved by not returning
a complete set of HTTP headers. The headers it did return are:

How on earth are you getting those errors? This script has nothing to
do with the web, browsers or HTTP. Run the script from a command line.

Quote:
'ip' is not recognized as an internal or external command, operable
program or batch file. problem connecting to "192.168.0.254", port
23: Unknown error at c:\inetpub\wwwroot\perl\router_be.pl line 61

192.168.0.254 is the IP of my router on my network. Why have a go on
port 23?

Sorry forgot. This is the code now. Thanks.

<snippage>

Quote:
use Net::Telnet;

Telnet is a ancient protocol used as a command line interface
to remote computers. It runs on port 23.

Windows has (or did last time I looked) a telnet application. You can
probably invoke it with something like Windows Menu->Run Command and
enter telnet in the box. Supply the IP address of your router, and see
if you get a response. Then see what commands it accepts. "help" or "?"
(without the quotes) are often useful.

Quote:
my $localip = "192.168.0.254";

That's the same as my IP router's IP address. Coincidence? Or do you need to
change it?

Quote:
# a list of IP addresses to ping that are 1) few hops away, and 2)
# likely to be stable

my @netips = ("0.0.0.0", "0.0.0.1", "0.0.0.2", "0.0.0.3",
"192.36.148.17" );

Most of those IP addresses are clearly invalid, and as I originally said,
you will need to change them.

Quote:
# if your router asks for a username and password, use this:
$t->login("Administrator", "xxx" ) or die "login failed";

# else if it just prompts for a password use this:

$t->waitfor("/Password:/" ) or die "login waitfor 1 failed";
$t->print("xxx" ) or die "login print failed";
$t->waitfor("/> /" ) or die "login waitfor 2 failed";

Read the comments! There are two options here, you only need one. You
also need to change the password to match that set on your router.

Quote:
@lines = $t->cmd("adsl status");
# or perhaps
@lines = $t->cmd("adsl info");

Again, you only need one of these lines.

Quote:
$t->print("system reboot");
# or perhaps
$t->print("sys reboot");

And again!

--
Alan J. Wylie http://www.wylie.me.uk/
"Perfection [in design] is achieved not when there is nothing left to add,
but rather when there is nothing left to take away."
-- Antoine de Saint-Exupery
Back to top
Sisyphus
*nix forums Guru


Joined: 04 Mar 2005
Posts: 503

PostPosted: Sun Jun 18, 2006 12:40 am    Post subject: Re: use bigmnum Reply with quote

"gamo" <gamo@telecable.es> wrote in message
news:Pine.LNX.4.64.0606161644010.11351@jvz.es...

#!/usr/local/bin/perl -w

use bignum;

$fact=1;
for $i (2..1000){
$fact*=$i;
}
print "$fact\n";
$div = int ($fact/2003);
$resto = $fact - $div*2003;
# $resto = $fact % 2003;
print "$resto\n";

__END__

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

I think that what you wanted to achieve using int() should already be done
for you anyway - and calling int() leads to an error (for me, anyway) -
namely that $div then evaluates as 'NaN'.

However, it also looks like there's a bug in Math::BigInt.

For me $div (without the int call) is being evaluated as:
200892291601145169018323731364455309894800000000000000000000000000000000....

It should be:
200892291601145169018323731364455309894845164358819087640439296270563411....

You should file a bug report about this - or at least let the current
maintainer of the module know.

Both Math::Pari and Math::GMP should yield correct results.

Incidentally, for me (perl 5.8.Cool, '$resto = $fact % 2003;' evaluates
correctly.

Cheers,
Rob
Back to top
Tim Heaney
*nix forums beginner


Joined: 26 Apr 2005
Posts: 16

PostPosted: Sun Jun 18, 2006 1:20 am    Post subject: Re: use bigmnum Reply with quote

"Sisyphus" <sisyphus1@nomail.afraid.org> writes:
Quote:

However, it also looks like there's a bug in Math::BigInt.

For me $div (without the int call) is being evaluated as:
200892291601145169018323731364455309894800000000000000000000000000000000....

This appears to be the default 40 digits we get from
Math::BigFloat->div_scale.

Quote:
It should be:
200892291601145169018323731364455309894845164358819087640439296270563411....

I get this when I use the bigint pragma, rather than bignum.

And % works for me too...with either bignum or bigint.

Tim
Back to top
Tim Heaney
*nix forums beginner


Joined: 26 Apr 2005
Posts: 16

PostPosted: Sun Jun 18, 2006 1:45 am    Post subject: Re: use bigmnum Reply with quote

Quote:
"gamo" <gamo@telecable.es> wrote in message
news:Pine.LNX.4.64.0606161644010.11351@jvz.es...

#!/usr/local/bin/perl -w

use bignum;

$fact=1;
for $i (2..1000){
$fact*=$i;
}
print "$fact\n";

As a side note, the module already knows how to calculate factorial.

$fact = Math::BigInt->bfac(1000);

Tim
Back to top
Sisyphus
*nix forums Guru


Joined: 04 Mar 2005
Posts: 503

PostPosted: Sun Jun 18, 2006 2:09 am    Post subject: Re: use bigmnum Reply with quote

"Tim Heaney" <theaney@gmail.com> wrote in message
..
..
Quote:

It should be:

200892291601145169018323731364455309894845164358819087640439296270563411....

I get this when I use the bigint pragma, rather than bignum.

Yes, I think I was mistaken - the problem only arises when bignum is
invoked. Using M::BI instead of bignum seems to fix things.

Btw, I think at least some newsreaders (and possibly the archives) are going
to show my post (and the follow-ups) as a separate thread from the
original - "use bigmnum" versus "use bignmum?". Sorry 'bout that .... some
curly issues with my newsreader that I didn't quite workaround as I had
hoped :-)

Cheers,
Rob
Back to top
Mumia W.
*nix forums Guru Wannabe


Joined: 08 May 2006
Posts: 153

PostPosted: Tue Jul 11, 2006 7:19 am    Post subject: Re: Curses::UI: No definition found for '< Yes >' Reply with quote

Chasecreek Systemhouse wrote:
Quote:
On 7/10/06, Mumia W. <mumia.w.18.spam+nospam@earthlink.net> wrote:
I'm trying to learn to use Curses::UI, and I read the top of "perldoc
Curses::UI" and found some example code. Unfortunately, it doesn't work.
This is my program:

#!/usr/bin/perl

use strict;
use warnings;
use Curses::UI;

my $cui = new Curses::UI (-color_support => 1);
my $my = $cui->dialog(
-message => 'Hello World.',
-buttons => ['< Yes >', '< No >'],
-values => [1, 0],
-title => 'First Dialog',
);

__END__

When I run this program, I get this error message:

Fatal program error:
------------------------------------------
process_buttondefs(): Invalid button type.
No definition found for '< Yes >'
------------------------------------------
Press any key to exit...


The Curses::UI refers you to a more appropriate example. The example's syntax:

use FindBin;
use lib "$FindBin::RealBin/../lib";

use strict;
use Curses::UI;
[...]

In other words, the < Yes > was supposed to be the label of a button;
not a button itself...

HTH/Sx

Thanks. I wanted something simple to start with, and after reading
Curses::UI::Buttonbox's doc page, I created a simple example that works:

#!/usr/bin/perl

use strict;
use warnings;
use Curses::UI;

my $cui = new Curses::UI (-color_support => 1);

my $my = $cui->dialog(
-message => 'Hello World.',
-buttons => ['yes', 'no'],
-values => [1, 0],
-title => 'First Dialog',
);

__END__

'Yes' and 'no' are pre-defined button names. Perhaps the example code in
Curses::UI should be changed.
Back to top
Mumia W.
*nix forums Guru Wannabe


Joined: 08 May 2006
Posts: 153

PostPosted: Tue Jul 11, 2006 9:37 am    Post subject: Re: Curses::UI: No definition found for '< Yes >' Reply with quote

Mumia W. wrote:
Quote:
[...] I created a simple example that works:

#!/usr/bin/perl

use strict;
use warnings;
use Curses::UI;

my $cui = new Curses::UI (-color_support => 1);

my $my = $cui->dialog(
-message => 'Hello World.',
-buttons => ['yes', 'no'],
-values => [1, 0],
-title => 'First Dialog',
);

__END__

'Yes' and 'no' are pre-defined button names. Perhaps the example code in
Curses::UI should be changed.



I mean, perhaps the documentation in Curses::UI should
be changed.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 5 of 6 [76 Posts] Goto page:  Previous  1, 2, 3, 4, 5, 6 Next
View previous topic :: View next topic
The time now is Thu Dec 04, 2008 12:03 am | All times are GMT
navigation Forum index » Programming » Perl » modules
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:57 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:56 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:56 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:55 am
No new posts RS6000 43p/140 AIX 4.3 new install - am stuck! remllov99x AIX 0 Tue Aug 21, 2007 11:07 pm

Mortgage Calculator | Credit Cards UK | Big Brother 9 | Loans | Teen Chat
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.9644s ][ Queries: 16 (0.7502s) ][ GZIP on - Debug on ]