My Perl scripts don't run anymore


G

Graham Stow

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, '(e-mail address removed)', '(e-mail address removed)');
}

$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());
}
 
Ad

Advertisements

A

A. Sinan Unur

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
 
G

Graham Stow

A. Sinan Unur said:
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.
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.
 
G

Graham Stow

Graham Stow said:
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....
 
T

Tad McClellan

Graham Stow said:
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: [email protected]

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

Advertisements

U

Uri Guttman

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

TM> See the thread with

TM> Message-ID: [email protected]

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
 
Ad

Advertisements


Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top