YaRness
01-25-2001, 11:32 AM
<edit> nevermind, i used the "h2xs" thingie to generate the module, and now it works.
Lno.pm
package Lno;
require 5.005_62;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use Lno ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(&prompt
);
our $VERSION = '0.01';
# Preloaded methods go here.
sub prompt
{
#gets one input for each prompt sent.
#returns either list or string, depending on what is wanted
my @values;
foreach (@_)
{
print;
my $input = <STDIN>;
chomp $input;
push @values, $input;
}
return wantarray ? @values : join($", @values);
}
1; # don't forget to return a true value from the file
test.pl
#!/usr/local/bin/perl -w
use strict;
use Lno;
#
my @list = prompt("Enter a thingie: ","Enter another thingie: ");
#
print @list;
that prompt function is my "get_user_input" from other posts... i'm not sure what to name it yet.
i'll prolly add the "mprint" thingie TLD and i hammered out too, just want to get all this module nastiness solid first
------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
[This message has been edited by YaRness (edited 25 January 2001).]
[This message has been edited by YaRness (edited 25 January 2001).]
Lno.pm
package Lno;
require 5.005_62;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use Lno ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(&prompt
);
our $VERSION = '0.01';
# Preloaded methods go here.
sub prompt
{
#gets one input for each prompt sent.
#returns either list or string, depending on what is wanted
my @values;
foreach (@_)
{
print;
my $input = <STDIN>;
chomp $input;
push @values, $input;
}
return wantarray ? @values : join($", @values);
}
1; # don't forget to return a true value from the file
test.pl
#!/usr/local/bin/perl -w
use strict;
use Lno;
#
my @list = prompt("Enter a thingie: ","Enter another thingie: ");
#
print @list;
that prompt function is my "get_user_input" from other posts... i'm not sure what to name it yet.
i'll prolly add the "mprint" thingie TLD and i hammered out too, just want to get all this module nastiness solid first
------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
[This message has been edited by YaRness (edited 25 January 2001).]
[This message has been edited by YaRness (edited 25 January 2001).]