CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
-&gt

 



kc5jnz
New User

Jan 4, 2006, 1:13 AM

Post #1 of 5 (794 views)
-&gt Can't Post

I had been looking for some perl code to give me all the computer names is an AD forest. "Active Directory Cookbook" by Robbie Allen as the exact item I need, except that perl is choking on the source code.

Specifically the -&gt calls as in

$intObj = Math::BigInt->new($sixmonth_secs);

What is the -&gt call?


davorg
Thaumaturge / Moderator

Jan 4, 2006, 2:18 AM

Post #2 of 5 (793 views)
Re: [kc5jnz] -&gt [In reply to] Can't Post

(I really wouldn't consider this "intermediate" Perl)

I assume that you mean -> instead of -> - please check how your messages look before posting them.

This is how class and object methods are called in Perl. In your example, "Math::BigInt" is a class and "new" is the constructor method. Calling Math::BigInt->new constructs a new Math::BigInt object and returns a reference to it. You can then call object methods on that object also using the -> syntax, for example, $intObj->is_neg().

See the Math::BigInt docs for more information.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


kc5jnz
New User

Jan 4, 2006, 2:24 AM

Post #3 of 5 (790 views)
Re: [kc5jnz] -&gt [In reply to] Can't Post

Here is another example and the source. I tried -> when I initially looked at the script & believed it to be in error. in this please note the semi colon between -&gt and the GetObject. In this code, also introduced is the &lt (and no function). If I am in the wrong section for this post, my apologies.

# Adapted from VBScript code contained in the book:
# "Active Directory Cookbook" by Robbie Allen
# Publisher: O'Reilly and Associates
# ISBN: 0-596-00466-4
# Book web site: http://rallenhome.com/books/adcookbook/code.html
# ---------------------------------------------------------------
use Win32::OLE 'in';
$Win32::OLE::Warn = 3;
my $objOU = Win32::OLE->GetObject("LDAP://<OrgUnitDN>");
foreach my $objChildObject (in $objOU) {
print $objChildObject->Name,"\n";
}


KevinR
Veteran


Jan 4, 2006, 11:15 AM

Post #4 of 5 (787 views)
Re: [kc5jnz] -&gt [In reply to] Can't Post

it appears you are reading the perl source in a browser, the &lt; and other entities like this are supposed to display as regular characters, like &lt; is < and &gt; is > so the line:

GetObject("LDAP://&lt;OrgUnitDN&gt;");

should be:

GetObject("LDAP://<OrgUnitDN>");

EDIT:

actually it's a PDF document, but it looks OK to me.
-------------------------------------------------


(This post was edited by KevinR on Jan 4, 2006, 11:19 AM)


davorg
Thaumaturge / Moderator

Jan 5, 2006, 4:45 AM

Post #5 of 5 (779 views)
Re: [kc5jnz] -&gt [In reply to] Can't Post

&gt; and &lt; are HTML entities. They mean > and <.

I don't know how you are accessing this code, but something is failing to convert these entities into their text equivalents.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives