Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Comments are in. Hope you find them helpful in pointing me in the right direction. I tested the 2 argument bless in the first subroutine. When it was data dumped, I didn't see any change in how the data was stored.

I went with the first one since it is the most straight forward. It does not have any of my other custom subroutines used in it and stands on its own.

sub accounts { my ($class) = @_; my @accounts = qw( Lady_Aleena LadyAleena_ABC LadyAleena_CBS LadyAleena_FOX LadyAleena_NBC LadyAleena_SyFy LadyAleena_TNT LadyAleena_USA LadyAleena_TV LadyAleena_eros LadyAleena_home LadyAleena_test ); return bless \@accounts, $class; }

After adding $class on the last line, the data dumped looked like...

$VAR1 = bless( [ 'Lady_Aleena', 'LadyAleena_ABC', 'LadyAleena_CBS', 'LadyAleena_FOX', 'LadyAleena_NBC', 'LadyAleena_SyFy', 'LadyAleena_TNT', 'LadyAleena_USA', 'LadyAleena_TV', 'LadyAleena_eros', 'LadyAleena_home', 'LadyAleena_test' ], 'Twitter::Objects' );

I got the same result without $class on the last line. When I use the subroutine as an object, I would do something like...

use strict; use warnings; use lib '../files/perl/lib'; use Twitter::Objects; my $accounts = Twitter::Objects->accounts; for my $account (@{$accounts}) { print $account; # and other code I want to run through this loop. }

I'm not sure what I'm missing.

Have a cookie and a very nice day!
Lady Aleena

In reply to Re^2: RFC on how I'm doing when it comes to writing objects? by Lady_Aleena
in thread RFC on how I'm doing when it comes to writing objects? by Lady_Aleena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-25 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found