Re: How to parse XML content using lwp agent or XML Smart

2014-08-25 Thread angus
age); my $xml = XML::Smart->new($resp->decoded_content); my $dest = $xml->{PHC_LOGIN}{REDIRECTURL}; print "Location: $dest\n\n"; On Aug 22, 2014, at 10:38 AM, Rob Dixon wrote: > On 22/08/2014 11:27, angus wrote: >> Hi, >> >> Hi, >> >> I hav

How to parse XML content using lwp agent or XML Smart

2014-08-22 Thread angus
e\r 0\r Login Successful\r https://example.com/cust/login.asp\r Thanks in advance for any tips you can provide. -angus

posting XML to a url and encoding issues.

2014-08-21 Thread angus
believe XML::Smart defaults to ASCII encoding or iso-8859-1 which I think are the same thing. I wonder though if LWP is using UTF-8 by default, and maybe that is causing me issues? Thanks in advance for any input you can provide. -angus #!/usr/bin/perl use LWP::UserAgent; use HTTP::Request; use

creating an XML document using xml::dom

2014-08-20 Thread angus
I am trying to recreate some code written in C# using perl. The goal is to create an XML formatted login packet and post it to http webserver and then parse the response. My first hurdle I think is to create the XML login packet. Here is the sample of what the login packet is supposed to lo

creating an XML document using xml::dom

2014-08-20 Thread angus
I am trying to recreate some code written in C# using perl. The goal is to create an XML formatted login packet and post it to http webserver and then parse the response. My first hurdle I think is to create the XML login packet. Here is the sample of what the login packet is supposed to lo

how to iterate through a list of files in a directory and compare them to an index.

2008-03-06 Thread Angus Glanville
$index: $!\n"; opendir (PDFDIR, $pdf_dir) || die "Can't open $pdf_dir: $!\n"; while (my $line = ) { chomp $line; my ($raw_name, $std_name) = (split /\|/, $line); if (grep {$std_name} readdir(PDFDIR)) { print "I found this: $std_name\n&

how to take action based on the existence of a value in a hash

2008-01-14 Thread Angus Glanville
f a key not a value, and the user will input the value. thanks in advance for any hints. -Angus #!/usr/bin/perl use strict; use warnings; print "enter path:"; chomp (my $dir = ); my %directory_hash = ("dir1" => "/usr/bin", "dir2&q

RE: GnuPG module help?

2006-05-24 Thread Angus
done something similar to this in the past. To see the data encrypted simply print out the array @encrypted to screen or back to a file. Hope this helps, -angus -Original Message- From: Jason Balicki [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 23, 2006 8:31 AM To: beginners@perl.org S

problems with Class::Std and Vstrings

2006-03-08 Thread Angus
x27;s dependencies? Thanks, -angus

RE: problems with logical && (and) statement

2006-03-03 Thread Angus
day, March 03, 2006 1:25 AM To: Angus; beginners@perl.org Subject: RE: problems with logical && (and) statement Is the typo "$dhcp{$wrkst}-{network}" in your production script? -Original Message- From: Angus [mailto:[EMAIL PROTECTED] Sent: Friday, March 03, 2006 1:

problems with logical && (and) statement

2006-03-03 Thread Angus
hostname "HOST2"; } lease 10.10.97.170 { starts 0 2005/12/25 23:08:02; ends 1 2005/12/26 03:08:02; tstp 1 2005/12/26 03:08:02; binding state free; hardware ethernet 00:0b:97:2b:ea:54; uid "\001\000\013\227+\352T"; client-hostname "HOST3"; } Script generated output # Host info including names and ip addr # # # HOSTNAME HOST IP Host is HOST1 Subnet is 10.10.12.1 Host is HOST2 Subnet is 10.10.9.128 Host is HOST3 Subnet is 10.10.14.128 Thanks, -angus

problems matching strings within variables.

2006-03-02 Thread Angus
Hello all, I have found a very useful little module for parsing DHCP logs and in the following script I have been able to create a hash of hashes based on the data extracted from a dhcp log. However, my problem now is that I want to determine what subnet a host is on. For the moment I will on

RE: problems parsing a DHCP.leases file.

2006-03-02 Thread Angus
t does the m on the outside do? Thanks again for the example it is really interesting and has helped me. -angus -Original Message- From: Hans Meier (John Doe) [mailto:[EMAIL PROTECTED] Sent: Monday, February 27, 2006 12:53 AM To: beginners@perl.org Subject: Re: problems parsing a DHCP

RE: problems parsing a DHCP.leases file.

2006-02-27 Thread Angus
did try to regex match but it still returns an undef variable... -angus -Original Message- From: The Ghost [mailto:[EMAIL PROTECTED] Sent: Monday, February 27, 2006 12:13 AM To: Angus Cc: beginners@perl.org Subject: Re: problems parsing a DHCP.leases file. you need to match something. Yo

problems parsing a DHCP.leases file.

2006-02-26 Thread Angus
ient-hostname/) { $hostname = $1; } else {next;}; print "I found IP:$ip\n"; print "I found Hostname: $hostname\n"; } } Thanks, -angus

RE: How to compare hashes to find matching keys with conflicting values.

