Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support Perl - Retrieving and Printing Security Token Post 302542572 by radoulov on Thursday 28th of July 2011 03:47:12 AM
Old 07-28-2011
You're script seems to work for me - I've just tested it with The UNIX and Linux Forums - Learn UNIX and Linux from Experts, it printed out the security-id. If it still doesn't work for you, try to print and post the content of the variable $content:


Code:
my $content = $ua->get("$url/index.php")->content;

print $content, "\n";

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl printing error

Hi Scripting Gurus, I am new bee in perl, and trying to write a script which must print the free disk space availability of C and E drives. Please advice. Here is the script snippet and expected output: #!/usr/bin/perl use CGI qw/:html3 :standard/; $spaceuselog =... (4 Replies)
Discussion started by: ccsaviour
4 Replies

2. Shell Programming and Scripting

Need help in printing a sql query in perl

Hi All, I have the following sql query select abcd from udbadm.log where xyz='1'. I have 16k queries similar to this with different values for xyz. I want to print the values of 'abcd' for each row. I have the following perl code, but not sure how i can print that particular... (1 Reply)
Discussion started by: userscript
1 Replies

3. Shell Programming and Scripting

[Perl] Printing - Scalars

Hey Guys, I have some weird problem with printing scalars ... When I'm executing script both are printing in terminal ... But only one is printed to the file ? I don't know whats going on .. :) Btw .. I'm noobie :) took me lots of time to put this simple script together :) Thank you... (3 Replies)
Discussion started by: NDxiak
3 Replies

4. Shell Programming and Scripting

Printing between 2 matches with Perl

Can we please modify this perl one-liner to print lines between pattern1 and pattern2 in a file? Currently it prints lines till pattern2. (4 Replies)
Discussion started by: anand_bh
4 Replies

5. Shell Programming and Scripting

Q:Perl Extracting & Printing Security Token

I have a script which is supposed to log in to my vB account and print my security token, however doesn't seem to work globally. The logging in works perfectly just will not retrieve and print the security token for every forum I log in to. Code Below: #!/usr/bin/perl use LWP::UserAgent; ... (8 Replies)
Discussion started by: AndrewTwain
8 Replies

6. Shell Programming and Scripting

Perl: selective printing of lines

Hi, I have a file with lines like this. 2 7 18 ggcgt anna 2 7 18 hhchc sam 3 7 18 hhdjcc ross 4 7 18 hhcjd jenny 0 8 21 jjdhs sam 3 8 21 kkok bush 2 9 24 kosss BrenhamIf the values of the second column are equal, print only those lines with the least first column value. So in... (5 Replies)
Discussion started by: polsum
5 Replies

7. Shell Programming and Scripting

help with perl database printing

Hey guys i am using perl and trying to pull a list of books from a database and then populate the list in a separate TT2 file. When the list is generated there should be 39 book names. When I do the foreach statement in my tt2 below, the first statement gives me 39 Array(random number) and the... (1 Reply)
Discussion started by: Joey12
1 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Security Token

I got this message while submitting a reply to a thread. I could submitt the replies till yesterday but today it shows me the following message "Your submission could not be processed because a security token was missing." What should I do to resolve this? (1 Reply)
Discussion started by: Akang
1 Replies
MKDoc::XML::Token(3pm)					User Contributed Perl Documentation				    MKDoc::XML::Token(3pm)

NAME
MKDoc::XML::Token - XML Token Object SYNOPSIS
my $tokens = MKDoc::XML::Tokenizer->process_data ($some_xml); foreach my $token (@{$tokens}) { print "'" . $token->as_string() . "' is text " if (defined $token->text()); print "'" . $token->as_string() . "' is a self closing tag " if (defined $token->tag_self_close()); print "'" . $token->as_string() . "' is an opening tag " if (defined $token->tag_open()); print "'" . $token->as_string() . "' is a closing tag " if (defined $token->tag_close()); print "'" . $token->as_string() . "' is a processing instruction " if (defined $token->pi()); print "'" . $token->as_string() . "' is a declaration " if (defined $token->declaration()); print "'" . $token->as_string() . "' is a comment " if (defined $token->comment()); print "'" . $token->as_string() . "' is a tag " if (defined $token->tag()); print "'" . $token->as_string() . "' is a pseudo-tag (NOT text and NOT tag) " if (defined $token->pseudotag()); print "'" . $token->as_string() . "' is a leaf token (NOT opening tag) " if (defined $token->leaf()); } SUMMARY
MKDoc::XML::Token is an object representing an XML token produced by MKDoc::XML::Tokenizer. It has a set of methods to identify the type of token it is, as well as to help building a parsed tree as in MKDoc::XML::TreeBuilder. API
my $token = new MKDoc::XML::Token ($string_token); Constructs a new MKDoc::XML::Token object. my $string_token = $token->as_string(); Returns the string representation of this token so that: MKDoc::XML::Token->new ($token)->as_string eq $token is a tautology. my $node = $token->leaf(); If this token is not an opening tag, this method will return its corresponding node structure as returned by $token->text(), $token->tag_self_close(), etc. Returns undef otherwise. my $node = $token->pseudotag(); If this token is a comment, declaration or processing instruction, this method will return $token->tag_comment(), $token_declaration() or $token->pi() resp. Returns undef otherwise. my $node = $token->tag(); If this token is an opening, closing, or self closing tag, this method will return $token->tag_open(), $token->tag_close() or $token->tag_self_close() resp. Returns undef otherwise. my $node = $token->comment(); If this token object represents a declaration, the following structure is returned: # this is <!-- I like Pie. Pie is good --> { _tag => '~comment', text => ' I like Pie. Pie is good ', } Returns undef otherwise. my $node = $token->declaration(); If this token object represents a declaration, the following structure is returned: # this is <!DOCTYPE foo> { _tag => '~declaration', text => 'DOCTYPE foo', } Returns undef otherwise. my $node = $token->pi(); If this token object represents a processing instruction, the following structure is returned: # this is <?xml version="1.0" charset="UTF-8"?> { _tag => '~pi', text => 'xml version="1.0" charset="UTF-8"', } Returns undef otherwise. my $node = $token->tag_open(); If this token object represents an opening tag, the following structure is returned: # this is <aTag foo="bar" baz="buz"> { _tag => 'aTag', _open => 1, _close => 0, foo => 'bar', baz => 'buz', } Returns undef otherwise. my $node = $token->tag_close(); If this token object represents a closing tag, the following structure is returned: # this is </aTag> { _tag => 'aTag', _open => 0, _close => 1, } Returns undef otherwise. my $node = $token->tag_self_close(); If this token object represents a self-closing tag, the following structure is returned: # this is <aTag foo="bar" baz="buz" /> { _tag => 'aTag', _open => 1, _close => 1, foo => 'bar', baz => 'buz', } Returns undef otherwise. my $node = $token->text(); If this token object represents a piece of text, then this text is returned. Returns undef otherwise. TRAP! $token->text() returns a false value if this text happens to be '0' or ''. So really you should use: if (defined $token->text()) { ... do stuff... } NOTES
MKDoc::XML::Token works with MKDoc::XML::Tokenizer, which can be used when building a full tree is not necessary. If you need to build a tree, look at MKDoc::XML::TreeBuilder. AUTHOR
Copyright 2003 - MKDoc Holdings Ltd. Author: Jean-Michel Hiver This module is free software and is distributed under the same license as Perl itself. Use it at your own risk. SEE ALSO
MKDoc::XML::Tokenizer MKDoc::XML::TreeBuilder perl v5.10.1 2004-10-06 MKDoc::XML::Token(3pm)
All times are GMT -4. The time now is 03:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy