My Perl scripts don't run anymore

Discussion in 'Perl Misc' started by Graham Stow, Nov 3, 2007.

  1. Graham Stow

    Graham Stow Guest

    Stupidly, I ran the script below (copied from the book 'Perl - I Didn't Know
    You Could Do That...' by Martin C. Brown) without understanding what the
    script was doing. Now, none of my Perl scipts run anymore - all that happens
    is that the command prompt window is minimised and a Windows Wordpad window
    containing my script, pops up. I'm running v5.8.6 on a W32 system. Can
    anyone tell me what I've done and how I correct it? Instict tells me it
    might have something to do with the use of the Getopt::Std module, but I
    really don't know.

    use Net::pOP3;
    use Net::SMTP;
    use Getopt::Std;

    getopts('q');

    my ($host, $login, $password) = ('atuin', 'mcbmac', 'Tamsin');

    my $server = Net::pOP3->new($host, Debug => 99999);
    warn "Couldn't connect to server $host" unless $server;
    my $nomsgs = $server->login($login, $password);

    die "Could not login" unless defined($nomsgs);

    my $msglist = $server->list();
    $nomsgs = keys %$msglist;

    print "There are $nomsgs messages on $host\n";

    foreach my $msg_id (keys %$msglist)
    {
    my $msgcontent = $server->get($msg_id);
    forward($msgcontent, '', '');
    }

    $server->quit();

    sub forward
    {
    my ($message, $from, $to) = @_;
    $smtp = Net::SMTP->new('mail');
    die "Couldn't open connection to server" unless $smtp;
    $smtp->mail($from) or die "Bad 'from' address";
    $smtp->to($to) or die "Bad 'to' address";
    $smtp->data();
    $smtp->datasend(join('',@$message));
    die "Connection wouldn't accept data"
    unless($smtp->dataend());
    }
     
    Graham Stow, Nov 3, 2007
    #1
    1. Advertising

  2. "Graham Stow" <> wrote in
    news:fgi0ql$2iiv$:

    > Stupidly, I ran the script below (copied from the book 'Perl - I
    > Didn't Know You Could Do That...' by Martin C. Brown) without
    > understanding what the script was doing.


    Well, the script does not do anything other than send mail (I hope those
    are not real server and user names and password you provided).

    > Now, none of my Perl scipts
    > run anymore - all that happens is that the command prompt window is
    > minimised and a Windows Wordpad window containing my script, pops up.
    > I'm running v5.8.6 on a W32 system.


    Your instinct is wrong. It sounds like you associated files with .pl
    extension with Notepad.

    Your question has nothing to do with Perl and everything to do with the
    fact that you do not understand the basic features of the operating
    system you are using.

    You can manually fix the file associations or just uninstall and
    reinstall ActiveState Perl to restore them for you.

    Sinan


    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)
    clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>
     
    A. Sinan Unur, Nov 3, 2007
    #2
    1. Advertising

  3. Graham Stow

    Graham Stow Guest

    "A. Sinan Unur" <> wrote in message
    news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
    > "Graham Stow" <> wrote in
    > news:fgi0ql$2iiv$:
    >
    >> Stupidly, I ran the script below (copied from the book 'Perl - I
    >> Didn't Know You Could Do That...' by Martin C. Brown) without
    >> understanding what the script was doing.

    >
    > Well, the script does not do anything other than send mail (I hope those
    > are not real server and user names and password you provided).

    I trust the author had the foresight not to use real server and user names,
    and password.

    >
    >> Now, none of my Perl scipts
    >> run anymore - all that happens is that the command prompt window is
    >> minimised and a Windows Wordpad window containing my script, pops up.
    >> I'm running v5.8.6 on a W32 system.

    >
    > Your instinct is wrong. It sounds like you associated files with .pl
    > extension with Notepad.

    Everything was fine before I ran this script. Before when I double clicked
    on a Perl script it opened in Wordpad, and it does so now, so nothing has
    changed there

    >
    > Your question has nothing to do with Perl and everything to do with the
    > fact that you do not understand the basic features of the operating
    > system you are using.
    >
    > You can manually fix the file associations or just uninstall and
    > reinstall ActiveState Perl to restore them for you.

    As I say, before when I double clicked on a Perl script it opened in
    Wordpad, and it does so now, so I can't see that file association has
    anyrthing to do with this.
     
    Graham Stow, Nov 3, 2007
    #3
  4. Graham Stow

    Graham Stow Guest

    "Graham Stow" <> wrote in message
    news:fgi25k$2kv6$...
    >
    > "A. Sinan Unur" <> wrote in message
    > news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
    >> "Graham Stow" <> wrote in
    >> news:fgi0ql$2iiv$:
    >>
    >> You can manually fix the file associations or just uninstall and
    >> reinstall ActiveState Perl to restore them for you.

    > As I say, before when I double clicked on a Perl script it opened in
    > Wordpad, and it does so now, so I can't see that file association has
    > anyrthing to do with this.
    >

    I spoke too soon. You were absolutely correct Sinan - it was a file
    association problem. Can't think how it happened though....
     
    Graham Stow, Nov 3, 2007
    #4
  5. Graham Stow <> wrote:
    >
    > "A. Sinan Unur" <> wrote in message
    > news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
    >> "Graham Stow" <> wrote in
    >> news:fgi0ql$2iiv$:
    >>
    >>> Stupidly, I ran the script below (copied from the book 'Perl - I
    >>> Didn't Know You Could Do That...' by Martin C. Brown) without
    >>> understanding what the script was doing.

    >>
    >> Well, the script does not do anything other than send mail (I hope those
    >> are not real server and user names and password you provided).

    > I trust the author had the foresight not to use real server and user names,
    > and password.



    Trusting this particular author is a very bad idea.

    See the thread with

    Message-ID: 7gnc7e$k9i$

    wherein many of us had a good laugh at this author's expense.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad McClellan, Nov 4, 2007
    #5
  6. Graham Stow

    Uri Guttman Guest

    >>>>> "TM" == Tad McClellan <> writes:

    >>>> Stupidly, I ran the script below (copied from the book 'Perl - I
    >>>> Didn't Know You Could Do That...' by Martin C. Brown) without
    >>>> understanding what the script was doing.


    TM> Trusting this particular author is a very bad idea.

    TM> See the thread with

    TM> Message-ID: 7gnc7e$k9i$

    TM> wherein many of us had a good laugh at this author's expense.

    wow, that was a fun thread and LONG ago. brings back memories as mine
    are corrupted by cosmic rays. amazing how much has changed in 8.5 years.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Nov 4, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    700
  2. Eric Lilja
    Replies:
    4
    Views:
    504
  3. JohnQ

    I don't want this anymore

    JohnQ, Aug 26, 2007, in forum: C++
    Replies:
    1
    Views:
    319
    Juha Nieminen
    Aug 26, 2007
  4. J
    Replies:
    1
    Views:
    460
    Martin P. Hellwig
    Apr 1, 2010
  5. Replies:
    13
    Views:
    579
    Anno Siegel
    Sep 10, 2007
Loading...

Share This Page