2006-02-03 Thread Angus
th really understanding this but I am closer. Well again thanks for your help, -angus P.s. Your English is probably better than mine; I wouldn't know it wasn't your first language if you didn't mention it. -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sen

RE: How to compare hashes to find matching keys with conflicting values.

2006-02-02 Thread Angus
d explain how this works but if you don't want to I understand and still very much appreciate your help. Thanks, -angus #!/usr/bin/perl # use strict; use warnings; system "clear"; my %actual = ( "host1" => "164.72.119.175", "host2" => "16

How to compare hashes to find matching keys with conflicting values.

2006-02-01 Thread Angus
Hello, I am trying to write a little script that will compare two hashes with the same keys but conflicting values. I have found some great examples of how to compare hashes and locate common keys or missing keys (in the cookbook). I have also found a great example of how to locate duplicate k

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jenda, Thanks for a very impressive answer. Angus -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 12:05 To: Laycock, Angus; [EMAIL PROTECTED] Subject: RE: @ARGV question From: "Laycock, Angus" <[EMAIL PROTECTED]> > $ARGV[$co

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jonathan, Thanks for your help. I just want the info in the parameters that I was passing and changing it to foreach loop has done the job. I just assumed the while loop would do what I wanted. Thanks for your help again. Angus -Original Message- From: Jonathan E. Paton [mailto

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
oop twice rather than once. On the second iteration there is no value to process. Angus -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 11:05 To: [EMAIL PROTECTED] Subject: Re: @ARGV question > while (<$ARGV>) { > print &

@ARGV question

2002-03-18 Thread Laycock, Angus
Could someone tell me the best way. I assumed the first option would be the best but it does not work. Thanks Angus -- This message is intended only for the personal and confidential use of the designated recipie

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
I'll try this in the morning. Thanks Gus - Original Message - From: Timothy Johnson <[EMAIL PROTECTED]> To: Timothy Johnson <[EMAIL PROTECTED]>; 'Angus Laycock' <[EMAIL PROTECTED]>; Tanton Gibbs <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent:

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
ut. I thought I would try with the option of not quoting numbers. It is a total headblower and I don't have much time. Gus - Original Message - From: Michael Fowler <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday,

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
What about on negative numbers like -1? They come up with quotes, any ideas? Thanks Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:53 PM Subject: Re: Crea

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
I know I now have the result but how does it do it? $string .= /\D/ ? "'$_'," : "$_,"; If you have the time. Thanks again Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROT

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
Tanton, Cheers. I stuck a chop in at the end and got the results. 'alf','bert','charlie',4 Thanks to you both Cheers again Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROT

Re: Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
rings. Thanks Gus - Original Message - From: Timothy Johnson <[EMAIL PROTECTED]> To: 'Angus Laycock' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:24 PM Subject: RE: Creating a string with quotes and delimiters from an Array

Creating a string with quotes and delimiters from an Array

2002-02-27 Thread Angus Laycock
Hi, I have an array > @array = qw(alf bert charlie 4) and I want a string that contains this value < 'alf','bert','charlie','4' > with the single quotes and commas. I know I can do this $string = join ( ',' , @array); which gives me this > < one|two|three|four> but how do I get the si

RE: Changing STDERR

2002-02-19 Thread Laycock, Angus
Job sorted, it works!!! Thanks you all for your help. Gus -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: 19 February 2002 15:20 To: '[EMAIL PROTECTED]' Subject: Re: Changing STDERR From: "Laycock, Angus" <[EMAIL PR

Changing STDERR

2002-02-19 Thread Laycock, Angus
Please, Can someone tell me how to change STDERR to output to a file then change it back to its original output. my $oldout = select STDERR; print STDERR "test1\n"; open STDERR, ">test.txt" or die "Can't open file STDERR [OUTPUT]"; print STDERR "test2\n";# goes to file select $ol

STDOUT & STDERR

2002-02-16 Thread Angus Laycock
Hi, I want to print messages from a script to either STDOUT or STDERR depending on a value of a variable. I want to control where I send the print statements to. Can I do something like this or are there other ways to control the target I send my message to. I'm hoping there are lots of other

Sybase & Perl DBI

2002-02-12 Thread Angus Laycock
Hi, I have written a script the handles calls to a Sybase Database. The only problem I have is handling the "Return Code" from Stored Procedures. I have gone through the PERL DBI book but the only reference I can find in the Appendix(Page 326), it is to do with syb_result_type. I have used

Getopt::Long problem (Allegedly)

2002-01-30 Thread Angus Laycock
Hi, I wrote this today on UNIX . When I tested the script, calling it with all the options (f s D P U S e q ) the "-s" option would not return the value from the command line. All the other variables got populated. I then change the "s:s" to "f:s" and that worked. I am trying to replace some s

Re: Perl path for windows 98

2002-01-29 Thread Angus Laycock
lt;[EMAIL PROTECTED]> To: 'Angus Laycock' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 10:24 PM Subject: RE: Perl path for windows 98 > > When you say that you "downloaded PERL", what distribution did you download? > For Win32 pla

Perl path for windows 98

2002-01-29 Thread Angus Laycock
Hi, I have just downloaded PERL and set it up on my machine at home. Is there a path (#!/whatever ) I can put at the top of my script instead of typing "perl myscript.pl" to execute the script in Windows 98. Thanks in Advance Gus