beginner question on use of Frontier::Client


I'm attempting to write one of my first perl programs. It is to
interact with an internal web service. I'm having something basic going
wrong:

use Frontier::Client ;

# Parameter:
# login_id
#
# Output:
# login_id of manager

my @supervisor_info;
$server = Frontier::Client->new('url' => 'http://serverort/' );

foreach my $empno (@ARGV) {
@supervisor_info = Frontier::Client->call('GetInfoByEmpNo',
$empno);
if ( $#supervisor_info != 0 ) {
print "found $empno\n";
} else {
print "Unable to locate supervisor for $empno\n";
} ;
}

As you can see, I'm not trying to do anything with the data yet - in
fact, not even looking at the data yet. Just trying to get the basic
skeleton working, so that I know, moving on, that the basics are
working.

Of course, I have a real server and port URL in the new call.
And the method name comes from the documentation that the web service
have provided.

The error I get is:
Can't use string ("Frontier::Client") as a HASH ref while "strict refs"
in use at /usr/local/perl5/lib/site_perl/5.8.4/Frontier/Client.pm line
53.

(where that is the path to the pm file).

I appear to be missing something obvious. Given that I have not written
many perl programs, it is probably something embarassingly simple.

I was wondering if anyone could provide me a kind nudge in the right
direction

Posted On: Friday 26th of October 2012 12:15:34 AM Total Views:  304
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




A good Perl book for newbies/beginners using Windows?

! I am looking for a good hardcopy Perl book for newbies/beginners (including myself) who use Windows (not UNIX/Linux) and that isn't so old. After talking to my Linux friends who use Perl, they suggested these two: 1. http://oreilly.com/catalog/9781565923249/ (1997 though and mentions Windows NT) 2. http://www.amazon.com/Programming-Pe...ref=pd_sim_b_1 (has UNIX references; from 2000). However, my boss said "They seem a bit out of date. Perl has evolved from 1997 and 2000. We may need something more current." Any suggestions on recent revisions for Perl newbies who use Windows (XP-Vista) Thank you in advance. -- "An ant can do more than an ox that is lying down." --unknown /\___/\ / /\ /\ \ Ant @ http://antfarm.home.dhs.org (Personal Web Site) | |o o| | Ant's Quality Foraged Links (AQFL): http://aqfl.net \ _ / Please remove ANT if replying by e-mail. ( )
VIEWS ON THIS POST

185

Posted on:

Tuesday 16th October 2012
View Replies!

cannot post message to perl beginners

This is odd. I can post to this newsgroup but not to perl.beginners. Anyone any idea why this is so
VIEWS ON THIS POST

122

Posted on:

Wednesday 17th October 2012
View Replies!

Strange syntex: beginner

