My Perl scripts don"t run anymore
My Perl scripts don"t run anymore
am 03.11.2007 15:31:05 von 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, 'mc@mcwords.com', 'mc@mcwords.com');
}
$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());
}
Re: My Perl scripts don"t run anymore
am 03.11.2007 15:39:57 von 1usa
"Graham Stow" wrote in
news:fgi0ql$2iiv$1@energise.enta.net:
> 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 <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines:
Re: My Perl scripts don"t run anymore
am 03.11.2007 15:53:58 von Graham Stow
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
> "Graham Stow" wrote in
> news:fgi0ql$2iiv$1@energise.enta.net:
>
>> 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.
Re: My Perl scripts don"t run anymore
am 03.11.2007 16:44:10 von Graham Stow
"Graham Stow" wrote in message
news:fgi25k$2kv6$1@energise.enta.net...
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
>> "Graham Stow" wrote in
>> news:fgi0ql$2iiv$1@energise.enta.net:
>>
>> 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....
Re: My Perl scripts don"t run anymore
am 04.11.2007 03:33:50 von Tad McClellan
Graham Stow wrote:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns99DD6C7EE8B7Aasu1cornelledu@127.0.0.1...
>> "Graham Stow" wrote in
>> news:fgi0ql$2iiv$1@energise.enta.net:
>>
>>> 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$1@nnrp1.dejanews.com
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/"
Re: My Perl scripts don"t run anymore
am 04.11.2007 03:53:23 von Uri Guttman
>>>>> "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$1@nnrp1.dejanews.com
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 ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org