newbie cspan example question

T

ToddAndMargo

Hi All,

A am real new to Perl. My background is Modula2 and Bash scripts.
I love all the examples at CSPAN.

I have been looking at:
http://search.cpan.org/~ugansert/Paw-0.54/Paw/Popup.pm

@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);

Having run the example and being told that something important
was missing (Popup::new) I though I had better ask the following
questions:

1) On the page, it lists the "source" for popup::new. Is this a
standard function library that
I have to import into my code (like a library or external module in
Modula2)?
If so, what is the syntax?

2) Do I instead, copy and paste the source code into the top (or
bottom) of my test program
and simple use it as a subroutine?

3) Are these examples all coded into a standard library that I simple
call out
in my code? If so, where do I download them? And, what is the syntax
to import them into my test program?

Many thanks,
--T
 
M

Mirco Wahab

Thus spoke (e-mail address removed) (on 2006-10-06 02:02):
I have been looking at:
http://search.cpan.org/~ugansert/Paw-0.54/Paw/Popup.pm

@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);

Having run the example and being told that something important
was missing (Popup::new) I though I had better ask the following
questions:

'paw' seems to be an old SuSE-related package
for drawing text shapes and stuff on top of
the unix 'curses' library. You need to have
that installed.

The 'paw'-documentation doesn't seem to help
much, its not longer maintained and I guess
nobody uses it much (could be wrong here).

The 'modules' you need, which are mostly
given in the 'paw'-examples, must be
installed before to your Perl-system
by the 'cpan' script.

$> cpan

will first brag about itself, ask
you some things and will allow you,
finally, to install things:

#[CPAN]> install Paw

the CPAN-programm will then try to load the
module from one of the internet archives
and install it on your computer. Do this
with all the modules you need.

Then you can use the Paw module and its
descendents by including it on top of
your script file:

-----[myfile.pl]----------

use Curses;
use Paw;
use Paw::Button;
use Paw::Box;
use Paw::Window;
...

# enter your Paw-related code here


The 'use' statements will load the
Paw-Modules (if you installed them before)
and the Rest of your program will know now
what to do if it stumbles upon:

...
@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);
...


In the end, it turns out the Perl-Module
System (CPAN) is one of the best
"Software-Block" providing systems
in existence.

Regards

Mirco
 
J

J. Gleixner

Hi All,

A am real new to Perl. My background is Modula2 and Bash scripts.
I love all the examples at CSPAN.

Too much drama, on CSPAN. :)

There's no need to put 'newbie' in every subject, just set the
subject to something that briefly states your question.
I have been looking at:
http://search.cpan.org/~ugansert/Paw-0.54/Paw/Popup.pm

@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);

Having run the example and being told that something important
was missing (Popup::new) I though I had better ask the following
questions:

Possibly going through a few tutorials will get you up to speed
faster than posting a question every time something doesn't work.

http://www.perlmonks.org/index.pl?node=Tutorials

There are also plenty of books ( perldoc perlbook ), tutorials, and
online documentation, along with the documentation that came along
with your installed version of perl.
 
T

ToddAndMargo

Mirco said:
Thus spoke (e-mail address removed) (on 2006-10-06 02:02):
I have been looking at:
http://search.cpan.org/~ugansert/Paw-0.54/Paw/Popup.pm

@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);

Having run the example and being told that something important
was missing (Popup::new) I though I had better ask the following
questions:

'paw' seems to be an old SuSE-related package
for drawing text shapes and stuff on top of
the unix 'curses' library. You need to have
that installed.

The 'paw'-documentation doesn't seem to help
much, its not longer maintained and I guess
nobody uses it much (could be wrong here).

The 'modules' you need, which are mostly
given in the 'paw'-examples, must be
installed before to your Perl-system
by the 'cpan' script.

$> cpan

will first brag about itself, ask
you some things and will allow you,
finally, to install things:

#[CPAN]> install Paw

the CPAN-programm will then try to load the
module from one of the internet archives
and install it on your computer. Do this
with all the modules you need.

Then you can use the Paw module and its
descendents by including it on top of
your script file:

-----[myfile.pl]----------

use Curses;
use Paw;
use Paw::Button;
use Paw::Box;
use Paw::Window;
...

# enter your Paw-related code here


The 'use' statements will load the
Paw-Modules (if you installed them before)
and the Rest of your program will know now
what to do if it stumbles upon:

...
@butt=('Okay', 'Cancel');
$text=('Do you really want to continue ?');
$pu=Popup::new(height=>20, width=>20,
buttons=>\@butt, text=>\$text);
...


In the end, it turns out the Perl-Module
System (CPAN) is one of the best
"Software-Block" providing systems
in existence.

Regards

Mirco

Thank you!

The cpan script sounds a lot like YUM. And, the "use" statement is on
the same
lines as Modula2's use of external modules. :)
 
B

Ben Morrow

Quoth (e-mail address removed):
Mirco said:
Thus spoke (e-mail address removed) (on 2006-10-06 02:02):
Having run the example and being told that something important
was missing (Popup::new) I though I had better ask the following
questions:

'paw' seems to be an old SuSE-related package
for drawing text shapes and stuff on top of
the unix 'curses' library. You need to have
that installed.

[use CPAN.pm to install it]

The cpan script sounds a lot like YUM.

If you use an OS with a package manager (which I presume is what YUM is)
then it is probably worth looking to see if you can install Perl modules
as packages, rather than using CPAN.pm. If the module you want isn't
provided by your OS as a package, then at least make sure CPAN.pm
installs its packages somewhere different from your OS's package
manager: having two package management systems fighting over one set of
files is a recipe for Pain. Recent(ish) versions of Perl, if configured
as recommended, have three separate module trees (per installed version
of Perl): one for 'core modules', which come with Perl; one for 'vendor
modules', which are installed by the OS package manager; and one for
'site modules', installed with CPAN.pm or manually by the sysadmin.
And, the "use" statement is on
the same
lines as Modula2's use of external modules. :)

Yes. Pretty much every modern language provides this facility.

Ben
 
T

Tad McClellan

I think you've hit the nail on the head :) If we all just killfile any
post with "newbie"


Many folks _do_ do that.

That is preciously why not including it in the Subject is included
in the guidelines.

The starting point for writing the guidelines was reviewing the
killfiles of several regular posters with an aim of providing
guidelines to help avoid such a fate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top