function 'name' already defined, overrides struct accessor method at ./learning.pl line 6
Use of uninitialized value in printf at ./learning.pl line 23.
Hello
im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento)
typedef struct elemento
{
char name;
char value;
List<struct elemento> ltElementos;
... (7 Replies)
Hi,
Time for me to take a formal class/course on Perl. I was wondering if someone here can recommend an on-line class. My institution will cover the expenses, and therefore, I am not worry about the cost. I am lookin for a beginner course with possibilities to take intermediate and advance... (2 Replies)
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
Hi,
I believe the next code is wrong:
class Egg {
Egg e;
int i;
Egg(int ii=0) : i(ii) {}
};
because you would end up with an endless definition (memory allocation) of Egg objects, thus int i.
Ok, so God Eckel proposes for a singleton:
class Egg {
static Egg e;
int... (5 Replies)
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
I have the two class definition as follows.
class A { public: int a; };
class B : virtual public A{ };
The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Hello All,
I am a learner in C++. I was testing my inheritance knowledge with following piece of code.
#include <iostream>
using namespace std;
class base
{
public :
void display()
{
cout << "In base display()" << endl;
}
void display(int k)
{... (2 Replies)
Discussion started by: anand.shah
2 Replies
LEARN ABOUT DEBIAN
app::cmd::simple
App::Cmd::Simple(3pm) User Contributed Perl Documentation App::Cmd::Simple(3pm)NAME
App::Cmd::Simple - a helper for building one-command App::Cmd applications
VERSION
version 0.318
SYNOPSIS
in simplecmd:
use YourApp::Cmd;
Your::Cmd->run;
in YourApp/Cmd.pm:
package YourApp::Cmd;
use base qw(App::Cmd::Simple);
sub opt_spec {
return (
[ "blortex|X", "use the blortex algorithm" ],
[ "recheck|r", "recheck all results" ],
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
# no args allowed but options!
$self->usage_error("No args allowed") if @$args;
}
sub execute {
my ($self, $opt, $args) = @_;
my $result = $opt->{blortex} ? blortex() : blort();
recheck($result) if $opt->{recheck};
print $result;
}
and, finally, at the command line:
knight!rjbs$ simplecmd --recheck
All blorts successful.
SUBCLASSING
When writing a subclass of App::Cmd:Simple, there are only a few methods that you might want to implement. They behave just like the same-
named methods in App::Cmd.
opt_spec
This method should be overridden to provide option specifications. (This is list of arguments passed to "describe_options" from
Getopt::Long::Descriptive, after the first.)
If not overridden, it returns an empty list.
validate_args
$cmd->validate_args(\%opt, @args);
This method is passed a hashref of command line options (as processed by Getopt::Long::Descriptive) and an arrayref of leftover arguments.
It may throw an exception (preferably by calling "usage_error") if they are invalid, or it may do nothing to allow processing to continue.
execute
Your::App::Cmd::Simple->execute(\%opt, @args);
This method does whatever it is the command should do! It is passed a hash reference of the parsed command-line options and an array
reference of left over arguments.
WARNINGS
This should be considered experimental! Although it is probably not going to change much, don't build your business model around it yet,
okay?
App::Cmd::Simple is not rich in black magic, but it does do some somewhat gnarly things to make an App::Cmd::Simple look as much like an
App::Cmd::Command as possible. This means that you can't deviate too much from the sort of thing shown in the synopsis as you might like.
If you're doing something other than writing a fairly simple command, and you want to screw around with the App::Cmd-iness of your program,
Simple might not be the best choice.
One specific warning... if you are writing a program with the App::Cmd::Simple class embedded in it, you must call import on the class.
That's how things work. You can just do this:
YourApp::Cmd->import->run;
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-05 App::Cmd::Simple(3pm)