Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 45

Thread: What would it take to get a thread for perl?

  1. #21
    Join Date
    Apr 2005
    Posts
    104
    Rep Power
    0

    Default

    The following is code that can be run to take a long url in as input on the command line and it will spit out a short url. usefull when you need to give someone a long link over the telephone or when long urls look ugly

    Code:
    #!/bin/perl
    
    use WWW::Mechanize;
    use URI::Escape;
    
    my $mech = WWW::Mechanize->new();
    my $encoded = uri_escape(@ARGV);
    
    $mech->get("http://www.tinyurl.com");
    $mech->field("url", $encoded);
    $mech->submit();
    my $page = $mech->content();
    
    my ($result) = $page =~ /<small>\[<a href="(.*?)"/;
    
    print "$result\n";

  2. #22
    Join Date
    Apr 2005
    Posts
    104
    Rep Power
    0

    Default

    I'm betting that code can get smallar too. i'm sure there is a module for tinyurl but i never bothered to look.

  3. #23
    Join Date
    Mar 2004
    Posts
    1,685
    Rep Power
    0

    Default

    Reading that now. Might have to continue tomorrow thought, getting tired. Been doing alot of reading.

    So does your script retrieve entire threads, the last post, or the posts that have been made since your last check?

    I'm assuing its CLI, so what utilities have you written? Eg. does your tool have subscription capabilities? Hey, I'm thinking of integrating this with Growl! That way I'll get notifications when replies are posted to threads I'm monitoring.
    The answer you seek is *+5,2*3,2
    Check out my blog: http://rants.andreobrown.com

  4. #24
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default

    Yeah, thanks i was just about to ask that, cuz i see a lot of intersting scripts on the site, but coulnt identify which one u were using. There are some really intersting perl scripts there. im getting the ones used to send sms. Thanks again i'll let u know what think about them.

  5. #25
    Join Date
    Apr 2003
    Posts
    13,270
    Rep Power
    35

    Default

    Guys, if you want to talk perl, start a new thread in the General Programming forum. Thanks.
    "The best software is the one that fits your needs." - A_A

    Virus free since: date unknown
    Anti-virus free since: August 2008

  6. #26
    Join Date
    Apr 2005
    Posts
    104
    Rep Power
    0

    Default

    indeed, smaller we get

    Code:
    #!/bin/perl
    
    use WWW::Shorten::TinyURL;
    
    my $short_url = makeashorterlink(@ARGV);
    
    print "$short_url\n";
    the previous example is still good for seeing how www::mechanize works though

  7. #27
    Join Date
    Apr 2005
    Posts
    104
    Rep Power
    0

    Default

    arch_angel perhaps you could move this thread there? or perhaps you could create a perl thread and move it there too?

  8. #28
    Join Date
    Mar 2004
    Posts
    1,685
    Rep Power
    0

    Default

    I like mechnize and will be playing with it. I dont think this will get you your perl thread, but you have attracted at least two followers of Perl
    The answer you seek is *+5,2*3,2
    Check out my blog: http://rants.andreobrown.com

  9. #29
    Join Date
    Feb 2003
    Posts
    3,184
    Rep Power
    0

    Default

    Note that the size of a program isn't entirely the amount of lines it takes you to write a program but the sum of the lines in the libraries that the program encompasses (even if you cannot see the libraries).

  10. #30
    Join Date
    Jan 2005
    Posts
    3,151
    Rep Power
    0

    Default

    so its all about the perl hype now eh... perl is my favorite scripting language.
    I have never tried python out before though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •