Home: Perl Programming Help: Intermediate:
-&gt



kc5jnz
New User

Jan 4, 2006, 1:13 AM


Views: 1623
-&gt

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


Views: 1622
Re: [kc5jnz] -&gt

(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


Views: 1619
Re: [kc5jnz] -&gt

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


Views: 1616
Re: [kc5jnz] -&gt

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


Views: 1608
Re: [kc5jnz] -&gt

&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