Group, I am new to learning Perl and am struggling with a syntex encountered in the code. It looks like < a.txt b.pl > signature My question is what does the first character (
VIEWS ON THIS POST

67

Posted on:

Saturday 20th October 2012
View Replies!

perl newbie question...................

Whats wrong with code excerpt below I put file test operators in an array list (arg) and 2 filenames in a 2nd array list (fname). I do a test if ( ("$arg $filename") ne 0) { print "yes\n" } else { print "yes\n" } ---------------------------------------------- #!/bin/perl -w @arg=('-e', '-d', '-r', '-w', '-x', '-S'); @is=("exists ", "directory ", "readable ", "writeable ", "executable ", "socket "); @fname=($0, "perl.exe"); foreach $filename(@fname) { $ndx=0; foreach $argument(@arg) { print "is $filename a ", $is[$ndx++]; if ( ("$argument $filename" ) ne 0) { print "yes\n"; } else { print "no\n"; } } }
VIEWS ON THIS POST

223

Posted on:

Saturday 20th October 2012
View Replies!

Simple Array question

Hi - I'm trying to assign to a variable the number of elements in a array for example. I have array with data: my @array_data; I want to assign the number of elements in the array to a variable, i tried this and looked it up and can't find a solution Say array_data contains {0,1,2,3,4,5} i want to assign the number of elements to a variable, in this case "6" to a variable. i tried this and failed... my $total = `0 + @{$results}`; Any help
VIEWS ON THIS POST

67

Posted on:

Saturday 20th October 2012
View Replies!

Perl-ish mail formatting question regarding "\t"

I'm stringing together some output that gets sent in a "plain text" email from Perl Net::SMTP to a POP server and is then pulled by the client. There's no MIME type, just plain text. I use \t to do some crude layout. Unfortunately the tab character seems to be ignored in MS Outlook/Express. It's in there, and if I view the raw message source in Outlook I can see the tabs working properly. But, it doesn't show up in the regular message viewing window. (Note: MS changes to a proportional font in the regular viewing window but I'd expect the tab to still space to some sort of indent). Thoughts on this Is there another character combo besides \t that would force the tab Is this just a specific MS Outlook specific flaw Do I need to spew MIME headers to get this to work properly (If so, I could use a pointer to a sample of proper MIME mail header spewing).
VIEWS ON THIS POST

55

Posted on:

Saturday 20th October 2012
View Replies!

Perl-ish mail formatting question regarding "\t"

I'm stringing together some output that gets sent in a "plain text" email from Perl Net::SMTP to a POP server and is then pulled by the client. There's no MIME type, just plain text. I use \t to do some crude layout. Unfortunately the tab character seems to be ignored in MS Outlook/Express. It's in there, and if I view the raw message source in Outlook I can see the tabs working properly. But, it doesn't show up in the regular message viewing window. (Note: MS changes to a proportional font in the regular viewing window but I'd expect the tab to still space to some sort of indent). Thoughts on this Is there another character combo besides \t that would force the tab Is this just a specific MS Outlook specific flaw Do I need to spew MIME headers to get this to work properly (If so, I could use a pointer to a sample of proper MIME mail header spewing).
VIEWS ON THIS POST

67

Posted on:

Saturday 20th October 2012
View Replies!

simple perl regex question

steve.logan wrote: > disclaimer - perl and shell scripting is not my area of expertise, but > I've been asked to help in updating a ton of DNS zone files. I've got > my scripts down to one last issue - updating the serial numbers in the > files. > > Basically, the serials are all 10 digt numbers followed by a ; > > I'm trying to write a regex to find 10 digits ([0-9]{10}), follwed by > a semi-colon ([;]) and then just replace it with 2007083100; > > Here's where I'm at - it runs ok, but the file isn't being updated: > > > perl -pi -e 's/\/([0-9]{10})([;])\//2007083100;/g' domain.com.db > > I think I'm close here - maybe Yes, hairs width (imho): $> perl -i -pe 's/(/2007083100/g' domain.com.db
VIEWS ON THIS POST

125

Posted on:

Monday 22nd October 2012
View Replies!

regex question

Trying to match a variable such as: $name or a hashvar such as: $name{var1} Tried s/\$(\w+)/g but that only matches $name. Also tried s/\$(\w+{\w*} - not working. Bob.
VIEWS ON THIS POST

113

Posted on:

Monday 22nd October 2012
View Replies!

cpan -- suppress questions

How do I make cpan assume yes to all questions, or not to ask any questions (the "batch mode") Can I put something into CPAN/MyConfig.pm for that
VIEWS ON THIS POST

106

Posted on:

Monday 22nd October 2012
View Replies!

A question about lists

Quoting part of perldoc -f grep "grep BLOCK LIST grep EXPR,LIST This is similar in spirit to, but not the same as, grep(1) and its relatives. In particular, it is not limited to using regu- lar expressions. Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value consist- ing of those elements for which the expression evaluated to true. In scalar context, returns the number of times the expression was true. @foo = grep(!/^#/, @bar); # weed out comments or equivalently, @foo = grep {!/^#/} @bar; # weed out comments " If @bar is an array, does this get converted to a list automatically Chad , hymie_@_lactose.homelinux.net (hymie!) writes: > In our last episode, the evil Dr. Lacto had captured our hero, > Sherm Pendley , who said: > >>Web Hosting by West Virginians, for West Virginians: http://wv-www.net > > Now *there's* a phone call I want to hear... > > "Just check our web site. it's doubleyou doubleyou doubleyou dot doubleyou > vee dash doubleyou doubleyou doubleyou ... no no, doubleyou vee dash > doubleyou doubleyou doubleyou ... " LOL! My personal email, sherm (at) dot-app.org, is even more fun. :-) Did I mention I try to stick to email whenever possible :-) sherm-- -- Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net
VIEWS ON THIS POST

121

Posted on:

Monday 22nd October 2012
View Replies!

Namespace resolution question: I'm somewhat puzzled

I am reorganizing some of my Perl code to place modules where they can be found via environment variable PERL5LIB. Some namespace issues are not working as I would have expected, and I have not been able to find a nice piece of documentation to explain this. For example, consider this scenario: I have directory MyLib (present in $PERL5LIB), which contains two subdirectories Foo and Bar. Foo contains a module FooTools.pm, and Bar contains BarTools.pm, i.e. the files MyLib/Foo/FooTools.pm and MyLib/Bar/BarTools.pm both exist. In FooTools.pm, I have: use Bar::BarTools; Later in FooTools.pm, I want to use a function func() that lives in BarTools.pm. I expected this to work: Bar::BarTools::func(); It did not, telling me that it could not find the function, though it is certainly present in MyLib/Bar/BarTools.pm. This, however, *did* work: BarTools::func(); Why is it that 'Bar' must be present in the 'use' statement (as I would in fact expect), but cannot be present when I call the function I would have expected a fully qualified name always to work. What would happen if there were a module BarTools in Foo, and I had done this in FooTools.pm: use Bar::BarTools; use Foo::BarTools; .... BarTools::func(); Would Bar::BarTools::func() work only if there were such a conflict
VIEWS ON THIS POST

92

Posted on:

Monday 22nd October 2012
View Replies!

RE: question about Ptk new version

No, Tcl/Tk 8.5 is not formally out yet. -- Indescribable,uncontainable,all powerful,untameable Even if explicitly stated to the contrary, nothing in this posting should be construed as representing my employer's opinions. -----Original Message----- From: Nick Ing-Simmons > I assume Tcl/Tk 8.5 is out then : > Have you heard of anyone >successfully managing to create Tk embedded .exe applications on OS X > I am not sure I understand the question (never having used an Apple in anger), so I am > copying my reply to mailing list where OS X users may be able to help. There is a MacTcl mailing list where developers should be able to help. -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
VIEWS ON THIS POST

88

Posted on:

Monday 22nd October 2012
View Replies!

Couple of questions about BrowseEntry & JComboBox widgets

Hi Folks, I would like to use BrowseEntry & JComboBox and have not been able to set the location of the label for these widgets. BrowseEntry has its on L.H.S and the JComboBox has it on the top. I could not find any reference to this in the manuals
VIEWS ON THIS POST

93

Posted on:

Tuesday 23rd October 2012
View Replies!

Namespace question for new SNMP modules

I'm currently working on releasing a new distribution which I'm calling Class::SNMP. As this is my first release to CPAN, I'm a bit apprehensive about some of the coding decisions I've made, and hope that I'll get some feedback after people look at what I've written. Firstly, though, I was hoping to get some namespace advice. With Class::SNMP, you can easily create your own class of an SNMP device which you need to get and set values on, and trap traps from. From my POD: package My::SNMPDevice; use base 'Class::SNMP'; __PACKAGE__->MakeMethods( mib => 'My-Custom-Device-MIB', mib_root => 'mycustomdevice', ); package main; use My::SNMPDevice; my $device = My::SNMPDevice->new( hostname => '192.168.1.25' ); print "Has a " . $device->Uptime . " uptime\n"; print "Port 4 is at speed " . $device->Ports->Entry(4)->Speed . " Mbps\n"; That's all fine and straight forward, and I feel confident that Class::SNMP is the appropriate place for this. However, when I get into traps, it gets more vague. For trap handling, I would like a way to represent a trap as something a bit more structured than a hashref. I've created a module SNMP::Trap which is a simple trap object with accessors (thanks to Class::Accessor) with object creation from a raw UDP trap packet (thanks to Mon::SNMP) or the output of snmptrapd. Is it appropriate for this to be SNMP::Trap Or should it be Net::SNMP::Trap Or something else And should I release it into a different distribution since it's out of the Class::SNMP namespace This trap object I then will pass to a wrapper into a user-specific class for dispatching. See this example code: use SNMP::Trap; use My::SNMPDevice; # A subclass of Class::SNMP my $trap = SNMP::Trap->parse_snmptrapd_from_stdin(); my $obj_trap = My::SNMPDevice->parse_trap($trap); # expects SNMP::Trap # $obj_trap isa Class::SNMP::Trap + My::SNMPDevice::Trap:: my $success = $obj_trap->dispatch({ alarmWarning => sub { 1 }; _namer => 'trap_%s', _default => \&trap_unhandled, }); if (! $success) { print "Couldn't dispatch for trap:\n" . $obj_trap->describe; } sub trap_alarmCritical { my ($trap) = @_; print $trap->hostname . " is critical: " . $trap->alarmInformation . "\n"; } So, is SNMP::Trap appropriate Additionally, in classic feature-creep programming style, I now am wanting to implement a Perl-based SNMP trap daemon since auto method generation code is slow and therefore using trap dispatch from snmptrapd.conf would be too slow. So, I'm thinking Net::Server::SNMP, but it wouldn't be a full SNMP server, just the a trapd, so would Net::Server::SNMP::Trap be more appropriate Or Net::SNMP::Server::Trap This would use the SNMP::Trap objects (above) as the basis for trap handling and dispatch, and would also seemingly need to be in a different distribution. One last question (I know, I have a lot). I've identified a bug or two in SNMP::Mib::Compiler (which I use heavily) and a needed extra feature to Convert::BER. These modules haven't been updated lately, and I was worried that I'll try and get patches to the maintainers and they won't be reachable. If a module is 5+ years old and the maintainer is not reachable (this is just hypothetical at this point), what's the protocol to handle updating the code
VIEWS ON THIS POST

84

Posted on:

Tuesday 23rd October 2012
View Replies!

Newbie Perl question

, I'm just learning Perl and I'm going through a book and there was an exercise in one of the chapters to write a simple subroutine to add up all the values that were passed as arguments. Simple enough, I implemented this as follows: sub total { my $sum; foreach (@_) { $sum += $_; } return $sum; } However, in the same chapter it says that if you do not put a return statement, the return value of the function is the result of the last calculation that occured in the function. So to test this I deleted the "return $sum;" line from the function. When the return line was there, it returned the correct value. Without that line, it appears to return undef. Can anyone explain
VIEWS ON THIS POST

72

Posted on:

Friday 26th October 2012
View Replies!

About regular expression question

On May 13, 8:35 am, "sonet" wrote: > The $str is the xml string. > > 123 > abc > ... > > I need to detect some specific close tag. > ex: > ( or ) OR ( or ) [ snip ] > And have any more good RE > pattern for above example see Perlfaq4: How do I find matching/nesting anything >> ================================ >> This isn't something that can be done in one regular >> expression, no matter how complicated. >> ================================ I would suggest to employ one of the XML modules on CPAN: http://search.cpan.org/searchquery=XML&mode=all -- Klaus
VIEWS ON THIS POST

95

Posted on:

Friday 26th October 2012
View Replies!

variable question

I'm new to Perl and have taken over a website built on the Interchange framework. I have a problem that i tracked down to two variables $URL $ and $EXPAND$. I know variables start with a $, but what's the significance of the $ after the variable name
VIEWS ON THIS POST

82

Posted on:

Friday 26th October 2012
View Replies!

Font question

I'm trying to get plain text printed in Courier font. When looking at CPAN, I find about 39 modules for handling fonts, but none for plain text. Is there a module for that BTW, I used font+courier as a search string in CPAN.
VIEWS ON THIS POST

81

Posted on:

Friday 26th October 2012
View Replies!

JComboBox Beginner's question

I really have looked at the Perldoc and done searches on google and this group. I have this really BASIC question about using JComboBox. use Tk; use Tk::JComboBox; my $mw = MainWindow->new; my $jcb = $mw->JComboBox( -choices => [qw/Black Blue Green Purple Red Yellow/], -textvariable => \$variable, )->pack; $sel = $jcb ->getSelectedIndex($variable); MainLoop; How do I get the choice so that I can use it later say in a simple report to the shell such as: print "$sel\n"; Sorry this is such a basic question. the fine docs on JComboBox seem to be about how to set it up. Things that let me get a value from Listbox do not work for me with JComboBox. , Thank you very much, Rob, for the example and the links. My brain really needs examples especially when learning new ways of doing things. In the JComboBox documentation you state that one needs to be careful about binding other things to JComboBox. Does this mean it cannot be set up to bind a key press once the item is selected I have an application using listboxes which allows you to select the item once you scroll to it by using a key press and then the focus is passed to the next listbox automatically. This is for selecting a series of attributes for a record where many of the attributes are in a series of predicatable sets. However I liked the idea of being able to have an editable additional attribute with JComboBox.
VIEWS ON THIS POST

88

Posted on:

Friday 26th October 2012
View Replies!